  /* ---------- Code-to-Visualize coming-soon page ---------- */
  .code-soon-card {
    max-width: 720px;
    margin: 24px auto 0;
    padding: 36px 32px;
    border-radius: 22px;
    background: var(--panel);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--panel-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 14px;
  }
  .code-soon-icon {
    width: 80px; height: 80px;
    border-radius: 22px;
    display: grid;
    place-items: center;
    background: linear-gradient(180deg, #fcd34d, #d97706);
    color: white;
    font-size: 36px;
    line-height: 1;
    box-shadow:
      inset 0 1px 0 rgba(255,255,255,0.20),
      0 12px 30px rgba(217,119,6,0.45);
  }
  .code-soon-card h2 {
    font-size: 28px;
    margin: 4px 0 0;
    letter-spacing: -0.01em;
  }
  .code-soon-tagline {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 999px;
    background: rgba(217,119,6,0.14);
    border: 1px solid rgba(252,211,77,0.4);
    color: #fcd34d;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.08em;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    margin: 0;
  }
  .code-soon-body {
    color: var(--muted);
    font-size: 15px;
    line-height: 1.6;
    max-width: 560px;
    margin: 6px 0 4px;
  }
  .code-soon-body code {
    background: rgba(15,23,42,0.7);
    border: 1px solid rgba(148,163,184,0.18);
    border-radius: 5px;
    padding: 1px 6px;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 13px;
    color: var(--accent);
  }
  .code-soon-features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    width: 100%;
    margin-top: 10px;
  }
  .cs-feature {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 12px;
    border-radius: 14px;
    background: rgba(15,23,42,0.45);
    border: 1px solid var(--panel-border);
    text-align: center;
  }
  .cs-feature-icon {
    font-size: 22px;
    width: 42px; height: 42px;
    border-radius: 12px;
    display: grid; place-items: center;
    line-height: 1;
    background: rgba(56,189,248,0.10);
    border: 1px solid rgba(56,189,248,0.20);
  }
  .cs-feature strong {
    color: var(--text);
    font-size: 13.5px;
  }
  .cs-feature div div {
    color: var(--muted);
    font-size: 11.5px;
    margin-top: 2px;
  }
  .code-soon-cta {
    margin-top: 8px;
    padding: 10px 18px;
    border-radius: 10px;
    background: linear-gradient(180deg, var(--accent-2), var(--accent));
    color: #0a0e1a;
    text-decoration: none;
    font-weight: 700;
    font-size: 13.5px;
    box-shadow: 0 6px 16px rgba(56,189,248,0.35);
    transition: transform 0.2s var(--spring), box-shadow 0.2s;
  }
  .code-soon-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(56,189,248,0.5);
  }

  /* ========================================================
     CODE TO VISUALIZE - workspace
     ======================================================== */
  .cv-workspace {
    display: grid;
    grid-template-columns: minmax(320px, 1fr) minmax(360px, 1.4fr);
    gap: 14px;
    padding: 12px var(--pad-x) 18px;
    width: 100%;
    box-sizing: border-box;
    flex: 1;
    min-height: 0;
  }

  /* ----- Editor panel ----- */
  .cv-editor-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 14px;
    padding: 12px;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    min-height: 460px;
  }
  .cv-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 12px var(--pad-x);
    border-bottom: 1px solid var(--panel-border);
    background: rgba(15,23,42,0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
  .cv-controls-spacer { flex: 1; }
  .cv-select {
    background: rgba(15,23,42,0.7);
    color: var(--text);
    border: 1px solid var(--panel-border);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 12px;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    cursor: pointer;
    min-height: 40px;
  }
  .cv-select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
  .cv-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(15,23,42,0.7);
    color: var(--text);
    border: 1px solid var(--panel-border);
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    min-height: 40px;
    transition: transform 0.15s var(--spring), border-color 0.15s, color 0.15s, background 0.15s, box-shadow 0.15s;
  }
  .cv-btn:not(.primary):hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(56,189,248,0.18);
  }
  .cv-btn:active:not(:disabled) { transform: translateY(0) scale(0.97); }
  .cv-btn:disabled { opacity: 0.35; cursor: not-allowed; }
  .cv-btn.primary {
    background: linear-gradient(180deg, #7dd3fc, #38bdf8);
    color: #0a0e1a;
    border-color: transparent;
    font-weight: 700;
    box-shadow: 0 6px 18px rgba(56,189,248,0.35);
  }
  .cv-btn.primary:hover:not(:disabled) {
    background: linear-gradient(180deg, #93dffd, #38bdf8);
    color: #0a0e1a;
    box-shadow: 0 8px 22px rgba(56,189,248,0.45);
    transform: translateY(-1px);
  }
  .cv-btn.primary:disabled { opacity: 0.4; }
  .cv-btn.primary.cv-playing {
    background: rgba(15,23,42,0.7);
    color: var(--text);
    border: 1px solid var(--panel-border);
    box-shadow: none;
    font-weight: 500;
  }
  .cv-btn.primary.cv-playing:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(15,23,42,0.7);
    box-shadow: 0 4px 14px rgba(56,189,248,0.18);
    transform: translateY(-1px);
  }

  .cv-editor-wrap {
    position: relative;
    flex: 1;
    min-height: 320px;
    border-radius: 10px;
    overflow: hidden;
    background: #0d1119;
    border: 1px solid rgba(148,163,184,0.18);
  }
  .cv-editor-wrap textarea,
  .cv-editor-wrap .cv-highlight {
    position: absolute;
    inset: 0;
    margin: 0;
    padding: 14px 16px;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 13.5px;
    line-height: 1.55;
    border: 0;
    box-sizing: border-box;
    overflow: auto;
    white-space: pre;
    word-wrap: normal;
    tab-size: 2;
    -moz-tab-size: 2;
  }
  .cv-editor-wrap .cv-highlight {
    pointer-events: none;
    background: transparent;
    color: #e2e8f0;
    z-index: 1;
  }
  .cv-editor-wrap .cv-highlight code {
    background: transparent !important;
    padding: 0 !important;
    color: inherit;
    text-shadow: none !important;
    font: inherit;
  }
  .cv-editor-wrap textarea {
    background: transparent;
    color: transparent;
    caret-color: var(--accent);
    z-index: 3;
    resize: none;
    outline: none;
  }
  .cv-editor-wrap textarea::selection {
    background: rgba(56,189,248,0.30);
    color: transparent;
  }
  .cv-line-marker {
    position: absolute;
    left: 0;
    right: 0;
    background: linear-gradient(90deg, rgba(252,211,77,0.18), rgba(252,211,77,0.05));
    border-left: 3px solid #fbbf24;
    pointer-events: none;
    z-index: 2;
    transition: top 0.18s ease-out, height 0.18s;
  }

  /* Autocomplete popup floats above the editor near the cursor */
  .cv-autocomplete {
    position: absolute;
    z-index: 4;
    margin: 0;
    padding: 4px;
    list-style: none;
    background: rgba(10,14,26,0.97);
    border: 1px solid rgba(56,189,248,0.30);
    border-radius: 8px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.55);
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 12.5px;
    min-width: 180px;
    max-width: 360px;
    max-height: 220px;
    overflow-y: auto;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }
  .cv-ac-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    border-radius: 5px;
    cursor: pointer;
    color: var(--text);
    line-height: 1.3;
    user-select: none;
  }
  .cv-ac-item:hover { background: rgba(56,189,248,0.10); }
  .cv-ac-item.active {
    background: linear-gradient(180deg, rgba(56,189,248,0.22), rgba(56,189,248,0.14));
    border: 1px solid rgba(56,189,248,0.4);
    padding: 4px 7px;            /* compensate for border so height stays */
  }
  .cv-ac-kind {
    width: 18px; height: 18px;
    display: grid; place-items: center;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0;
    flex-shrink: 0;
    color: white;
  }
  .cv-ac-kind-class   { background: linear-gradient(180deg, #c4b5fd, #6d28d9); }
  .cv-ac-kind-method  { background: linear-gradient(180deg, #93dffd, #2563eb); }
  .cv-ac-kind-prop    { background: linear-gradient(180deg, #86efac, #16a34a); color: #04200d; }
  .cv-ac-kind-global  { background: linear-gradient(180deg, #fcd34d, #d97706); color: #1a1206; }
  .cv-ac-kind-keyword { background: linear-gradient(180deg, #fda4af, #be123c); }
  .cv-ac-label { flex: 1; color: var(--text); }
  .cv-ac-detail {
    color: var(--muted);
    font-size: 11px;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 130px;
  }
  .cv-status {
    color: var(--muted);
    font-size: 12.5px;
    padding: 6px 8px;
    border-radius: 8px;
    background: rgba(15,23,42,0.4);
    min-height: 28px;
    line-height: 1.5;
  }
  .cv-status .cv-error { color: #fca5a5; font-weight: 600; }
  .cv-status .cv-warn  { color: #fcd34d; }
  .cv-status code {
    background: rgba(56,189,248,0.10);
    border: 1px solid rgba(56,189,248,0.20);
    border-radius: 4px;
    padding: 1px 5px;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 12px;
    color: var(--accent);
    margin: 0 1px;
  }

  /* ----- Viz panel ----- */
  .cv-viz-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 14px;
    padding: 12px;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    min-height: 460px;
    overflow: hidden;
    position: relative;
  }
  .cv-progress {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: rgba(255,255,255,0.05);
    overflow: hidden;
    z-index: 2;
    border-radius: 14px 14px 0 0;
  }
  #cv-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    transition: width 0.35s var(--ease);
    box-shadow: 0 0 12px var(--accent);
    will-change: width;
  }
  .cv-step-counter {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(56,189,248,0.12);
    border: 1px solid rgba(56,189,248,0.25);
    color: var(--accent);
    font-size: 11.5px;
    font-weight: 600;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    letter-spacing: 0.03em;
    white-space: nowrap;
  }
  .cv-speed-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--muted);
    margin-left: 12px;
  }
  .cv-speed-wrap input[type="range"] {
    width: 220px;
    accent-color: var(--accent);
  }

  .cv-stage {
    flex: 1;
    overflow: auto;
    padding: 16px 8px;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    justify-content: center;
    gap: 14px;
  }
  .cv-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
    margin: auto;
    padding: 24px;
    color: var(--muted);
    max-width: 460px;
  }
  .cv-empty-icon {
    font-size: 38px;
    width: 70px; height: 70px;
    border-radius: 18px;
    background: linear-gradient(180deg, #fcd34d, #d97706);
    color: white;
    display: grid; place-items: center;
    line-height: 1;
    box-shadow: 0 10px 26px rgba(217,119,6,0.45);
  }
  .cv-empty h3 { color: var(--text); margin: 0; font-size: 18px; }
  .cv-empty p  { font-size: 13.5px; line-height: 1.5; margin: 0; }
  .cv-empty code {
    background: rgba(15,23,42,0.7);
    border: 1px solid rgba(56,189,248,0.20);
    border-radius: 4px;
    padding: 1px 5px;
    color: var(--accent);
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
  }
  .cv-empty-help {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    margin-top: 4px;
  }
  .cv-empty-help:hover { text-decoration: underline; }

  /* ----- Help panel overlay ----- */
  .cv-help-panel {
    position: absolute;
    inset: 12px;
    background: rgba(15,23,42,0.96);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    padding: 22px;
    z-index: 5;
    overflow: auto;
  }
  .cv-help-panel h3 { margin: 0 0 8px; }
  .cv-help-note {
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.5;
    margin: 0 0 14px;
  }
  .cv-help-note code {
    background: rgba(56,189,248,0.10);
    border: 1px solid rgba(56,189,248,0.20);
    border-radius: 4px;
    padding: 1px 5px;
    color: var(--accent);
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
  }
  .cv-help-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
  }
  .cv-help-card {
    padding: 12px;
    background: rgba(15,23,42,0.5);
    border: 1px solid var(--panel-border);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  .cv-help-card strong { color: var(--text); font-size: 14px; }
  .cv-help-card code {
    color: var(--accent);
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    background: rgba(56,189,248,0.08);
    border: 1px solid rgba(56,189,248,0.20);
    border-radius: 4px;
    padding: 2px 6px;
    width: max-content;
  }
  .cv-help-card div { color: var(--muted); font-size: 12px; font-family: 'JetBrains Mono', monospace; }
  .cv-help-close {
    position: absolute;
    top: 10px; right: 12px;
    background: transparent;
    border: 0;
    color: var(--muted);
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
  }
  .cv-help-close:hover { color: var(--text); }

  /* ----- Per-instance card ----- */
  .cv-inst-card {
    background: rgba(15,23,42,0.55);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    padding: 12px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 220px;
    transition: border-color 0.25s, box-shadow 0.25s;
  }
  .cv-inst-card.cv-inst-active {
    border-color: rgba(56,189,248,0.4);
    box-shadow: 0 0 24px rgba(56,189,248,0.18);
  }
  .cv-inst-head {
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--panel-border);
    padding-bottom: 8px;
  }
  .cv-inst-type {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--accent);
    background: rgba(56,189,248,0.10);
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid rgba(56,189,248,0.22);
    font-family: 'JetBrains Mono', monospace;
  }
  .cv-inst-name {
    font-family: 'JetBrains Mono', monospace;
    color: var(--text);
    font-weight: 700;
    font-size: 13px;
  }
  .cv-inst-body { display: flex; justify-content: center; }

  .cv-mini-empty {
    color: var(--muted);
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    padding: 18px 24px;
    border: 1px dashed rgba(148,163,184,0.25);
    border-radius: 8px;
  }

  /* ----- Stack mini ----- */
  .cv-stack {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
  }
  /* ----- Queue mini ----- */
  .cv-queue {
    display: flex;
    flex-direction: row;
    gap: 4px;
    flex-wrap: nowrap;
    justify-content: center;
    max-width: 360px;
  }
  /* ----- Linked list mini (also DLL) ----- */
  .cv-ll {
    display: flex;
    align-items: center;
    gap: 3px;
    flex-wrap: nowrap;
    overflow-x: auto;
    max-width: 420px;
  }
  .cv-ll-arrow {
    color: var(--accent);
    font-size: 18px;
    font-weight: 700;
    user-select: none;
  }
  .cv-ll-null {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--accent);
    font-size: 16px;
    font-weight: 700;
  }
  .cv-ll-null span {
    color: var(--muted);
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    padding: 3px 6px;
    background: rgba(15,23,42,0.6);
    border: 1px dashed rgba(148,163,184,0.3);
    border-radius: 4px;
  }

  /* ----- Cell (used by stack/queue/LL) ----- */
  .cv-cell {
    min-width: 36px;
    padding: 8px 12px;
    border-radius: 6px;
    background: linear-gradient(180deg, var(--bar-grad-top), var(--bar-grad-bot));
    color: white;
    text-align: center;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 14px;
    box-shadow:
      inset 0 1px 0 rgba(255,255,255,0.20),
      inset 0 -2px 0 rgba(0,0,0,0.25),
      0 4px 12px rgba(0,0,0,0.30);
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    transition: transform 0.25s var(--spring), box-shadow 0.25s, background 0.25s;
    animation: cvCellIn 0.28s var(--spring);
  }
  @keyframes cvCellIn {
    from { transform: scale(0.85); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
  }
  .cv-cell-top, .cv-cell-front {
    background: linear-gradient(180deg, var(--key-top), var(--key-bot));
    color: #1a1206;
    box-shadow:
      inset 0 1px 0 rgba(255,255,255,0.30),
      0 0 0 2px rgba(251,191,36,0.25),
      0 0 14px rgba(251,191,36,0.40);
  }
  .cv-cell-rear {
    background: linear-gradient(180deg, #86efac, #16a34a);
    color: #04200d;
    box-shadow:
      inset 0 1px 0 rgba(255,255,255,0.25),
      0 0 0 2px rgba(22,163,74,0.25),
      0 0 12px rgba(22,163,74,0.40);
  }
  .cv-cell-flash {
    animation: cvFlash 0.6s ease-out;
  }
  @keyframes cvFlash {
    0%   { transform: scale(1.18); box-shadow: 0 0 22px rgba(248,113,113,0.7); }
    100% { transform: scale(1); }
  }

  /* ----- Tree / heap / trie SVG ----- */
  .cv-tree {
    display: flex;
    justify-content: center;
    width: 100%;
    min-width: 280px;
  }
  .cv-tree-svg {
    width: 100%;
    max-width: 480px;
    min-height: 180px;
    overflow: visible;
  }
  .cv-tree-edge {
    stroke: var(--accent);
    stroke-width: 1.6;
    opacity: 0.55;
  }
  .cv-tree-node {
    fill: #4a5568;
    stroke: rgba(255,255,255,0.18);
    stroke-width: 1.5;
    filter: drop-shadow(0 3px 8px rgba(0,0,0,0.4));
  }
  .cv-tree-label {
    fill: white;
    font-size: 12px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
  }
  .cv-tree-node-g.cv-tree-flash .cv-tree-node {
    fill: var(--key-bot);
    stroke: var(--key-top);
    filter: drop-shadow(0 0 12px var(--pointer-i-glow));
  }
  .cv-tree-node-g.cv-tree-flash {
    animation: cvFlashSvg 1.2s ease-out;
  }
  .cv-tree-node-g.cv-tree-path .cv-tree-node {
    fill: var(--compare-bot);
    stroke: var(--compare-top);
  }
  @keyframes cvFlashSvg {
    0%   { transform: scale(1.25); }
    100% { transform: scale(1); }
  }

  /* ----- Hash table mini ----- */
  .cv-hash {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 240px;
  }
  .cv-hash-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px;
    border-radius: 6px;
    border: 1px solid rgba(148,163,184,0.10);
  }
  .cv-hash-idx {
    width: 30px;
    text-align: right;
    color: var(--muted);
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 700;
  }
  .cv-hash-row-flash {
    color: var(--accent);
  }
  .cv-hash-items {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: nowrap;
    flex: 1;
  }
  .cv-hash-empty { color: var(--muted); font-family: 'JetBrains Mono', monospace; font-size: 12px; }
  .cv-hash-cell {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 5px;
    background: linear-gradient(180deg, var(--bar-grad-top), var(--bar-grad-bot));
    box-shadow:
      inset 0 1px 0 rgba(255,255,255,0.18),
      0 3px 8px rgba(0,0,0,0.3);
    animation: cvCellIn 0.28s var(--spring);
  }
  .cv-hash-cell .cv-hash-key {
    color: white;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 700;
  }
  .cv-hash-cell .cv-hash-val {
    color: rgba(255,255,255,0.7);
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    padding-left: 6px;
    border-left: 1px solid rgba(255,255,255,0.15);
  }
  .cv-hash-arrow {
    color: var(--accent);
    font-weight: 700;
  }

  /* ----- Graph mini ----- */
  .cv-graph {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 100%;
    min-width: 280px;
  }
  .cv-graph-svg {
    width: 100%;
    max-width: 360px;
    min-height: 220px;
    overflow: visible;
  }
  .cv-graph-tag {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--accent);
    background: rgba(56,189,248,0.10);
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid rgba(56,189,248,0.22);
    font-family: 'JetBrains Mono', monospace;
    text-transform: uppercase;
  }
  .cv-graph-edge {
    stroke: var(--accent);
    stroke-width: 1.6;
    opacity: 0.55;
    transition: stroke 0.25s, stroke-width 0.25s, opacity 0.25s;
  }
  .cv-graph-edge-flash {
    stroke: var(--key-top);
    stroke-width: 3;
    opacity: 1;
    filter: drop-shadow(0 0 4px var(--pointer-i-glow));
  }
  .cv-graph-edge-label {
    fill: var(--accent);
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0,0,0,0.6);
    pointer-events: none;
  }
  .cv-graph-node {
    fill: #4a5568;
    stroke: rgba(255,255,255,0.18);
    stroke-width: 1.5;
    filter: drop-shadow(0 3px 8px rgba(0,0,0,0.4));
    transition: fill 0.25s, stroke 0.25s, filter 0.25s;
  }
  .cv-graph-node-g.cv-graph-node-active .cv-graph-node {
    fill: var(--key-bot);
    stroke: var(--key-top);
    filter: drop-shadow(0 0 12px var(--pointer-i-glow));
  }
  .cv-graph-node-g.cv-graph-node-active {
    animation: cvFlashSvg 1.2s ease-out;
  }
  .cv-graph-node-g.cv-graph-node-visited .cv-graph-node {
    fill: #15803d;
    stroke: var(--sorted-top);
    filter: drop-shadow(0 0 8px rgba(74,222,128,0.45));
  }
  .cv-graph-label {
    fill: white;
    font-size: 12px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
  }

  /* Mobile: stack the editor and viz vertically */
  @media (max-width: 880px) {
    .cv-workspace {
      grid-template-columns: 1fr;
      grid-template-rows: minmax(360px, auto) minmax(360px, auto);
    }
    .cv-editor-panel, .cv-viz-panel { min-height: 360px; }
    .cv-speed-wrap input[type="range"] { width: 120px; }
  }

  /* ========================================================
     SYSTEM DESIGN (LLD + HLD)
     Reuses .cv-workspace / .cv-editor-panel / .cv-viz-panel.
     Adds a non-scrolling diagram stage and SVG primitives for
     UML class boxes (LLD) and architecture components (HLD).
     ======================================================== */
  .sd-stage {
    flex: 1;
    overflow: auto;
    padding: 16px;
    display: flex;
    align-items: safe center;
    justify-content: safe center;
    position: relative;
  }
  /* Floating zoom controls (top-right of the viz panel) - reuses
     .zoom-btn / .zoom-level / .zoom-divider styles already defined for
     the algorithm visualizer. */
  .sd-zoom-controls {
    position: absolute;
    top: 18px;
    right: 22px;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 6px;
    border-radius: 8px;
    background: rgba(15,23,42,0.85);
    border: 1px solid var(--panel-border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 14px rgba(0,0,0,0.35);
  }
  .sd-svg {
    /* Let JS set explicit width/height in pixels (= viewBox * zoom). When
       JS hasn't run yet, fall back to 100% so the empty-state container
       renders at panel width. flex-shrink:0 keeps the flex layout from
       squeezing a wide diagram. */
    width: 100%;
    min-height: 320px;
    overflow: visible;
    flex-shrink: 0;
  }

  /* ----- LLD class diagram ----- */
  .sd-class-bg {
    fill: rgba(15,23,42,0.85);
    stroke: rgba(148,163,184,0.35);
    stroke-width: 1.4;
    filter: drop-shadow(0 6px 14px rgba(0,0,0,0.45));
  }
  .sd-class-header {
    fill: #4338ca;
    stroke: none;
  }
  .sd-class-title {
    fill: white;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 13px;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0,0,0,0.4);
    pointer-events: none;
  }
  .sd-class-divider {
    stroke: rgba(148,163,184,0.25);
    stroke-width: 1;
    stroke-dasharray: 3 3;
  }
  .sd-row {
    fill: var(--text);
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 11.5px;
    pointer-events: none;
  }
  .sd-row-method { fill: #93c5fd; }
  .sd-row-field  { fill: #c4b5fd; }
  .sd-edge {
    stroke: #93c5fd;
    stroke-width: 1.6;
    fill: none;
    opacity: 0.85;
  }
  .sd-edge-extends     { stroke: #93c5fd; }
  .sd-edge-composition { stroke: #fcd34d; stroke-dasharray: 4 3; }
  .sd-edge-label {
    fill: var(--muted);
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    pointer-events: none;
  }
  .sd-legend-bg {
    fill: rgba(15,23,42,0.7);
    stroke: rgba(148,163,184,0.2);
    stroke-width: 1;
  }
  .sd-legend-text {
    fill: var(--text);
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
  }

  /* ----- HLD architecture diagram ----- */
  .sd-arch-rect {
    stroke-width: 2;
    filter: drop-shadow(0 6px 16px rgba(0,0,0,0.45));
    transition: filter 0.2s;
  }
  .sd-arch-pill {
    fill: rgba(0,0,0,0.40);
    stroke: rgba(255,255,255,0.20);
    stroke-width: 1;
  }
  .sd-arch-pill-text {
    fill: white;
    font-family: 'JetBrains Mono', monospace;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.06em;
    pointer-events: none;
  }
  .sd-arch-icon {
    font-size: 16px;
    pointer-events: none;
  }
  .sd-arch-name {
    fill: white;
    font-family: 'Space Grotesk', system-ui, sans-serif;
    font-size: 13px;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0,0,0,0.55);
    pointer-events: none;
  }
  .sd-arch-edge {
    stroke: #7dd3fc;
    stroke-width: 1.7;
    opacity: 0.75;
  }
  .sd-arch-edge-label {
    fill: var(--text);
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    pointer-events: none;
  }
  .sd-arch-edge-label-bg {
    fill: rgba(15,23,42,0.92);
    stroke: rgba(56,189,248,0.30);
    stroke-width: 1;
  }

  /* The example help-code block in the sysdesign help panel */
  .sd-help-table {
    width: 100%;
    border-collapse: collapse;
    margin: 6px 0 12px;
    font-size: 12px;
  }
  .sd-help-table td {
    padding: 5px 8px;
    border-bottom: 1px solid rgba(148,163,184,0.12);
    color: var(--muted);
  }
  .sd-help-table td:first-child {
    white-space: nowrap;
    color: var(--text);
  }
  .sd-help-table td code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11.5px;
    background: rgba(10,14,26,0.6);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--accent);
  }
  .sd-help-code {
    background: rgba(10,14,26,0.85);
    border: 1px solid rgba(148,163,184,0.18);
    border-radius: 8px;
    padding: 10px 12px;
    margin: 6px 0 14px;
    font-size: 11.5px;
    overflow-x: auto;
  }
  .sd-help-code code {
    font-family: 'JetBrains Mono', monospace;
    color: var(--text);
    background: transparent;
    border: none;
    padding: 0;
  }

  /* ========================================================
     ARCHITECTURE VISUALIZATIONS
     ======================================================== */
  .arch-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 12px var(--pad-x);
    border-bottom: 1px solid var(--panel-border);
    background: rgba(15,23,42,0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
  .arch-flow-dropdown {
    margin-left: auto;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--panel-border);
    background: rgba(15,23,42,0.7);
    color: var(--text);
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    min-width: 160px;
    min-height: 40px;
  }
  .arch-flow-dropdown:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
  .arch-controls button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(15,23,42,0.7);
    color: var(--text);
    border: 1px solid var(--panel-border);
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    min-height: 40px;
    transition: transform 0.15s var(--spring), border-color 0.15s, color 0.15s, background 0.15s, box-shadow 0.15s;
  }
  .arch-controls button:hover:not(:disabled):not(.primary) {
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(56,189,248,0.18);
  }
  .arch-controls button:active:not(:disabled) { transform: translateY(0) scale(0.97); }
  .arch-controls button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
  }
  .arch-controls button.primary {
    background: linear-gradient(180deg, #7dd3fc, #38bdf8);
    color: #0a0e1a;
    border-color: transparent;
    font-weight: 700;
    box-shadow: 0 6px 18px rgba(56,189,248,0.35);
  }
  .arch-controls button.primary:hover:not(:disabled) {
    background: linear-gradient(180deg, #93dffd, #38bdf8);
    color: #0a0e1a;
    box-shadow: 0 8px 22px rgba(56,189,248,0.45);
    transform: translateY(-1px);
  }
  .arch-controls button.primary:disabled {
    opacity: 0.4;
  }
  .arch-progress {
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: rgba(148,163,184,0.18);
    overflow: hidden;
  }
  .arch-progress > div {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    border-radius: 2px;
    transition: width 0.3s ease;
  }
  .arch-narration-step {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(56,189,248,0.12);
    border: 1px solid rgba(56,189,248,0.25);
    color: var(--accent);
    font-size: 11.5px;
    font-weight: 600;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    letter-spacing: 0.03em;
    white-space: nowrap;
  }
  .arch-narration-step:empty { display: none; }
  .arch-speed-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--muted);
    margin-left: 12px;
  }
  .arch-speed-wrap input[type="range"] {
    width: 220px;
    accent-color: var(--accent);
  }

  .arch-workspace {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    position: relative;
  }
  .arch-zoom-controls {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 6px;
    border-radius: 8px;
    background: rgba(15,23,42,0.85);
    border: 1px solid var(--panel-border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 14px rgba(0,0,0,0.35);
  }
  .arch-stage {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: safe center;
    padding: 24px;
    overflow: auto;
  }
  .arch-svg {
    width: 100%;
    max-width: 900px;
    height: auto;
    max-height: 60vh;
  }

  /* Architecture edge + node styles */
  .arch-edge {
    stroke: #7dd3fc;
    stroke-width: 1.7;
    opacity: 0.45;
    transition: opacity 0.3s, stroke-width 0.3s, stroke 0.3s;
  }
  .arch-edge-active {
    opacity: 1;
    stroke-width: 3;
    stroke: #38bdf8;
    filter: drop-shadow(0 0 6px rgba(56,189,248,0.6));
  }
  .arch-node .arch-box {
    transition: filter 0.3s, stroke-width 0.3s;
    filter: drop-shadow(0 6px 16px rgba(0,0,0,0.45));
  }
  .arch-node-active .arch-box {
    stroke-width: 3;
    filter: drop-shadow(0 0 12px rgba(56,189,248,0.5)) drop-shadow(0 6px 16px rgba(0,0,0,0.45));
  }

  /* Animated packet */
  .arch-packet {
    fill: #fcd34d;
    filter: url(#arch-glow);
    transition: fill 0.2s;
  }
  .arch-packet-label {
    fill: var(--text);
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 700;
    pointer-events: none;
  }

  /* Narration panel */
  .arch-narration {
    padding: 16px var(--pad-x) 20px;
    border-top: 1px solid var(--panel-border);
    background: rgba(15,23,42,0.5);
    min-height: 36px;
  }
  .arch-narration-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .narration-toggle-btn {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 12px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.2s;
    margin-left: auto;
  }
  .narration-toggle-btn:hover { opacity: 1; }
  .arch-narration-text {
    color: var(--text);
    font-size: 14px;
    line-height: 1.55;
  }
  .arch-narration-text table {
    margin: 8px 0 4px;
    border-collapse: collapse;
    font-size: 12px;
    width: auto;
    max-width: 100%;
    overflow-x: auto;
    display: block;
  }
  .arch-narration-text th,
  .arch-narration-text td {
    padding: 3px 10px;
    border: 1px solid rgba(255,255,255,0.15);
    white-space: nowrap;
  }
  .arch-narration-text th {
    background: rgba(255,255,255,0.08);
    font-weight: 600;
    color: var(--accent);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }
  .arch-narration-text td {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
  }

  .llm-step-table {
    width: 100%;
    max-width: 900px;
    margin-top: 16px;
    background: rgba(15,23,42,0.5);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    padding: 12px;
    animation: cardFadeIn 0.3s ease-out;
  }
  .llm-step-table table {
    border-collapse: collapse;
    font-size: 12px;
    width: 100%;
  }
  .llm-step-table th,
  .llm-step-table td {
    padding: 6px 12px;
    border: 1px solid rgba(255,255,255,0.12);
    white-space: nowrap;
  }
  .llm-step-table th {
    background: rgba(255,255,255,0.08);
    font-weight: 600;
    color: var(--accent);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }
  .llm-step-table td {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--text);
  }

  /* ── DBMS Query table row highlights ── */
  .row-scan    { background: rgba(56,189,248,0.18) !important; }
  .row-match   { background: rgba(74,222,128,0.22) !important; }
  .row-exclude { background: rgba(248,113,113,0.15) !important; opacity: 0.5; }
  .row-join    { background: rgba(196,181,253,0.22) !important; }
  .row-group   { background: rgba(251,191,36,0.18) !important; }
  .row-sort    { background: rgba(129,140,248,0.2) !important; }
  .row-insert  { background: rgba(74,222,128,0.25) !important; }
  .row-update  { background: rgba(251,191,36,0.22) !important; }
  .row-delete  { background: rgba(248,113,113,0.2) !important; text-decoration: line-through; }

  /* ── Row pointer indicators ── */
  .row-scan td:first-child::before    { content: '\25B8 '; color: #38bdf8; }
  .row-match td:first-child::before   { content: '\2713 '; color: #4ade80; }
  .row-exclude td:first-child::before { content: '\2717 '; color: #f87171; }
  .row-join td:first-child::before    { content: '\27F7 '; color: #c4b5fd; }
  .row-insert td:first-child::before  { content: '+ '; color: #4ade80; }
  .row-update td:first-child::before  { content: '\27F3 '; color: #fbbf24; }
  .row-delete td:first-child::before  { content: '\2212 '; color: #f87171; }
  .row-sort td:first-child::before    { content: '\2195 '; color: #818cf8; }
  .row-group td:first-child::before   { content: '\25CF '; color: #fbbf24; }

  /* ── Network step tables ── */
  .net-step-table {
    display: inline-block; margin-top: 16px;
    background: rgba(15,23,42,0.5);
    border: 1px solid var(--panel-border);
    border-radius: 12px; padding: 12px;
    animation: cardFadeIn 0.3s ease-out;
  }
  .net-step-table table { border-collapse: collapse; font-size: 12px; }
  .net-step-table th,
  .net-step-table td { padding: 6px 12px; border: 1px solid rgba(255,255,255,0.12); white-space: nowrap; }
  .net-step-table th {
    background: rgba(255,255,255,0.08); font-weight: 600;
    color: var(--accent); font-size: 11px;
    text-transform: uppercase; letter-spacing: 0.04em;
  }
  .net-step-table td { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--text); }
  .net-step-table .row-highlight { background: rgba(56,189,248,0.12); }
  .net-step-table .row-new { animation: cardFadeIn 0.3s ease-out; }
  .net-step-table .cell-success { color: #86efac; }
  .net-step-table .cell-pending { color: #fbbf24; }
  .net-step-table .cell-error { color: #fca5a5; }
  .net-step-table .cell-muted { color: #64748b; }

  /* ── DBMS sub-section grid: keep tile size consistent with DS ── */
  #dbms-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  }

  /* ── DBMS Query Operations table-only viz ── */
  .dqv-table-stage {
    flex: 1;
    display: flex;
    align-items: flex-start;
    /* `safe center` centres the viz when it fits, but falls back to
       flex-start when it overflows so the left edge stays reachable
       via horizontal scroll (plain `center` clips the left side and
       traps it off-screen because scrollLeft can't go negative). */
    justify-content: safe center;
    padding: 24px 16px;
    overflow: auto;
  }
  .dqv-table-stage .llm-step-table {
    max-width: 1100px;
    margin: 0 auto;
  }
  .dqv-table-stage .dqv-zoom-wrapper {
    transform-origin: top center;
    transition: transform 0.15s ease;
  }
  .dqv-tbl-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent);
    margin-bottom: 6px;
    padding-left: 4px;
  }
  .dqv-tables-row {
    display: flex;
    gap: 32px;
    align-items: flex-start;
    width: 100%;
  }
  .dqv-tbl-wrap {
    flex: 1;
    min-width: 0;
  }
  .dqv-tbl-wrap table {
    width: 100%;
  }
  .dqv-tbl-connector {
    display: flex;
    align-items: center;
    padding: 28px 8px 0;
    font-size: 22px;
    color: var(--accent);
    opacity: 0.6;
    flex-shrink: 0;
  }
  .dqv-result-divider {
    text-align: center;
    padding: 10px 0 4px;
    font-size: 20px;
    color: var(--accent);
    opacity: 0.5;
  }
  .dqv-query-panel {
    display: none;
    align-items: flex-start;
    gap: 10px;
    background: rgba(0,0,0,0.35);
    border: 1px solid rgba(56,189,248,0.2);
    border-radius: 8px;
    padding: 10px 14px;
    margin: 56px auto 12px;
    max-width: 1100px;
    width: calc(100% - 32px);
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 12.5px;
    line-height: 1.5;
    overflow-x: auto;
  }
  .dqv-query-panel.active { display: flex; }
  .dqv-query-label {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #67e8f9;
    opacity: 0.7;
    padding-top: 2px;
    flex-shrink: 0;
  }
  .dqv-query-code {
    color: #e2e8f0;
    white-space: pre-wrap;
    word-break: break-word;
    flex: 1;
  }
  .dqv-query-code .sql-kw { color: #c084fc; font-weight: 600; }
  .dqv-query-code .sql-fn { color: #67e8f9; }
  .dqv-query-code .sql-str { color: #86efac; }
  .dqv-query-code .sql-num { color: #fbbf24; }
  .dqv-query-code .sql-op { color: #f9a8d4; }
  .dqv-query-cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    background: #67e8f9;
    vertical-align: text-bottom;
    animation: dqv-blink 0.7s step-end infinite;
  }
  @keyframes dqv-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

  /* ══════════════════════════════════════════════════════════════
     Query-Operations: state-based visualizer (qop-*)
     Used by: SELECT/WHERE, JOIN, GROUP BY, ORDER BY, DML, Subqueries
     ══════════════════════════════════════════════════════════════ */
  .qop-box {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px 16px;
    background: rgba(15,23,42,0.55);
    border: 1px solid rgba(56,189,248,0.18);
    border-radius: 10px;
    color: #e2e8f0;
    font-size: 12.5px;
    width: max-content;
    min-width: 720px;
    max-width: 1280px;
  }

  /* Header */
  .qop-head {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;
    padding-bottom: 8px;
    border-bottom: 1px dashed rgba(148,163,184,0.18);
  }
  .qop-op-pill {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 5px 12px;
    background: linear-gradient(180deg, rgba(56,189,248,0.18), rgba(56,189,248,0.06));
    border: 1px solid rgba(125,211,252,0.4);
    border-radius: 999px;
    font-weight: 700; letter-spacing: 0.03em;
  }
  .qop-op-icon { font-size: 11px; color: #67e8f9; }
  .qop-op-name { color: #f1f5f9; font-size: 13px; }
  .qop-stats { display: flex; gap: 6px; margin-left: auto; flex-wrap: nowrap; }
  .qop-chip {
    display: inline-flex; gap: 5px; align-items: center;
    padding: 3px 8px;
    border-radius: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    background: rgba(30,41,59,0.7);
    border: 1px solid rgba(148,163,184,0.18);
  }
  .qop-chip-k { color: #94a3b8; text-transform: uppercase; letter-spacing: 0.04em; font-size: 9.5px; }
  .qop-chip-v { color: #f1f5f9; font-weight: 700; }
  .qop-chip-scan    { border-color: rgba(56,189,248,0.4); }
  .qop-chip-scan .qop-chip-v    { color: #7dd3fc; }
  .qop-chip-match   { border-color: rgba(74,222,128,0.4); }
  .qop-chip-match .qop-chip-v   { color: #86efac; }
  .qop-chip-exclude { border-color: rgba(248,113,113,0.4); }
  .qop-chip-exclude .qop-chip-v { color: #fca5a5; }
  .qop-chip-group   { border-color: rgba(251,191,36,0.4); }
  .qop-chip-group .qop-chip-v   { color: #fcd34d; }

  /* Legend */
  .qop-legend {
    display: flex; flex-wrap: wrap; gap: 8px 14px;
    padding: 6px 8px;
    background: rgba(8,15,28,0.55);
    border: 1px dashed rgba(148,163,184,0.12);
    border-radius: 6px;
    font-size: 11px;
    color: #94a3b8;
  }
  .qop-legend-item { display: inline-flex; align-items: center; gap: 5px; }
  .qop-legend-item b { color: #cbd5e1; font-weight: 600; }
  .qop-leg-swatch {
    display: inline-block; width: 10px; height: 10px; border-radius: 2px;
    border: 1px solid rgba(148,163,184,0.4);
  }
  .qop-leg-cursor  { background: transparent; border-color: #67e8f9; }
  .qop-leg-scan    { background: rgba(56,189,248,0.5); border-color: #7dd3fc; }
  .qop-leg-match   { background: rgba(74,222,128,0.55); border-color: #86efac; }
  .qop-leg-exclude { background: rgba(248,113,113,0.45); border-color: #fca5a5; }
  .qop-leg-group   { background: rgba(251,191,36,0.45); border-color: #fcd34d; }
  .qop-leg-sort    { background: rgba(129,140,248,0.5); border-color: #a5b4fc; }
  .qop-leg-join    { background: rgba(196,181,253,0.55); border-color: #c4b5fd; }
  .qop-leg-insert  { background: rgba(74,222,128,0.6); border-color: #86efac; }
  .qop-leg-update  { background: rgba(251,191,36,0.55); border-color: #fcd34d; }
  .qop-leg-delete  { background: rgba(248,113,113,0.5); border-color: #fca5a5; }
  .qop-leg-compare { background: rgba(192,132,252,0.5); border-color: #c084fc; }

  /* Grid layouts */
  .qop-grid { display: flex; gap: 12px; align-items: flex-start; flex-wrap: nowrap; }
  .qop-grid-select { flex-wrap: nowrap; }
  .qop-grid-join, .qop-grid-subq { flex-wrap: nowrap; }
  .qop-grid-group, .qop-grid-order { flex-wrap: nowrap; }
  .qop-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
  .qop-col-table   { flex: 0 0 auto; min-width: 280px; }
  .qop-col-side    { flex: 1; min-width: 220px; }
  .qop-col-outer   { flex: 0 0 auto; }
  .qop-col-inner   { flex: 0 0 auto; }
  .qop-col-build   { flex: 0 0 auto; }
  .qop-col-mid     { flex: 1; min-width: 220px; }

  /* Tables */
  .qop-tbl-wrap {
    background: rgba(8,15,28,0.65);
    border: 1px solid rgba(148,163,184,0.18);
    border-radius: 8px;
    padding: 8px 8px 6px;
  }
  .qop-tbl-wrap.qop-tbl-sm { padding: 6px; }
  .qop-tbl-title {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #67e8f9;
    margin: 0 0 6px 4px;
  }
  .qop-tbl {
    border-collapse: collapse;
    background: transparent;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11.5px;
  }
  .qop-tbl th, .qop-tbl td {
    padding: 4px 8px;
    border: 1px solid rgba(148,163,184,0.12);
    text-align: left;
    color: #cbd5e1;
    white-space: nowrap;
  }
  .qop-tbl th {
    background: rgba(30,41,59,0.7);
    color: #94a3b8;
    font-weight: 600;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }
  .qop-tbl tbody tr { transition: background 0.15s ease, opacity 0.15s ease; }
  .qop-cur-col, .qop-cur-cell {
    width: 18px; padding: 2px 4px; text-align: center; border-color: transparent; background: transparent;
  }
  .qop-cur-arrow {
    display: inline-block; width: 0; height: 0;
    border-top: 5px solid transparent; border-bottom: 5px solid transparent;
    border-left: 7px solid transparent;
    transition: border-left-color 0.15s ease;
  }
  .qop-row-cursor .qop-cur-arrow {
    border-left-color: #67e8f9;
    animation: qop-cur-pulse 1s ease-in-out infinite;
  }
  @keyframes qop-cur-pulse {
    0%, 100% { transform: translateX(0); opacity: 1; }
    50% { transform: translateX(2px); opacity: 0.7; }
  }
  .qop-row-cursor td { background: rgba(56,189,248,0.06); }

  /* Row flag classes */
  .qop-row-scan    td { background: rgba(56,189,248,0.18); }
  .qop-row-match   td { background: rgba(74,222,128,0.22); }
  .qop-row-exclude td { background: rgba(248,113,113,0.13); color: #94a3b8; opacity: 0.55; }
  .qop-row-group   td { background: rgba(251,191,36,0.18); }
  .qop-row-sort    td { background: rgba(129,140,248,0.18); }
  .qop-row-join    td { background: rgba(196,181,253,0.22); }
  .qop-row-insert  td { background: rgba(74,222,128,0.25); }
  .qop-row-update  td { background: rgba(251,191,36,0.22); }
  .qop-row-delete  td { background: rgba(248,113,113,0.18); text-decoration: line-through; }
  .qop-row-cmp     td { background: rgba(192,132,252,0.28); box-shadow: inset 0 0 0 1px rgba(192,132,252,0.5); }

  /* Eval / ON / Compare panels (side panels) */
  .qop-eval-panel, .qop-on-panel, .qop-tx-panel, .qop-wal-panel,
  .qop-agg-panel, .qop-having-panel, .qop-sort-panel, .qop-mat-panel {
    background: rgba(8,15,28,0.65);
    border: 1px solid rgba(148,163,184,0.18);
    border-radius: 8px;
    padding: 8px 10px;
  }
  .qop-eval-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
    margin-bottom: 6px;
  }
  .qop-eval-expr, .qop-on-expr {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: #f1f5f9;
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(56,189,248,0.18);
    border-radius: 5px;
    padding: 5px 8px;
    margin-bottom: 8px;
    word-break: break-word;
  }
  .qop-eval-subs {
    display: flex; flex-wrap: wrap; gap: 5px;
    margin-bottom: 8px;
    min-height: 22px;
  }
  .qop-eval-sub {
    background: rgba(56,189,248,0.1);
    border: 1px solid rgba(56,189,248,0.3);
    padding: 2px 7px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
  }
  .qop-eval-sub b { color: #7dd3fc; }
  .qop-eval-sub i { color: #f1f5f9; font-style: normal; font-weight: 600; }
  .qop-eval-idle { color: #64748b; font-style: italic; font-size: 11px; }
  .qop-eval-verdict {
    display: inline-block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 5px;
    letter-spacing: 0.02em;
  }
  .qop-eval-verdict.qop-eval-pass { background: rgba(74,222,128,0.18); color: #86efac; border: 1px solid rgba(74,222,128,0.4); }
  .qop-eval-verdict.qop-eval-fail { background: rgba(248,113,113,0.18); color: #fca5a5; border: 1px solid rgba(248,113,113,0.4); }
  .qop-eval-verdict.qop-eval-idle { background: rgba(100,116,139,0.18); color: #94a3b8; border: 1px solid rgba(148,163,184,0.3); font-weight: 500; }

  /* JOIN: hash buckets & probe */
  .qop-hash-wrap {
    background: rgba(8,15,28,0.65);
    border: 1px solid rgba(148,163,184,0.18);
    border-radius: 8px;
    padding: 8px 10px;
  }
  .qop-hash-buckets { display: flex; flex-direction: column; gap: 6px; }
  .qop-hash-empty { color: #64748b; font-style: italic; font-size: 11px; padding: 6px 4px; }
  .qop-bucket {
    background: rgba(251,191,36,0.06);
    border: 1px solid rgba(251,191,36,0.3);
    border-radius: 6px;
    padding: 5px 8px;
    transition: all 0.15s ease;
  }
  .qop-bucket-active {
    background: rgba(74,222,128,0.12);
    border-color: rgba(74,222,128,0.6);
    box-shadow: 0 0 12px rgba(74,222,128,0.18);
  }
  .qop-bucket-key {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 700;
    color: #fcd34d;
    margin-bottom: 4px;
  }
  .qop-bucket-active .qop-bucket-key { color: #86efac; }
  .qop-bucket-members { font-weight: 400; color: #94a3b8; font-size: 10px; }
  .qop-bucket-rows { display: flex; flex-direction: column; gap: 3px; }
  .qop-bucket-row {
    display: flex; flex-wrap: wrap; gap: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
    color: #cbd5e1;
    padding: 2px 0;
  }
  .qop-bucket-row b { color: #94a3b8; font-weight: 600; }

  .qop-probe {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    flex-wrap: wrap;
    background: rgba(0,0,0,0.3);
    border-radius: 6px;
    padding: 8px;
    margin-top: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11.5px;
  }
  .qop-probe-empty { color: #64748b; font-style: italic; font-size: 11px; }
  .qop-probe-key { color: #cbd5e1; }
  .qop-probe-key b { color: #7dd3fc; }
  .qop-probe-arrow { font-size: 18px; color: #67e8f9; }
  .qop-probe-hit .qop-probe-arrow { color: #86efac; }
  .qop-probe-miss .qop-probe-arrow { color: #fca5a5; }
  .qop-probe-match b { color: #86efac; }
  .qop-probe-miss-txt { color: #fca5a5; }

  /* GROUP BY: aggregator panel */
  .qop-agg-buckets { display: flex; flex-direction: column; gap: 6px; }
  .qop-agg-bucket {
    background: rgba(251,191,36,0.07);
    border-color: rgba(251,191,36,0.4);
  }
  .qop-agg-vals {
    display: flex; flex-wrap: wrap; gap: 6px;
    margin-top: 3px;
  }
  .qop-agg-val {
    background: rgba(0,0,0,0.35);
    border: 1px solid rgba(148,163,184,0.18);
    padding: 2px 7px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
  }
  .qop-agg-val b { color: #94a3b8; }
  .qop-agg-val i { color: #fcd34d; font-style: normal; font-weight: 700; }
  .qop-having-results { display: flex; flex-wrap: wrap; gap: 5px; }
  .qop-having-chip {
    padding: 2px 7px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
    border: 1px solid;
  }
  .qop-having-chip.qop-having-pass { background: rgba(74,222,128,0.15); border-color: rgba(74,222,128,0.4); color: #86efac; }
  .qop-having-chip.qop-having-fail { background: rgba(248,113,113,0.15); border-color: rgba(248,113,113,0.4); color: #fca5a5; }

  /* ORDER BY: sort buffer */
  .qop-sort-keys { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
  .qop-sort-key {
    background: rgba(129,140,248,0.12);
    border: 1px solid rgba(129,140,248,0.4);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
  }
  .qop-sort-key b { color: #a5b4fc; }
  .qop-sort-key i { color: #f1f5f9; font-style: normal; }
  .qop-sort-buffer { margin-bottom: 8px; }
  .qop-sort-tbl { width: 100%; }
  .qop-sort-compare {
    background: rgba(0,0,0,0.3);
    border-radius: 5px;
    padding: 6px 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11.5px;
  }
  .qop-cmp-row b { color: #c084fc; }
  .qop-cmp-row i { color: #f1f5f9; font-style: normal; font-weight: 600; }

  /* DML: TX + WAL */
  .qop-tx-row {
    display: flex; flex-wrap: wrap; gap: 14px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11.5px;
  }
  .qop-tx-row b { color: #94a3b8; font-weight: 600; }
  .qop-tx-row i { color: #f1f5f9; font-style: normal; font-weight: 700; }
  .qop-tx-state { padding: 1px 7px; border-radius: 4px; border: 1px solid rgba(148,163,184,0.3); }
  .qop-tx-state.qop-tx-idle      { color: #94a3b8; }
  .qop-tx-state.qop-tx-active    { color: #fcd34d; border-color: rgba(251,191,36,0.4); background: rgba(251,191,36,0.1); }
  .qop-tx-state.qop-tx-committed { color: #86efac; border-color: rgba(74,222,128,0.4); background: rgba(74,222,128,0.1); }
  .qop-wal-strip {
    display: flex; flex-direction: column; gap: 3px;
    max-height: 260px; overflow-y: auto;
  }
  .qop-wal-entry {
    display: grid;
    grid-template-columns: 100px 56px 1fr;
    gap: 8px;
    align-items: center;
    padding: 4px 6px;
    background: rgba(0,0,0,0.35);
    border-left: 3px solid #475569;
    border-radius: 0 4px 4px 0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
  }
  .qop-wal-entry.qop-wal-begin   { border-left-color: #7dd3fc; }
  .qop-wal-entry.qop-wal-insert  { border-left-color: #86efac; }
  .qop-wal-entry.qop-wal-update  { border-left-color: #fcd34d; }
  .qop-wal-entry.qop-wal-delete  { border-left-color: #fca5a5; }
  .qop-wal-entry.qop-wal-commit  { border-left-color: #86efac; background: rgba(74,222,128,0.1); }
  .qop-wal-entry.qop-wal-index   { border-left-color: #c4b5fd; }
  .qop-wal-lsn  { color: #94a3b8; font-size: 9.5px; }
  .qop-wal-kind { color: #cbd5e1; font-weight: 700; font-size: 9.5px; letter-spacing: 0.05em; }
  .qop-wal-text { color: #e2e8f0; }
  .qop-diff-old { color: #fca5a5; text-decoration: line-through; }
  .qop-diff-new { color: #86efac; font-weight: 700; }

  /* Subquery: materialized + compare */
  .qop-mat-title { color: #c4b5fd; }
  .qop-mat-body { margin-bottom: 10px; }
  .qop-mat-tbl { width: 100%; }
  .qop-compare {
    background: rgba(0,0,0,0.3);
    border-radius: 5px;
    padding: 6px 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11.5px;
  }
  .qop-compare.qop-compare-pass { background: rgba(74,222,128,0.1); border: 1px solid rgba(74,222,128,0.3); }
  .qop-compare.qop-compare-fail { background: rgba(248,113,113,0.1); border: 1px solid rgba(248,113,113,0.3); }
  .qop-compare .qop-cmp-row b { color: #c084fc; }
  .qop-compare .qop-cmp-row i { color: #f1f5f9; font-style: normal; font-weight: 600; }

  /* Result panel */
  .qop-result-wrap {
    background: rgba(8,15,28,0.65);
    border: 1px solid rgba(74,222,128,0.25);
    border-radius: 8px;
    padding: 8px 10px;
  }
  .qop-result-title { color: #86efac; display: flex; align-items: center; gap: 6px; }
  .qop-arrow-down { font-size: 14px; color: #86efac; }
  .qop-result-count { color: #94a3b8; font-weight: 400; font-size: 10.5px; text-transform: none; letter-spacing: 0; margin-left: 4px; }
  .qop-result-empty { color: #64748b; font-style: italic; font-size: 11px; padding: 4px; }
  .qop-result-tbl { width: 100%; }
  .qop-result-row { width: 100%; }

  /* Banner */
  .qop-banner {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
  }
  .qop-banner-dot {
    width: 8px; height: 8px; border-radius: 50%;
    flex-shrink: 0;
  }
  .qop-banner-info    { background: rgba(56,189,248,0.1);  border: 1px solid rgba(56,189,248,0.3); color: #7dd3fc; }
  .qop-banner-info    .qop-banner-dot { background: #7dd3fc; }
  .qop-banner-warn    { background: rgba(251,191,36,0.1);  border: 1px solid rgba(251,191,36,0.4); color: #fcd34d; }
  .qop-banner-warn    .qop-banner-dot { background: #fcd34d; }
  .qop-banner-success { background: rgba(74,222,128,0.1);  border: 1px solid rgba(74,222,128,0.4); color: #86efac; }
  .qop-banner-success .qop-banner-dot { background: #86efac; }

  /* ── Big O Notation Visualizer ── */
  .bigo-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px var(--pad-x);
    background: rgba(15,23,42,0.4);
    border-bottom: 1px solid var(--panel-border);
  }
  .bigo-n-control {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
  }
  .bigo-n-control input[type="range"] {
    flex: 1;
    max-width: 260px;
    accent-color: var(--accent);
  }
  .bigo-n-control span {
    min-width: 28px;
    text-align: center;
    color: var(--accent);
    font-weight: 700;
  }
  .bigo-zoom-bar {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 6px;
    border-radius: 8px;
    background: rgba(15,23,42,0.85);
    border: 1px solid var(--panel-border);
  }
  .bigo-svg { width: 100%; max-height: 55vh; }
  .bigo-axis { stroke: #475569; stroke-width: 1.5; }
  .bigo-axis-label {
    fill: #8da0bb;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
  }
  .bigo-axis-tick { stroke: #475569; stroke-width: 0.5; }
  .bigo-grid-line { stroke: #1e293b; stroke-width: 0.5; stroke-dasharray: 4 4; }
  .bigo-curve {
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  .bigo-marker { filter: drop-shadow(0 0 4px currentColor); }
  .bigo-ops-display {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
  }
  .bigo-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 10px var(--pad-x);
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
  }
  .bigo-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
  }
  .bigo-legend-swatch {
    width: 16px;
    height: 3px;
    border-radius: 2px;
  }

  /* ============================================================
     OS — Topic visualisations (scheduling, vmem, deadlock, sync, cswitch)
     Layout is fixed-size on every viewport so the order matches
     across web and mobile. The whole container is zoomable +
     horizontally scrollable via .arch-stage (the parent has
     overflow:auto), so individual sub-views never get their own
     scroll bars.
     ============================================================ */
  .osviz-zoom-host {
    position: relative;
    width: max-content;
    /* Auto margins center the host when it fits inside the stage. When the
       host is wider than the stage they collapse to 0, putting the host at
       the start of the scroll area so the user can scroll the overflow. */
    margin: 0 auto;
    /* Opt out of the parent .arch-stage `align-items: center`. Without this,
       a host wider than the stage gets centered with equal overflow on both
       sides and most browsers won't let you scroll into the left half. */
    align-self: flex-start;
  }
  .osviz-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: max-content;
    min-width: 600px;
    padding: 4px;
    color: var(--text);
    transform-origin: top left;
    transition: transform 0.18s ease;
    font-size: 12px;
  }

  /* Shared header / legend / section styles reused by every topic. */
  .osviz-header {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px 12px;
    padding: 6px 10px;
    background: rgba(15,23,42,0.55);
    border: 1px solid var(--panel-border);
    border-radius: 9px;
    white-space: nowrap;
  }
  .osviz-pill {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(56,189,248,0.22), rgba(129,140,248,0.18));
    border: 1px solid rgba(56,189,248,0.4);
    color: var(--accent);
  }
  .osviz-clock {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--muted);
  }
  .osviz-clock b {
    color: var(--text);
    font-weight: 700;
    font-size: 13px;
    margin-left: 3px;
  }
  .osviz-stats {
    margin-left: auto;
    display: flex;
    flex-wrap: nowrap;
    gap: 4px 10px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: var(--muted);
  }
  .osviz-stats b { color: var(--text); font-weight: 700; }
  .osviz-stats .osviz-stat-warn b { color: #fca5a5; }
  .osviz-section {
    background: rgba(15,23,42,0.4);
    border: 1px solid var(--panel-border);
    border-radius: 9px;
    padding: 6px 8px 8px;
  }
  .osviz-section-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
    margin-bottom: 6px;
  }
  .osviz-hint {
    color: var(--muted);
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: none;
    margin-left: 3px;
    font-size: 9px;
  }
  .osviz-banner {
    margin-top: 4px;
    padding: 4px 10px;
    border-radius: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: rgba(34,197,94,0.18);
    color: #86efac;
    border: 1px solid rgba(34,197,94,0.4);
  }
  .osviz-banner.osviz-banner-warn {
    background: rgba(248,113,113,0.18);
    color: #fca5a5;
    border-color: rgba(248,113,113,0.5);
    animation: osvizBannerPulse 1.4s ease-in-out infinite;
  }
  .osviz-banner.osviz-banner-info {
    background: rgba(56,189,248,0.16);
    color: #7dd3fc;
    border-color: rgba(56,189,248,0.4);
  }
  @keyframes osvizBannerPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(248,113,113,0.3); }
    50%      { box-shadow: 0 0 0 6px rgba(248,113,113,0); }
  }

  /* Per-topic containers inherit base layout from .osviz-container. The
     scheduling topic kept its original .sched-* class names below for
     historical reasons (and because their CSS is already battle-tested). */
  .sched-container { /* alias - inherits from .osviz-container */ }
  .sched-header {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px 12px;
    padding: 6px 10px;
    background: rgba(15,23,42,0.55);
    border: 1px solid var(--panel-border);
    border-radius: 9px;
    white-space: nowrap;
  }
  .sched-algo-pill {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(56,189,248,0.22), rgba(129,140,248,0.18));
    border: 1px solid rgba(56,189,248,0.4);
    color: var(--accent);
  }
  .sched-clock {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--muted);
  }
  .sched-clock .sched-time-val {
    color: var(--text);
    font-weight: 700;
    font-size: 13px;
    margin-left: 3px;
  }
  .sched-stats {
    margin-left: auto;
    display: flex;
    flex-wrap: nowrap;
    gap: 4px 10px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: var(--muted);
  }
  .sched-stats b { color: var(--text); font-weight: 700; }

  /* Legend strip — explains all abbreviations used elsewhere in the viz. */
  .sched-legend {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px 12px;
    padding: 4px 10px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    color: var(--muted);
    background: rgba(15,23,42,0.3);
    border: 1px dashed var(--panel-border);
    border-radius: 8px;
    white-space: nowrap;
  }
  .sched-legend span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
  }
  .sched-legend b {
    color: var(--accent);
    font-weight: 700;
    font-size: 10px;
    letter-spacing: 0.04em;
  }

  .sched-section {
    background: rgba(15,23,42,0.4);
    border: 1px solid var(--panel-border);
    border-radius: 9px;
    padding: 6px 8px 8px;
  }
  .sched-section-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
    margin-bottom: 6px;
  }
  .sched-hint {
    color: var(--muted);
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: none;
    margin-left: 3px;
    font-size: 9px;
  }

  /* Process cards — fixed width, never wrap */
  .sched-procs-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
  }
  .sched-proc-card {
    --proc-color: #38bdf8;
    position: relative;
    width: 142px;
    flex-shrink: 0;
    padding: 6px 8px 8px;
    border-radius: 8px;
    background: rgba(15,23,42,0.7);
    border: 1px solid var(--panel-border);
    border-left: 3px solid var(--proc-color);
    transition: box-shadow 0.25s ease, transform 0.25s ease, opacity 0.25s ease, border-color 0.25s ease, background 0.25s ease;
  }
  .sched-proc-card.sched-state-not-arrived { opacity: 0.4; }
  .sched-proc-card.sched-state-ready { opacity: 1; }
  .sched-proc-card.sched-state-running {
    background: rgba(56,189,248,0.08);
    box-shadow: 0 0 0 1px var(--proc-color), 0 0 16px -3px var(--proc-color);
    transform: translateY(-1px);
  }
  .sched-proc-card.sched-state-completed {
    opacity: 0.85;
    background: rgba(34,197,94,0.06);
    border-left-color: #4ade80;
  }
  .sched-proc-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 5px;
    gap: 4px;
  }
  .sched-proc-pid {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 700;
    color: var(--proc-color);
    letter-spacing: 0.04em;
  }
  .sched-proc-state {
    font-family: 'JetBrains Mono', monospace;
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 2px 5px;
    border-radius: 999px;
    background: rgba(148,163,184,0.18);
    color: var(--muted);
    white-space: nowrap;
  }
  .sched-state-ready     .sched-proc-state { background: rgba(56,189,248,0.18); color: #7dd3fc; }
  .sched-state-running   .sched-proc-state { background: rgba(251,191,36,0.22); color: #fcd34d; }
  .sched-state-completed .sched-proc-state { background: rgba(34,197,94,0.22); color: #86efac; }
  .sched-proc-meta {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    color: var(--muted);
    margin-bottom: 5px;
  }
  .sched-proc-meta b { color: var(--text); font-weight: 700; margin-left: 1px; }
  .sched-proc-progress-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    color: var(--muted);
    margin-bottom: 3px;
  }
  .sched-proc-progress-label b { color: var(--text); font-weight: 700; }
  .sched-proc-bar {
    height: 4px;
    border-radius: 3px;
    background: rgba(148,163,184,0.15);
    overflow: hidden;
  }
  .sched-proc-bar-fill {
    height: 100%;
    width: 0;
    background: var(--proc-color);
    border-radius: 3px;
    transition: width 0.35s ease;
  }
  .sched-state-completed .sched-proc-bar-fill { background: #4ade80; }

  /* Pipeline (queue → CPU → done) — same column order on every viewport */
  .sched-pipeline {
    display: grid;
    grid-template-columns: minmax(170px, 1fr) auto minmax(140px, 0.9fr) auto minmax(170px, 1fr);
    align-items: stretch;
    gap: 4px;
  }
  .sched-pipeline-col {
    background: rgba(15,23,42,0.55);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 6px 8px 7px;
    min-height: 64px;
    display: flex;
    flex-direction: column;
  }
  .sched-pipeline-arrow {
    align-self: center;
    color: var(--muted);
    font-size: 22px;
    font-weight: 700;
    padding: 0 2px;
    user-select: none;
  }
  .sched-queue-track,
  .sched-done-track {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    min-height: 28px;
    padding: 2px 0;
    align-items: center;
  }
  .sched-empty {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: var(--muted);
    opacity: 0.6;
    font-style: italic;
  }
  .sched-cpu-col {
    align-items: center;
    justify-content: center;
    text-align: center;
  }
  .sched-cpu-slot {
    flex: 1;
    width: 100%;
    min-height: 36px;
    border-radius: 8px;
    background: rgba(15,23,42,0.6);
    border: 1.5px dashed rgba(148,163,184,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 3px 0 4px;
    transition: border-color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
  }
  .sched-cpu-slot.sched-cpu-active {
    border-style: solid;
    border-color: rgba(251,191,36,0.55);
    background: rgba(251,191,36,0.08);
    box-shadow: inset 0 0 12px rgba(251,191,36,0.15);
    animation: schedCpuPulse 1.6s ease-in-out infinite;
  }
  @keyframes schedCpuPulse {
    0%, 100% { box-shadow: inset 0 0 12px rgba(251,191,36,0.12); }
    50%      { box-shadow: inset 0 0 20px rgba(251,191,36,0.28); }
  }
  .sched-cpu-meta {
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    color: var(--muted);
    min-height: 12px;
  }

  /* Chips representing processes inside queue / CPU / done */
  .sched-chip {
    --proc-color: #38bdf8;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 6px;
    border-radius: 6px;
    background: rgba(15,23,42,0.85);
    border: 1px solid var(--proc-color);
    box-shadow: 0 1px 0 rgba(0,0,0,0.3);
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: var(--text);
    animation: schedChipIn 0.22s ease-out both;
    flex-shrink: 0;
  }
  .sched-chip-pid {
    font-weight: 700;
    color: var(--proc-color);
    letter-spacing: 0.04em;
  }
  .sched-chip-rem {
    color: var(--muted);
    font-size: 9px;
    padding: 0 4px;
    border-radius: 4px;
    background: rgba(148,163,184,0.12);
  }
  .sched-chip-running {
    background: var(--proc-color);
    color: #0f172a;
    border-color: var(--proc-color);
    box-shadow: 0 0 14px -3px var(--proc-color);
    padding: 4px 9px;
    font-size: 11px;
  }
  .sched-chip-running .sched-chip-pid { color: #0f172a; }
  .sched-chip-running .sched-chip-rem { color: #0f172a; background: rgba(255,255,255,0.22); }
  .sched-chip-done {
    border-color: rgba(74,222,128,0.5);
    background: rgba(34,197,94,0.12);
  }
  .sched-chip-done .sched-chip-pid { color: #86efac; }
  .sched-chip-done .sched-chip-rem { color: #86efac; background: rgba(74,222,128,0.18); }
  @keyframes schedChipIn {
    0%   { opacity: 0; transform: translateY(-4px) scale(0.92); }
    100% { opacity: 1; transform: none; }
  }

  /* Gantt chart — no internal scroll; container grows naturally */
  .sched-gantt-wrap {
    padding-bottom: 4px;
  }
  .sched-gantt-row {
    display: flex;
    align-items: stretch;
    min-height: 30px;
    border-radius: 6px;
    overflow: hidden;
    background: rgba(15,23,42,0.6);
    border: 1px solid var(--panel-border);
    width: max-content;
  }
  .sched-gantt-seg {
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 11px;
    color: #0f172a;
    border-right: 1px solid rgba(0,0,0,0.3);
    flex-shrink: 0;
    animation: schedChipIn 0.22s ease-out both;
  }
  .sched-gantt-seg:last-child { border-right: none; }
  .sched-gantt-axis {
    position: relative;
    height: 14px;
    margin-top: 2px;
  }
  .sched-gantt-tick {
    position: absolute;
    top: 0;
    transform: translateX(-50%);
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    color: var(--muted);
    white-space: nowrap;
  }

  /* ============================================================
     OS — Producer / Consumer visualisation
     ============================================================ */
  .syncprob-container { width: max-content; }
  .syncprob-pipeline {
    display: grid;
    grid-template-columns: minmax(150px, 0.8fr) auto minmax(150px, 0.8fr);
    align-items: stretch;
    gap: 10px;
  }
  .syncprob-actor {
    background: rgba(15,23,42,0.55);
    border: 1px solid var(--panel-border);
    border-radius: 9px;
    padding: 6px 8px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
  .syncprob-actor-prod { border-color: rgba(167,139,250,0.4); }
  .syncprob-actor-cons { border-color: rgba(94,234,212,0.4); }
  .syncprob-actor-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
  }
  .syncprob-actor-state {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 700;
    color: var(--text);
    padding: 3px 6px;
    border-radius: 5px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
  }
  .syncprob-actor-state[data-kind="produce"], .syncprob-actor-state[data-kind="consume"] {
    background: rgba(56,189,248,0.18);
    border-color: rgba(56,189,248,0.5);
    color: #7dd3fc;
  }
  .syncprob-actor-state[data-kind="cs"] {
    background: rgba(167,139,250,0.18);
    border-color: rgba(167,139,250,0.5);
    color: #c4b5fd;
  }
  .syncprob-actor-state[data-kind="wait"] {
    background: rgba(253,224,71,0.18);
    border-color: rgba(253,224,71,0.5);
    color: #fde68a;
  }
  .syncprob-actor-state[data-kind="blocked"] {
    background: rgba(248,113,113,0.18);
    border-color: rgba(248,113,113,0.55);
    color: #fca5a5;
    animation: schedChipIn 0.25s ease-out both;
  }
  .syncprob-actor-meta {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: var(--muted);
  }
  .syncprob-actor-meta b { color: var(--text); font-weight: 700; }
  .syncprob-buffer {
    background: rgba(15,23,42,0.4);
    border: 1px solid var(--panel-border);
    border-radius: 9px;
    padding: 6px 8px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
  .syncprob-buffer-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
  }
  .syncprob-slots {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
  }
  .syncprob-slot {
    width: 46px;
    height: 46px;
    border-radius: 7px;
    background: rgba(255,255,255,0.04);
    border: 1.5px solid rgba(255,255,255,0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.18s ease;
  }
  .syncprob-slot-idx {
    font-family: 'JetBrains Mono', monospace;
    font-size: 8px;
    color: var(--muted);
    line-height: 1;
  }
  .syncprob-slot-val {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
  }
  .syncprob-slot-full {
    background: rgba(56,189,248,0.18);
    border-color: rgba(56,189,248,0.55);
    box-shadow: 0 0 8px rgba(56,189,248,0.25);
  }
  .syncprob-slot-full .syncprob-slot-val { color: #7dd3fc; }
  .syncprob-slot-in::before, .syncprob-slot-out::before {
    content: '';
    position: absolute;
    bottom: -4px;
    width: 8px;
    height: 8px;
    transform: rotate(45deg);
  }
  .syncprob-slot-in::before  { background: #a78bfa; bottom: auto; top: -4px; }
  .syncprob-slot-out::before { background: #5eead4; }
  .syncprob-ptrs {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: var(--muted);
  }
  .syncprob-ptrs b { color: var(--text); font-weight: 700; }
  .syncprob-sems {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
  }
  .syncprob-sem {
    flex: 1;
    background: rgba(15,23,42,0.55);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 5px 8px;
    text-align: center;
  }
  .syncprob-sem-name {
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
  }
  .syncprob-sem-val {
    font-family: 'JetBrains Mono', monospace;
    font-size: 18px;
    font-weight: 800;
    color: var(--text);
    line-height: 1.1;
  }

  /* ============================================================
     OS — Context Switch visualisation
     ============================================================ */
  .cswitch-container { width: max-content; }
  .cswitch-grid {
    display: grid;
    grid-template-columns: minmax(160px, 1fr) 28px minmax(180px, 1fr) 28px minmax(160px, 1fr);
    align-items: stretch;
    gap: 6px;
  }
  .cswitch-card {
    background: rgba(15,23,42,0.55);
    border: 1px solid var(--panel-border);
    border-radius: 9px;
    padding: 6px 8px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
  .cswitch-card-pcb { border-color: rgba(129,140,248,0.4); }
  .cswitch-card-cpu {
    border-color: rgba(248,113,113,0.55);
    background: linear-gradient(180deg, rgba(248,113,113,0.08), rgba(15,23,42,0.55));
  }
  .cswitch-card[data-state="RUNNING"]   { border-color: rgba(56,189,248,0.6); box-shadow: 0 0 10px rgba(56,189,248,0.2); }
  .cswitch-card[data-state="READY"]     { border-color: rgba(167,139,250,0.5); }
  .cswitch-card[data-state="SAVING"]    { border-color: rgba(253,224,71,0.55); }
  .cswitch-card-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
  }
  .cswitch-card-title b { color: var(--text); font-size: 11px; }
  .cswitch-card-state {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 700;
    color: var(--text);
    padding: 3px 6px;
    border-radius: 5px;
    background: rgba(255,255,255,0.05);
    text-align: center;
  }
  .cswitch-regs {
    width: 100%;
    border-collapse: collapse;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
  }
  .cswitch-regs td {
    padding: 2px 4px;
    border-bottom: 1px dashed rgba(255,255,255,0.05);
  }
  .cswitch-regs tr:last-child td { border-bottom: none; }
  .cswitch-reg-name { color: var(--muted); width: 38%; }
  .cswitch-reg-val  { color: var(--text); text-align: right; }
  .cswitch-reg-changed {
    color: #fde68a !important;
    background: rgba(253,224,71,0.12);
    animation: schedChipIn 0.3s ease-out both;
  }
  .cswitch-card-foot {
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    color: var(--muted);
    text-align: center;
  }
  .cswitch-arrow {
    align-self: stretch;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
  }
  .cswitch-arrow-line {
    display: block;
    height: 2px;
    width: 24px;
    background: rgba(255,255,255,0.18);
    position: relative;
    border-radius: 2px;
  }
  .cswitch-arrow-line::after {
    content: '';
    position: absolute;
    right: -2px; top: 50%;
    width: 0; height: 0;
    transform: translateY(-50%);
    border-left: 6px solid rgba(255,255,255,0.18);
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
  }
  .cswitch-arrow[data-active="save"] .cswitch-arrow-line {
    background: #fde68a;
    box-shadow: 0 0 6px rgba(253,224,71,0.5);
  }
  .cswitch-arrow[data-active="save"] .cswitch-arrow-line::after { border-left-color: #fde68a; }
  .cswitch-arrow[data-active="load"] .cswitch-arrow-line {
    background: #5eead4;
    box-shadow: 0 0 6px rgba(94,234,212,0.5);
  }
  .cswitch-arrow[data-active="load"] .cswitch-arrow-line::after { border-left-color: #5eead4; }

  /* ============================================================
     OS — Deadlock visualisation
     ============================================================ */
  .dlock-container { width: max-content; }
  .dlock-grid {
    position: relative;
    display: grid;
    grid-template-columns: minmax(170px, 1fr) minmax(170px, 1fr);
    grid-template-rows: auto auto;
    gap: 70px 110px;
    padding: 10px;
  }
  .dlock-card {
    background: rgba(15,23,42,0.55);
    border: 1px solid var(--panel-border);
    border-radius: 9px;
    padding: 6px 8px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
    z-index: 1;
  }
  .dlock-proc { border-color: rgba(129,140,248,0.4); }
  .dlock-res  { border-color: rgba(94,234,212,0.4); }
  .dlock-card[data-state="BLOCKED"] { border-color: rgba(248,113,113,0.6); box-shadow: 0 0 10px rgba(248,113,113,0.2); }
  .dlock-card[data-state="RUNNING"] { border-color: rgba(56,189,248,0.55); }
  .dlock-card[data-state="held"]    { border-color: rgba(253,224,71,0.55); }
  .dlock-card[data-state="COMPLETED"] { opacity: 0.7; border-color: rgba(134,239,172,0.5); }
  .dlock-card-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
  }
  .dlock-card-title b { color: var(--text); font-size: 11px; }
  .dlock-card-state {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 700;
    color: var(--text);
    padding: 2px 6px;
    border-radius: 5px;
    background: rgba(255,255,255,0.05);
  }
  .dlock-card-meta {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: var(--muted);
  }
  .dlock-card-meta b { color: var(--text); font-weight: 700; }
  .dlock-edges {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: visible;
    z-index: 0;
  }

  /* ============================================================
     OS — Virtual Memory visualisation
     ============================================================ */
  .vmem-container { width: max-content; }
  .vmem-access-row {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
  }
  .vmem-tag {
    padding: 3px 8px;
    border-radius: 6px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--muted);
  }
  .vmem-tag b { color: var(--text); font-weight: 700; }
  .vmem-tag-op    { background: rgba(167,139,250,0.18); border-color: rgba(167,139,250,0.4); color: #c4b5fd; font-weight: 700; }
  .vmem-tag-va    { background: rgba(56,189,248,0.14);  border-color: rgba(56,189,248,0.4); }
  .vmem-tag-vpn   { background: rgba(134,239,172,0.14); border-color: rgba(134,239,172,0.4); }
  .vmem-tag-off   { background: rgba(253,224,71,0.14);  border-color: rgba(253,224,71,0.4); }
  .vmem-tag-state { background: rgba(255,255,255,0.06); color: var(--text); }
  .vmem-arrow { color: var(--muted); }
  .vmem-pipeline {
    display: grid;
    grid-template-columns: minmax(220px, 0.9fr) minmax(170px, 0.8fr) minmax(140px, 0.6fr);
    gap: 8px;
    align-items: start;
  }
  .vmem-pt-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
  }
  .vmem-pt-table th, .vmem-pt-table td {
    padding: 2px 6px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    text-align: center;
  }
  .vmem-pt-table th {
    background: rgba(255,255,255,0.04);
    color: var(--muted);
    font-weight: 700;
    letter-spacing: 0.05em;
  }
  .vmem-pt-table tbody tr { transition: background 0.18s ease; }
  .vmem-pt-active {
    background: rgba(56,189,248,0.18);
    box-shadow: inset 3px 0 0 #38bdf8;
  }
  .vmem-pt-invalid td { color: rgba(248,113,113,0.85); }
  .vmem-frames {
    display: flex;
    flex-direction: column;
    gap: 5px;
  }
  .vmem-frame {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    border: 1.5px solid rgba(255,255,255,0.1);
    border-radius: 7px;
    background: rgba(255,255,255,0.03);
    transition: all 0.18s ease;
  }
  .vmem-frame-idx {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    min-width: 22px;
  }
  .vmem-frame-val {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--text);
  }
  .vmem-frame-active {
    background: rgba(56,189,248,0.18);
    border-color: rgba(56,189,248,0.55);
    box-shadow: 0 0 8px rgba(56,189,248,0.25);
  }
  .vmem-frame-active .vmem-frame-idx,
  .vmem-frame-active .vmem-frame-val { color: #7dd3fc; }
  .vmem-swap-slots {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
  .vmem-swap-slot {
    padding: 4px 8px;
    border: 1px dashed rgba(255,255,255,0.15);
    border-radius: 6px;
    background: rgba(146,64,14,0.18);
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: #fde68a;
    text-align: center;
    transition: all 0.18s ease;
  }
  .vmem-swap-active {
    background: rgba(146,64,14,0.4);
    border-color: rgba(253,224,71,0.7);
    box-shadow: 0 0 8px rgba(253,224,71,0.35);
  }

  /* ============================================================
     Networking - state-based visualisations (NET_HANDLERS)
     Shared shell + 5 topic-specific layouts:
       net-tcp     -> TCP Reliable Transport (windows, ACKs, loss)
       net-switch  -> L2 Switch (MAC learning + CAM table)
       net-router  -> L3 Router (longest prefix match)
       net-nat     -> NAT (translation table)
       net-arp     -> ARP (host caches + switch CAM + broadcast)
     ============================================================ */
  .netviz-zoom-host {
    /* `margin: auto` centres the host on BOTH axes when it fits the stage. When
       the host is bigger than the stage the auto margins collapse to 0, letting
       `align-self: flex-start` anchor it at top-left so the user can scroll the
       overflow naturally. The wrapper itself gets sized inline by applyNetZoom
       to the scaled (post-transform) dimensions, so the parent flex sees the
       real visual extent of the diagram for correct centring + scroll. */
    margin: auto;
    align-self: flex-start;
  }
  .netviz-host {
    display: block;
    width: max-content;
    transform-origin: top left;
    transition: transform 0.15s ease;
  }
  .netviz-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    min-width: 720px;
    max-width: 1100px;
    color: #e2e8f0;
    font-family: 'Inter', system-ui, sans-serif;
  }
  .netviz-header {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  }
  .netviz-title-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
  .netviz-chip {
    padding: 4px 10px;
    border-radius: 10px;
    font-size: 11px;
    letter-spacing: 0.3px;
    border: 1px solid rgba(148,163,184,0.35);
    background: rgba(15,23,42,0.6);
    color: #cbd5e1;
  }
  .netviz-chip-topic {
    background: linear-gradient(180deg, rgba(56,189,248,0.18), rgba(14,165,233,0.08));
    border-color: rgba(125,211,252,0.6);
    color: #bae6fd;
    font-weight: 700;
  }
  .netviz-chip-query {
    background: rgba(67,56,202,0.18);
    border-color: rgba(165,180,252,0.5);
    color: #c7d2fe;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
  }

  .netviz-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid rgba(71,85,105,0.4);
    background: rgba(15,23,42,0.5);
    font-size: 10.5px;
  }
  .netviz-legend-item { display: inline-flex; align-items: center; gap: 6px; color: #cbd5e1; }
  .netviz-legend-swatch {
    width: 12px; height: 12px; border-radius: 3px;
    border: 1px solid rgba(148,163,184,0.4);
    flex-shrink: 0;
  }
  .netviz-legend-swatch.sw-tx       { background: rgba(56,189,248,0.55); }
  .netviz-legend-swatch.sw-rx       { background: rgba(74,222,128,0.45); }
  .netviz-legend-swatch.sw-drop     { background: rgba(248,113,113,0.35); }
  .netviz-legend-swatch.sw-flood    { background: rgba(251,191,36,0.45); }
  .netviz-legend-swatch.sw-unicast  { background: rgba(168,85,247,0.45); }
  .netviz-legend-swatch.sw-learn    { background: rgba(56,189,248,0.3); border-color: rgba(56,189,248,0.65); }
  .netviz-legend-swatch.sw-data     { background: rgba(56,189,248,0.5); }
  .netviz-legend-swatch.sw-retx     { background: rgba(251,113,133,0.55); }
  .netviz-legend-swatch.sw-ack      { background: rgba(74,222,128,0.5); }
  .netviz-legend-swatch.sw-dup      { background: rgba(251,191,36,0.55); }
  .netviz-legend-swatch.sw-lost     { background: rgba(220,38,38,0.55); }
  .netviz-legend-swatch.sw-buf      { background: rgba(203,213,225,0.3); border-style: dashed; }
  .netviz-legend-swatch.rt-pkt      { background: rgba(56,189,248,0.55); }
  .netviz-legend-swatch.rt-iface    { background: rgba(168,85,247,0.55); }
  .netviz-legend-swatch.rt-cand     { background: rgba(251,191,36,0.45); }
  .netviz-legend-swatch.rt-win      { background: rgba(74,222,128,0.6); }
  .netviz-legend-swatch.rt-drop     { background: rgba(248,113,113,0.55); }
  .netviz-legend-swatch.nat-priv    { background: rgba(34,197,94,0.45); }
  .netviz-legend-swatch.nat-pub     { background: rgba(56,189,248,0.45); }
  .netviz-legend-swatch.nat-out     { background: rgba(251,191,36,0.45); }
  .netviz-legend-swatch.nat-in      { background: rgba(168,85,247,0.45); }
  .netviz-legend-swatch.nat-drop    { background: rgba(248,113,113,0.55); }
  .netviz-legend-swatch.nat-rewrite { background: rgba(244,114,182,0.55); }

  .netviz-stats {
    display: flex; gap: 6px; flex-wrap: wrap;
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid rgba(71,85,105,0.4);
    background: rgba(15,23,42,0.5);
  }
  .netviz-stat-chip {
    display: inline-flex; gap: 6px; align-items: center;
    padding: 3px 9px;
    border-radius: 6px;
    background: rgba(30,41,59,0.7);
    border: 1px solid rgba(71,85,105,0.45);
    font-size: 11px;
  }
  .netviz-stat-label { color: #94a3b8; }
  .netviz-stat-val { color: #f1f5f9; font-family: 'JetBrains Mono', monospace; font-weight: 600; }

  .netviz-banner {
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid;
    font-size: 12.5px;
    line-height: 1.4;
  }
  .netviz-banner-info    { background: rgba(56,189,248,0.10); border-color: rgba(125,211,252,0.45); color: #bae6fd; }
  .netviz-banner-warn    { background: rgba(251,191,36,0.10); border-color: rgba(253,224,71,0.45); color: #fde68a; }
  .netviz-banner-success { background: rgba(34,197,94,0.10);  border-color: rgba(74,222,128,0.45); color: #bbf7d0; }

  /* ---------- TCP Reliable Transport ---------- */
  .tcp-main {
    display: grid;
    grid-template-columns: 200px 1fr 200px;
    gap: 10px;
    align-items: stretch;
  }
  .tcp-endpoint {
    padding: 10px;
    border-radius: 10px;
    background: rgba(15,23,42,0.7);
    border: 1px solid rgba(71,85,105,0.55);
    display: flex; flex-direction: column; gap: 4px;
    font-size: 11.5px;
  }
  .tcp-end-title {
    font-size: 10.5px; letter-spacing: 0.6px;
    color: #94a3b8;
    font-weight: 700;
  }
  .tcp-sender .tcp-end-title { color: #7dd3fc; }
  .tcp-receiver .tcp-end-title { color: #86efac; }
  .tcp-end-ip { font-family: 'JetBrains Mono', monospace; color: #e2e8f0; font-size: 12px; }
  .tcp-end-state {
    align-self: flex-start;
    padding: 2px 8px;
    border-radius: 6px;
    background: rgba(74,222,128,0.18);
    border: 1px solid rgba(74,222,128,0.45);
    color: #bbf7d0;
    font-size: 10.5px;
    font-weight: 600;
    margin-top: 2px;
  }
  .tcp-end-kv {
    display: flex; justify-content: space-between;
    font-size: 11px;
    padding: 2px 0;
    border-top: 1px dashed rgba(71,85,105,0.35);
  }
  .tcp-end-kv > span:first-child { color: #94a3b8; }
  .tcp-end-kv > span:last-child  { font-family: 'JetBrains Mono', monospace; color: #f1f5f9; }
  .tcp-end-phase {
    align-self: flex-start;
    margin-top: 4px;
    padding: 2px 7px;
    border-radius: 5px;
    border: 1px solid rgba(148,163,184,0.4);
    font-size: 10px;
    letter-spacing: 0.4px;
    background: rgba(30,41,59,0.6);
    color: #cbd5e1;
  }
  .tcp-end-phase.tcp-phase-slow-start         { color: #bae6fd; border-color: rgba(125,211,252,0.6); background: rgba(56,189,248,0.14); }
  .tcp-end-phase.tcp-phase-congestion-avoidance { color: #bbf7d0; border-color: rgba(74,222,128,0.6); background: rgba(34,197,94,0.14); }
  .tcp-end-phase.tcp-phase-fast-recovery      { color: #fde68a; border-color: rgba(253,224,71,0.6); background: rgba(251,191,36,0.14); }
  .tcp-end-phase.tcp-phase-none               { display: none; }

  .tcp-wire {
    position: relative;
    border-radius: 10px;
    background: rgba(15,23,42,0.55);
    border: 1px solid rgba(71,85,105,0.45);
    padding: 14px 12px;
    overflow: hidden;
    min-height: 130px;
  }
  .tcp-wire-rail {
    position: absolute;
    top: 50%; left: 8px; right: 8px;
    height: 2px;
    background: linear-gradient(90deg, rgba(125,211,252,0.4), rgba(74,222,128,0.4));
    transform: translateY(-50%);
  }
  .tcp-wire-packets {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    z-index: 1;
  }
  .tcp-pkt {
    position: relative;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-family: 'JetBrains Mono', monospace;
    border: 1px solid rgba(148,163,184,0.4);
    background: rgba(30,41,59,0.85);
    color: #e2e8f0;
    display: inline-flex; align-items: center;
  }
  .tcp-pkt-data     { background: rgba(56,189,248,0.18); border-color: rgba(125,211,252,0.55); color: #bae6fd; }
  .tcp-pkt-retx     { background: rgba(251,113,133,0.20); border-color: rgba(251,113,133,0.55); color: #fecdd3; }
  .tcp-pkt-ack      { background: rgba(74,222,128,0.18); border-color: rgba(74,222,128,0.55); color: #bbf7d0; }
  .tcp-pkt-dup      { background: rgba(251,191,36,0.20); border-color: rgba(253,224,71,0.55); color: #fde68a; }
  .tcp-pkt-lost     {
    background: rgba(220,38,38,0.20);
    border: 1px dashed rgba(248,113,113,0.65);
    color: #fecaca;
    text-decoration: line-through;
    opacity: 0.85;
  }
  .tcp-pkt-x {
    margin-left: 6px;
    color: #fca5a5;
    font-weight: 900;
    font-size: 13px;
  }
  .tcp-pkt-dir-rx { box-shadow: inset 0 -2px 0 rgba(74,222,128,0.6); }
  .tcp-pkt-dir-tx { box-shadow: inset 0 -2px 0 rgba(125,211,252,0.6); }

  .tcp-window-strip {
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid rgba(71,85,105,0.45);
    background: rgba(15,23,42,0.5);
  }
  .tcp-window-title { font-size: 10.5px; color: #94a3b8; letter-spacing: 0.3px; margin-bottom: 6px; }
  .tcp-window-rail { display: flex; gap: 4px; flex-wrap: wrap; }
  .tcp-win-slot {
    min-width: 56px;
    padding: 4px 8px;
    border-radius: 6px;
    background: rgba(30,41,59,0.7);
    border: 1px solid rgba(125,211,252,0.4);
    color: #bae6fd;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    text-align: center;
  }
  .tcp-win-empty { color: #64748b; font-style: italic; font-size: 11px; }

  .tcp-log-panel {
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid rgba(71,85,105,0.45);
    background: rgba(15,23,42,0.5);
  }
  .tcp-log-title { font-size: 10.5px; color: #94a3b8; letter-spacing: 0.3px; margin-bottom: 6px; }
  .tcp-log-tbl   { width: 100%; border-collapse: collapse; font-size: 11.5px; font-family: 'JetBrains Mono', monospace; }
  .tcp-log-tbl th {
    padding: 4px 8px;
    text-align: left;
    color: #94a3b8;
    font-weight: 600;
    border-bottom: 1px solid rgba(71,85,105,0.4);
    font-size: 10.5px;
  }
  .tcp-log-tbl td { padding: 3px 8px; border-bottom: 1px dashed rgba(71,85,105,0.25); }
  .tcp-log-row.tcp-log-flight    { color: #bae6fd; }
  .tcp-log-row.tcp-log-acked     { color: #bbf7d0; }
  .tcp-log-row.tcp-log-lost      { color: #fecaca; }
  .tcp-log-row.tcp-log-buffered  { color: #fde68a; }

  /* ---------- L2 Switch ---------- */
  .sw-hosts-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
  }
  .sw-host {
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid rgba(71,85,105,0.55);
    background: rgba(15,23,42,0.65);
    text-align: center;
    transition: all 0.15s ease;
  }
  .sw-host-name { font-weight: 700; color: #e2e8f0; font-size: 13px; }
  .sw-host-ip   { font-family: 'JetBrains Mono', monospace; color: #cbd5e1; font-size: 10.5px; }
  .sw-host-mac  { font-family: 'JetBrains Mono', monospace; color: #94a3b8; font-size: 10px; }
  .sw-host-port-wire {
    margin-top: 6px;
    padding: 2px 0;
    border-top: 1px dashed rgba(71,85,105,0.4);
    color: #64748b;
    font-size: 10px;
  }
  .sw-host-tx   { border-color: rgba(125,211,252,0.7); box-shadow: 0 0 10px rgba(56,189,248,0.35); background: rgba(56,189,248,0.10); }
  .sw-host-rx   { border-color: rgba(74,222,128,0.7);  box-shadow: 0 0 10px rgba(74,222,128,0.30); background: rgba(34,197,94,0.10); }
  .sw-host-drop { border-color: rgba(248,113,113,0.6); background: rgba(220,38,38,0.10); opacity: 0.65; }

  .sw-box {
    padding: 10px;
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(217,119,6,0.15), rgba(146,64,14,0.08));
    border: 1px solid rgba(252,211,77,0.45);
  }
  .sw-box-title {
    text-align: center;
    font-size: 11px;
    letter-spacing: 1px;
    color: #fcd34d;
    font-weight: 700;
    margin-bottom: 6px;
  }
  .sw-box-ports {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
  }
  .sw-port {
    padding: 6px 4px;
    border-radius: 8px;
    border: 1px solid rgba(252,211,77,0.35);
    background: rgba(15,23,42,0.55);
    text-align: center;
    transition: all 0.15s ease;
  }
  .sw-port-label { font-size: 11px; font-weight: 700; color: #fde68a; }
  .sw-port-light {
    margin: 4px auto 0;
    width: 10px; height: 10px;
    border-radius: 50%;
    background: rgba(71,85,105,0.5);
  }
  .sw-port-in       { border-color: rgba(125,211,252,0.8); background: rgba(56,189,248,0.18); }
  .sw-port-in .sw-port-light { background: #38bdf8; box-shadow: 0 0 8px #38bdf8; }
  .sw-port-flood    { border-color: rgba(253,224,71,0.8); background: rgba(251,191,36,0.18); }
  .sw-port-flood .sw-port-light { background: #fbbf24; box-shadow: 0 0 8px #fbbf24; }
  .sw-port-unicast  { border-color: rgba(196,181,253,0.8); background: rgba(168,85,247,0.18); }
  .sw-port-unicast .sw-port-light { background: #a78bfa; box-shadow: 0 0 8px #a78bfa; }

  .sw-cam-panel, .sw-frame-panel {
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid rgba(71,85,105,0.45);
    background: rgba(15,23,42,0.55);
  }
  .sw-cam-title, .sw-frame-title {
    font-size: 10.5px;
    color: #94a3b8;
    letter-spacing: 0.3px;
    margin-bottom: 6px;
    display: flex; justify-content: space-between; align-items: baseline;
  }
  .sw-cam-sub, .rt-table-sub { color: #64748b; font-size: 10px; font-style: italic; }
  .sw-cam-tbl, .rt-table, .nat-table, .arp-cam-tbl, .arp-cache-tbl {
    width: 100%; border-collapse: collapse;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
  }
  .sw-cam-tbl th, .rt-table th, .nat-table th, .arp-cam-tbl th, .arp-cache-tbl th {
    text-align: left;
    padding: 4px 8px;
    color: #94a3b8;
    font-size: 10px;
    font-weight: 600;
    border-bottom: 1px solid rgba(71,85,105,0.45);
  }
  .sw-cam-tbl td, .rt-table td, .nat-table td, .arp-cam-tbl td, .arp-cache-tbl td {
    padding: 4px 8px;
    border-bottom: 1px dashed rgba(71,85,105,0.25);
    color: #e2e8f0;
  }
  .sw-cam-empty, .nat-empty, .arp-cache-empty { color: #64748b; font-style: italic; text-align: center; }
  .sw-cam-empty td, .nat-empty td, .arp-cache-empty td { text-align: center; }
  .sw-cam-learned { background: rgba(56,189,248,0.06); }

  .sw-frame-body {
    font-size: 11.5px;
    font-family: 'JetBrains Mono', monospace;
  }
  .sw-frame-idle { color: #64748b; font-style: italic; font-family: 'Inter', sans-serif; }
  .sw-frame-line { display: flex; justify-content: space-between; padding: 2px 0; border-bottom: 1px dashed rgba(71,85,105,0.18); }
  .sw-frame-k    { color: #94a3b8; font-size: 10.5px; }
  .sw-frame-v    { color: #e2e8f0; }
  .sw-frame-act-flood   { color: #fde68a; font-weight: 700; }
  .sw-frame-act-unicast { color: #c4b5fd; font-weight: 700; }
  .sw-frame-act-rx      { color: #bae6fd; font-weight: 700; }

  /* ---------- L3 Router ---------- */
  .rt-subnets {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
  }
  .rt-subnet {
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(15,23,42,0.6);
    border: 1px solid rgba(71,85,105,0.55);
    transition: all 0.15s ease;
  }
  .rt-subnet-active {
    border-color: rgba(196,181,253,0.85);
    background: rgba(168,85,247,0.12);
    box-shadow: 0 0 12px rgba(168,85,247,0.30);
  }
  .rt-subnet-title { font-size: 12px; font-weight: 700; color: #e2e8f0; font-family: 'JetBrains Mono', monospace; }
  .rt-subnet-iface { font-size: 10.5px; color: #c4b5fd; }
  .rt-subnet-gw    { font-size: 10.5px; color: #94a3b8; font-family: 'JetBrains Mono', monospace; }
  .rt-subnet-hosts { display: flex; flex-direction: column; gap: 3px; margin-top: 4px; }
  .rt-host {
    padding: 3px 6px;
    border-radius: 6px;
    border: 1px solid rgba(71,85,105,0.4);
    background: rgba(30,41,59,0.6);
    font-size: 10.5px;
    color: #cbd5e1;
    display: flex;
    justify-content: space-between;
    transition: all 0.15s ease;
  }
  .rt-host-ip { font-family: 'JetBrains Mono', monospace; color: #94a3b8; font-size: 10px; }
  .rt-host-active {
    border-color: rgba(125,211,252,0.85);
    background: rgba(56,189,248,0.16);
    color: #bae6fd;
    box-shadow: 0 0 8px rgba(56,189,248,0.35);
  }

  .rt-router-box {
    padding: 10px;
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(67,56,202,0.18), rgba(49,46,129,0.10));
    border: 1px solid rgba(129,140,248,0.55);
  }
  .rt-router-title {
    text-align: center;
    font-size: 11px;
    letter-spacing: 1.2px;
    color: #c7d2fe;
    font-weight: 700;
    margin-bottom: 6px;
  }
  .rt-router-ifaces {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
  }
  .rt-iface {
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid rgba(129,140,248,0.4);
    background: rgba(15,23,42,0.55);
    text-align: center;
    transition: all 0.15s ease;
    display: flex; flex-direction: column; gap: 2px;
  }
  .rt-iface-name { font-size: 11px; font-weight: 700; color: #c7d2fe; }
  .rt-iface-ip   { font-size: 10px; color: #94a3b8; font-family: 'JetBrains Mono', monospace; }
  .rt-iface-active {
    border-color: rgba(196,181,253,0.85);
    background: rgba(168,85,247,0.18);
    box-shadow: 0 0 10px rgba(168,85,247,0.35);
  }

  .rt-packet-card, .rt-table-panel, .rt-lpm-panel {
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid rgba(71,85,105,0.45);
    background: rgba(15,23,42,0.55);
  }
  .rt-packet-title, .rt-table-title, .rt-lpm-title {
    font-size: 10.5px;
    color: #94a3b8;
    letter-spacing: 0.3px;
    margin-bottom: 6px;
    display: flex; justify-content: space-between; align-items: baseline;
  }
  .rt-packet-body, .rt-lpm-body {
    font-size: 11.5px;
    font-family: 'JetBrains Mono', monospace;
  }
  .rt-packet-idle, .rt-lpm-idle { color: #64748b; font-style: italic; font-family: 'Inter', sans-serif; }
  .rt-pkt-line, .rt-lpm-line { display: flex; justify-content: space-between; padding: 2px 0; border-bottom: 1px dashed rgba(71,85,105,0.18); }
  .rt-pkt-k, .rt-lpm-k { color: #94a3b8; font-size: 10.5px; }
  .rt-pkt-v, .rt-lpm-v { color: #e2e8f0; }
  .rt-pkt-ttl-low { color: #fca5a5; font-weight: 700; }
  .rt-pkt-icmp { color: #fde68a; }
  .rt-pkt-dropped {
    text-align: center;
    color: #fecaca;
    background: rgba(220,38,38,0.18);
    border: 1px solid rgba(248,113,113,0.5);
    border-radius: 6px;
    padding: 3px 8px;
    margin-top: 4px;
    font-weight: 700;
    letter-spacing: 0.4px;
  }
  .rt-lpm-reason { color: #cbd5e1; font-style: italic; font-family: 'Inter', sans-serif; padding-top: 4px; }
  .rt-lpm-winner-tag { color: #bbf7d0; font-weight: 700; }

  .rt-row { transition: background 0.15s ease; }
  .rt-row-candidate { background: rgba(251,191,36,0.10); }
  .rt-row-candidate td { color: #fde68a; }
  .rt-row-winner {
    background: rgba(34,197,94,0.18) !important;
    box-shadow: inset 0 0 0 1px rgba(74,222,128,0.5);
  }
  .rt-row-winner td { color: #bbf7d0; font-weight: 700; }

  /* ---------- NAT ---------- */
  .nat-topo {
    display: grid;
    grid-template-columns: 1fr 200px 1fr;
    gap: 10px;
    align-items: stretch;
  }
  .nat-zone {
    padding: 10px;
    border-radius: 10px;
    border: 1px solid rgba(71,85,105,0.55);
    background: rgba(15,23,42,0.6);
    display: flex; flex-direction: column; gap: 6px;
  }
  .nat-zone-priv { border-color: rgba(74,222,128,0.45); background: linear-gradient(180deg, rgba(34,197,94,0.10), rgba(22,101,52,0.04)); }
  .nat-zone-pub  { border-color: rgba(125,211,252,0.45); background: linear-gradient(180deg, rgba(56,189,248,0.10), rgba(14,116,144,0.04)); }
  .nat-zone-title { font-size: 11px; color: #cbd5e1; font-weight: 700; letter-spacing: 0.3px; }
  .nat-zone-priv .nat-zone-title { color: #bbf7d0; }
  .nat-zone-pub .nat-zone-title  { color: #bae6fd; }
  .nat-host {
    padding: 6px 8px;
    border-radius: 8px;
    background: rgba(15,23,42,0.7);
    border: 1px solid rgba(71,85,105,0.4);
    display: flex; justify-content: space-between; align-items: center;
    color: #e2e8f0;
    font-size: 11.5px;
  }
  .nat-host-ip { font-family: 'JetBrains Mono', monospace; color: #94a3b8; font-size: 10.5px; }

  .nat-box {
    padding: 10px;
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(190,24,93,0.18), rgba(157,23,77,0.10));
    border: 1px solid rgba(244,114,182,0.55);
    text-align: center;
    display: flex; flex-direction: column; gap: 6px;
    align-items: center;
  }
  .nat-box-title {
    font-size: 11px;
    letter-spacing: 1.3px;
    color: #fbcfe8;
    font-weight: 700;
  }
  .nat-box-ip { font-size: 11px; color: #f1f5f9; font-family: 'JetBrains Mono', monospace; }
  .nat-box-ip span { color: #f9a8d4; }
  .nat-box-phase {
    padding: 3px 8px;
    border-radius: 6px;
    border: 1px solid rgba(244,114,182,0.5);
    background: rgba(15,23,42,0.6);
    color: #f9a8d4;
    font-size: 10px;
    letter-spacing: 0.5px;
  }
  .nat-phase-idle           { opacity: 0.5; }
  .nat-phase-outbound-translate { border-color: rgba(253,224,71,0.6); color: #fde68a; background: rgba(251,191,36,0.10); }
  .nat-phase-inbound-match  { border-color: rgba(196,181,253,0.6); color: #c4b5fd; background: rgba(168,85,247,0.10); }
  .nat-phase-inbound-rewrite { border-color: rgba(244,114,182,0.6); color: #f9a8d4; background: rgba(236,72,153,0.10); }

  .nat-packet-card {
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid rgba(71,85,105,0.45);
    background: rgba(15,23,42,0.55);
  }
  .nat-packet-title { font-size: 10.5px; color: #94a3b8; letter-spacing: 0.3px; margin-bottom: 6px; }
  .nat-packet-body  { font-size: 11.5px; font-family: 'JetBrains Mono', monospace; }
  .nat-packet-idle  { color: #64748b; font-style: italic; font-family: 'Inter', sans-serif; }
  .nat-pkt-line     { display: flex; justify-content: space-between; padding: 2px 0; border-bottom: 1px dashed rgba(71,85,105,0.18); }
  .nat-pkt-k        { color: #94a3b8; font-size: 10.5px; }
  .nat-pkt-v        { color: #e2e8f0; }
  .nat-dir-outbound .nat-pkt-v { color: #fde68a; }
  .nat-dir-inbound .nat-pkt-v  { color: #c4b5fd; }
  .nat-rewrite-row {
    margin-top: 6px;
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid rgba(244,114,182,0.5);
    background: rgba(236,72,153,0.10);
    display: flex; flex-direction: column; gap: 3px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
  }
  .nat-rewrite-old   { color: #fca5a5; text-decoration: line-through; }
  .nat-rewrite-arrow { color: #94a3b8; font-style: italic; text-align: center; font-family: 'Inter', sans-serif; }
  .nat-rewrite-new   { color: #bbf7d0; }

  .nat-table-panel {
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid rgba(71,85,105,0.45);
    background: rgba(15,23,42,0.55);
  }
  .nat-table-title { font-size: 10.5px; color: #94a3b8; letter-spacing: 0.3px; margin-bottom: 6px; }
  .nat-row-hit {
    background: rgba(74,222,128,0.16) !important;
    box-shadow: inset 0 0 0 1px rgba(74,222,128,0.45);
  }
  .nat-row-hit td { color: #bbf7d0; }

  /* ---------- ARP ---------- */
  .arp-hosts-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }
  .arp-host {
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(15,23,42,0.65);
    border: 1px solid rgba(71,85,105,0.55);
    transition: all 0.15s ease;
  }
  .arp-host-tx   { border-color: rgba(125,211,252,0.7); box-shadow: 0 0 10px rgba(56,189,248,0.35); background: rgba(56,189,248,0.10); }
  .arp-host-rx   { border-color: rgba(74,222,128,0.7);  box-shadow: 0 0 10px rgba(74,222,128,0.30); background: rgba(34,197,94,0.10); }
  .arp-host-drop { border-color: rgba(248,113,113,0.6); background: rgba(220,38,38,0.10); opacity: 0.65; }
  .arp-host-head { display: flex; justify-content: space-between; align-items: center; }
  .arp-host-name { font-weight: 700; color: #e2e8f0; font-size: 13px; }
  .arp-host-port { font-size: 10.5px; color: #fde68a; font-family: 'JetBrains Mono', monospace; }
  .arp-host-ip   { font-family: 'JetBrains Mono', monospace; color: #cbd5e1; font-size: 11px; }
  .arp-host-mac  { font-family: 'JetBrains Mono', monospace; color: #94a3b8; font-size: 10.5px; }
  .arp-cache-title {
    margin-top: 6px;
    font-size: 10px;
    letter-spacing: 0.3px;
    color: #94a3b8;
  }
  .arp-cache-tbl { font-size: 10.5px; }
  .arp-cache-row td { color: #e2e8f0; }

  .arp-switch-box {
    padding: 10px;
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(217,119,6,0.15), rgba(146,64,14,0.08));
    border: 1px solid rgba(252,211,77,0.45);
  }
  .arp-switch-title { text-align: center; font-size: 11px; letter-spacing: 1px; color: #fcd34d; font-weight: 700; margin-bottom: 6px; }
  .arp-switch-ports {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  .arp-port {
    padding: 6px 4px;
    border-radius: 8px;
    border: 1px solid rgba(252,211,77,0.35);
    background: rgba(15,23,42,0.55);
    text-align: center;
    color: #fde68a;
    font-size: 11px;
    font-weight: 700;
    transition: all 0.15s ease;
  }
  .arp-port-in      { border-color: rgba(125,211,252,0.8); background: rgba(56,189,248,0.18); color: #bae6fd; }
  .arp-port-flood   { border-color: rgba(253,224,71,0.8); background: rgba(251,191,36,0.18); color: #fde68a; }
  .arp-port-unicast { border-color: rgba(196,181,253,0.8); background: rgba(168,85,247,0.18); color: #c4b5fd; }

  .arp-cam-panel, .arp-frame-panel {
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid rgba(71,85,105,0.45);
    background: rgba(15,23,42,0.55);
  }
  .arp-cam-title, .arp-frame-title { font-size: 10.5px; color: #94a3b8; letter-spacing: 0.3px; margin-bottom: 6px; }
  .arp-cam-row td { color: #e2e8f0; }
  .arp-frame-body { font-size: 11.5px; font-family: 'JetBrains Mono', monospace; }
  .arp-frame-idle { color: #64748b; font-style: italic; font-family: 'Inter', sans-serif; }
  .arp-frame-kind {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    margin-bottom: 4px;
    font-size: 10.5px;
    letter-spacing: 0.5px;
    font-weight: 700;
  }
  .arp-frame-kind-arp-request { background: rgba(251,191,36,0.18); border: 1px solid rgba(253,224,71,0.55); color: #fde68a; }
  .arp-frame-kind-arp-reply   { background: rgba(168,85,247,0.18); border: 1px solid rgba(196,181,253,0.55); color: #c4b5fd; }
  .arp-frame-kind-data        { background: rgba(56,189,248,0.18); border: 1px solid rgba(125,211,252,0.55); color: #bae6fd; }
  .arp-frame-line { display: flex; justify-content: space-between; padding: 2px 0; border-bottom: 1px dashed rgba(71,85,105,0.18); }
  .arp-frame-k    { color: #94a3b8; font-size: 10.5px; }
  .arp-frame-v    { color: #e2e8f0; }


/* ===================================================================== */
/* LLM state-based visualisations (llmviz-* shared + topic-specific)     */
/* ===================================================================== */
.llmviz-zoom-host {
  /* `margin: auto` centres the host on BOTH axes when it fits the stage. When
     the host is bigger than the stage the auto margins collapse to 0, letting
     `align-self: flex-start` anchor it at top-left so the user can scroll the
     overflow naturally. */
  margin: auto;
  align-self: flex-start;
}
.llmviz-host {
  width: max-content;
  min-width: 100%;
  padding: 14px 16px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #e2e8f0;
}
.llmviz-header {
  margin-bottom: 10px;
}
.llmviz-header-title {
  font-size: 17px;
  font-weight: 700;
  color: #f1f5f9;
}
.llmviz-header-subtitle {
  font-size: 12.5px;
  color: #94a3b8;
  margin-top: 3px;
}
.llmviz-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 8px 10px;
  margin-bottom: 12px;
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(71, 85, 105, 0.45);
  border-radius: 6px;
  font-size: 11.5px;
  color: #cbd5e1;
}
.llmviz-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.llmviz-legend-dot  { width: 10px; height: 10px; border-radius: 50%; }
.llmviz-banner {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 500;
  border: 1px solid;
}
.llmviz-banner-info    { background: rgba(56,189,248,0.10); border-color: rgba(125,211,252,0.45); color: #bae6fd; }
.llmviz-banner-success { background: rgba(34,197,94,0.12);  border-color: rgba(134,239,172,0.5);  color: #bbf7d0; }
.llmviz-banner-warn    { background: rgba(234,179,8,0.12);  border-color: rgba(253,224,71,0.5);   color: #fde68a; }
.llmviz-banner-err     { background: rgba(239,68,68,0.12);  border-color: rgba(252,165,165,0.5);  color: #fecaca; }
.llmviz-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.llmviz-stat {
  padding: 6px 10px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(71, 85, 105, 0.45);
  border-radius: 6px;
}
.llmviz-stat-label { font-size: 10px; text-transform: uppercase; color: #94a3b8; letter-spacing: 0.4px; }
.llmviz-stat-value { font-size: 14px; font-weight: 700; color: #f1f5f9; margin-top: 2px; }

/* ---- Tokenization ---- */
.llm-tok-input {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(15,23,42,0.55);
  border: 1px solid rgba(71,85,105,0.4);
  border-radius: 6px;
  margin-bottom: 12px;
}
.llm-tok-input-label { font-size: 11px; color: #94a3b8; font-weight: 700; text-transform: uppercase; }
.llm-tok-input-text  { font-size: 16px; font-weight: 700; color: #f1f5f9; font-family: ui-monospace, Menlo, Consolas, monospace; }
.llm-tok-seq {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  padding: 10px;
  background: rgba(15,23,42,0.45);
  border: 1px solid rgba(71,85,105,0.4);
  border-radius: 6px;
  margin-bottom: 12px;
  min-height: 38px;
  overflow-x: auto;
}
.llm-tok-tile {
  min-width: 24px;
  padding: 4px 6px;
  background: rgba(148,163,184,0.18);
  border: 1px solid rgba(148,163,184,0.5);
  border-radius: 4px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 13px;
  font-weight: 600;
  color: #e2e8f0;
  text-align: center;
  transition: all 0.25s;
}
.llm-tok-tile.merged { background: rgba(251,113,133,0.2); border-color: rgba(251,113,133,0.6); color: #fda4af; }
.llm-tok-tile.active {
  background: rgba(34,211,238,0.28);
  border-color: rgba(34,211,238,0.9);
  color: #67e8f9;
  transform: translateY(-3px);
  box-shadow: 0 0 16px rgba(34,211,238,0.5);
}
.llm-tok-mid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
.llm-tok-panel-title { font-size: 11px; text-transform: uppercase; color: #94a3b8; letter-spacing: 0.4px; margin-bottom: 6px; font-weight: 700; }
.llm-tok-rules, .llm-tok-vocab, .llm-tok-ids {
  padding: 10px;
  background: rgba(15,23,42,0.45);
  border: 1px solid rgba(71,85,105,0.4);
  border-radius: 6px;
}
.llm-tok-rule-tbl, .llm-tok-vocab-tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
}
.llm-tok-rule-tbl th, .llm-tok-vocab-tbl th {
  text-align: left;
  padding: 4px 8px;
  color: #94a3b8;
  font-weight: 700;
  font-size: 10.5px;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(71,85,105,0.45);
}
.llm-tok-rule-tbl td, .llm-tok-vocab-tbl td {
  padding: 4px 8px;
  color: #e2e8f0;
  border-bottom: 1px dashed rgba(71,85,105,0.25);
}
.llm-tok-rule-tbl tr.active, .llm-tok-vocab-tbl tr.active {
  background: rgba(34,211,238,0.18);
  color: #67e8f9;
}
.llm-tok-ids-row { display: flex; flex-wrap: nowrap; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.llm-tok-empty { color: #64748b; font-size: 11.5px; font-style: italic; padding: 4px; }
.llm-tok-id-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 5px 9px;
  background: rgba(34,197,94,0.12);
  border: 1px solid rgba(134,239,172,0.55);
  border-radius: 6px;
  min-width: 64px;
}
.llm-tok-id-text { font-size: 12.5px; font-weight: 700; color: #bbf7d0; font-family: ui-monospace, Menlo, Consolas, monospace; }
.llm-tok-id-num  { font-size: 10px; color: #86efac; margin-top: 2px; }

/* ---- Embeddings ---- */
.llm-embed-ids {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  margin-bottom: 12px;
  background: rgba(15,23,42,0.5);
  border: 1px solid rgba(71,85,105,0.4);
  border-radius: 6px;
}
.llm-embed-id-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 8px;
  background: rgba(251,113,133,0.16);
  border: 1px solid rgba(251,113,133,0.55);
  border-radius: 6px;
  min-width: 70px;
}
.llm-embed-id-pos  { font-size: 9.5px; color: #fda4af; text-transform: uppercase; }
.llm-embed-id-text { font-size: 12px;  font-weight: 700; color: #fecaca; font-family: ui-monospace, Menlo, Consolas, monospace; }
.llm-embed-id-num  { font-size: 10px;  color: #fca5a5; }
.llm-embed-panel-title { font-size: 11px; text-transform: uppercase; color: #94a3b8; letter-spacing: 0.4px; margin-bottom: 6px; font-weight: 700; }
.llm-embed-mid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
.llm-embed-matrix, .llm-embed-vectors {
  padding: 10px;
  background: rgba(15,23,42,0.5);
  border: 1px solid rgba(71,85,105,0.4);
  border-radius: 6px;
}
.llm-embed-mtx-tbl { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.llm-embed-mtx-tbl th, .llm-embed-mtx-tbl td {
  padding: 3px 6px;
  border-bottom: 1px dashed rgba(71,85,105,0.25);
  color: #e2e8f0;
}
.llm-embed-mtx-tbl th { color: #94a3b8; text-align: left; font-size: 10.5px; text-transform: uppercase; }
.llm-embed-mtx-tbl tr.active { background: rgba(34,211,238,0.18); color: #67e8f9; }
.llm-embed-vec-row { display: flex; gap: 3px; flex-wrap: nowrap; }
.llm-embed-cell {
  display: inline-block;
  min-width: 36px;
  padding: 2px 4px;
  background: rgba(34,211,238,0.10);
  border: 1px solid rgba(34,211,238,0.35);
  border-radius: 3px;
  text-align: center;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 10.5px;
  color: #bae6fd;
}
.llm-embed-vecs { display: flex; flex-direction: column; gap: 6px; }
.llm-embed-vec {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 4px;
}
.llm-embed-vec.tok { background: rgba(34,211,238,0.10); border: 1px solid rgba(34,211,238,0.35); }
.llm-embed-vec.pos { background: rgba(251,191,36,0.10); border: 1px solid rgba(251,191,36,0.35); }
.llm-embed-vec.fin { background: rgba(34,197,94,0.10);  border: 1px solid rgba(134,239,172,0.45); }
.llm-embed-vec-label { font-size: 10px; color: #cbd5e1; font-weight: 600; min-width: 130px; }
.llm-embed-vec-bars { display: flex; gap: 2px; flex-wrap: nowrap; }
.llm-embed-bar {
  height: 16px;
  padding: 0 4px;
  font-size: 9.5px;
  line-height: 16px;
  color: #fff;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  border-radius: 2px;
  text-align: right;
  white-space: nowrap;
}
.llm-embed-bar.pos { background: rgba(34,211,238,0.7); }
.llm-embed-bar.neg { background: rgba(251,113,133,0.7); }
.llm-embed-empty { color: #64748b; font-size: 11.5px; font-style: italic; padding: 4px; }
.llm-embed-rope { padding: 10px; background: rgba(15,23,42,0.5); border: 1px solid rgba(71,85,105,0.4); border-radius: 6px; }
.llm-embed-rope:empty { display: none; }
.llm-embed-rope-body { display: flex; align-items: center; gap: 16px; padding-top: 6px; }
.llm-embed-rope-side { padding: 6px 10px; background: rgba(34,211,238,0.10); border: 1px solid rgba(34,211,238,0.4); border-radius: 4px; }
.llm-embed-rope-label { font-size: 9.5px; color: #94a3b8; text-transform: uppercase; }
.llm-embed-rope-pair  { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; color: #67e8f9; }
.llm-embed-rope-arrow { font-size: 12px; color: #fbbf24; font-weight: 700; }

/* ---- Self-Attention ---- */
.llm-attn-tokens {
  display: flex;
  gap: 8px;
  padding: 8px 10px;
  margin-bottom: 10px;
  background: rgba(15,23,42,0.5);
  border: 1px solid rgba(71,85,105,0.4);
  border-radius: 6px;
}
.llm-attn-token {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 10px;
  background: rgba(148,163,184,0.15);
  border: 1px solid rgba(148,163,184,0.45);
  border-radius: 5px;
  min-width: 56px;
}
.llm-attn-token-pos { font-size: 10px; color: #94a3b8; text-transform: uppercase; }
.llm-attn-token-text { font-size: 13px; font-weight: 700; color: #f1f5f9; font-family: ui-monospace, Menlo, Consolas, monospace; }
.llm-attn-qkv, .llm-attn-mid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}
.llm-attn-mtx-card {
  padding: 8px;
  background: rgba(15,23,42,0.5);
  border: 1px solid rgba(71,85,105,0.4);
  border-radius: 6px;
}
.llm-attn-mtx-card.q       { border-color: rgba(34,211,238,0.5); }
.llm-attn-mtx-card.k       { border-color: rgba(251,191,36,0.5); }
.llm-attn-mtx-card.v       { border-color: rgba(134,239,172,0.5); }
.llm-attn-mtx-card.scores  { border-color: rgba(251,113,133,0.5); }
.llm-attn-mtx-card.weights { border-color: rgba(251,113,133,0.6); }
.llm-attn-mtx-card.output  { border-color: rgba(168,85,247,0.5); }
.llm-attn-mtx-title { font-size: 10.5px; text-transform: uppercase; color: #94a3b8; font-weight: 700; letter-spacing: 0.4px; margin-bottom: 6px; }
.llm-attn-mtx { display: flex; flex-direction: column; gap: 2px; }
.llm-attn-mtx-empty { color: #64748b; font-size: 11px; font-style: italic; padding: 6px; }
.llm-attn-row { display: flex; gap: 2px; align-items: center; }
.llm-attn-row.dim { opacity: 0.4; }
.llm-attn-rowhdr {
  width: 14px;
  text-align: center;
  font-size: 9.5px;
  color: #94a3b8;
  font-family: ui-monospace, Menlo, Consolas, monospace;
}
.llm-attn-cell {
  flex: 1;
  min-width: 30px;
  padding: 3px 4px;
  text-align: center;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 10px;
  border-radius: 3px;
  background: rgba(148,163,184,0.15);
  border: 1px solid rgba(148,163,184,0.3);
  color: #e2e8f0;
}
.llm-attn-cell.empty   { background: transparent; border-style: dashed; color: #475569; font-size: 9px; }
.llm-attn-cell.masked  { background: rgba(71,85,105,0.5); border-color: rgba(100,116,139,0.6); color: #94a3b8; font-style: italic; }
.llm-attn-cell.hl      { box-shadow: 0 0 0 2px #22d3ee; }
.llm-attn-cell.hl-row  { box-shadow: 0 0 0 1px rgba(251,113,133,0.7); }
.llm-attn-cell.heat-0 { background: rgba(251,113,133,0.05); }
.llm-attn-cell.heat-1 { background: rgba(251,113,133,0.10); }
.llm-attn-cell.heat-2 { background: rgba(251,113,133,0.15); }
.llm-attn-cell.heat-3 { background: rgba(251,113,133,0.22); }
.llm-attn-cell.heat-4 { background: rgba(251,113,133,0.30); }
.llm-attn-cell.heat-5 { background: rgba(251,113,133,0.40); }
.llm-attn-cell.heat-6 { background: rgba(251,113,133,0.55); }
.llm-attn-cell.heat-7 { background: rgba(251,113,133,0.70); }
.llm-attn-cell.heat-8 { background: rgba(251,113,133,0.85); color: #fff; }
.llm-attn-cell.heat-9 { background: rgba(251,113,133,1.00); color: #fff; }
.llm-attn-cell.prob-0 { background: rgba(34,211,238,0.05); }
.llm-attn-cell.prob-1 { background: rgba(34,211,238,0.10); }
.llm-attn-cell.prob-2 { background: rgba(34,211,238,0.20); }
.llm-attn-cell.prob-3 { background: rgba(34,211,238,0.30); }
.llm-attn-cell.prob-4 { background: rgba(34,211,238,0.40); }
.llm-attn-cell.prob-5 { background: rgba(34,211,238,0.55); }
.llm-attn-cell.prob-6 { background: rgba(34,211,238,0.70); }
.llm-attn-cell.prob-7 { background: rgba(34,211,238,0.85); color: #0f172a; }
.llm-attn-cell.prob-8 { background: rgba(34,211,238,0.95); color: #0f172a; }
.llm-attn-cell.prob-9 { background: rgba(34,211,238,1.00); color: #0f172a; font-weight: 700; }

/* ---- Next-Token Prediction ---- */
.llm-next-ctx, .llm-next-pipe, .llm-next-logits {
  margin-bottom: 12px;
  padding: 10px;
  background: rgba(15,23,42,0.5);
  border: 1px solid rgba(71,85,105,0.4);
  border-radius: 6px;
}
.llm-next-panel-title { font-size: 11px; text-transform: uppercase; color: #94a3b8; letter-spacing: 0.4px; margin-bottom: 6px; font-weight: 700; }
.llm-next-ctx-row { display: flex; flex-wrap: nowrap; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.llm-next-tok {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 10px;
  background: rgba(148,163,184,0.15);
  border: 1px solid rgba(148,163,184,0.45);
  border-radius: 5px;
  min-width: 56px;
}
.llm-next-tok.gen { background: rgba(34,197,94,0.15); border-color: rgba(134,239,172,0.55); }
.llm-next-tok-pos  { font-size: 9.5px; color: #94a3b8; }
.llm-next-tok-text { font-size: 13px; font-weight: 700; color: #f1f5f9; font-family: ui-monospace, Menlo, Consolas, monospace; }
.llm-next-tok.gen .llm-next-tok-text { color: #bbf7d0; }
.llm-next-pipe { display: grid; grid-template-columns: 1.2fr 1fr; gap: 10px; padding: 10px; background: transparent; border: none; }
.llm-next-pipe-card {
  padding: 8px 10px;
  background: rgba(15,23,42,0.6);
  border: 1px solid rgba(71,85,105,0.45);
  border-radius: 6px;
}
.llm-next-pipe-title { font-size: 10.5px; text-transform: uppercase; color: #94a3b8; letter-spacing: 0.4px; margin-bottom: 6px; font-weight: 700; }
.llm-next-pipe-progress {
  height: 12px;
  background: rgba(71,85,105,0.45);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 4px;
}
.llm-next-pipe-bar {
  height: 100%;
  background: linear-gradient(90deg, #22d3ee, #34d399);
  width: 0;
  transition: width 0.3s;
}
.llm-next-pipe-counter { font-size: 10.5px; color: #94a3b8; font-family: ui-monospace, Menlo, Consolas, monospace; }
.llm-next-hidden { display: flex; gap: 2px; flex-wrap: nowrap; }
.llm-next-hbar {
  height: 18px;
  padding: 0 4px;
  font-size: 10px;
  line-height: 18px;
  color: #fff;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  border-radius: 2px;
}
.llm-next-hbar.pos { background: rgba(34,211,238,0.7); }
.llm-next-hbar.neg { background: rgba(251,113,133,0.7); }
.llm-next-empty { color: #64748b; font-size: 11px; font-style: italic; padding: 4px; }
.llm-next-logits-body { display: flex; flex-direction: column; gap: 4px; }
.llm-next-logit-row {
  display: grid;
  grid-template-columns: 100px 130px 1fr;
  gap: 8px;
  align-items: center;
  padding: 3px 4px;
  border-radius: 3px;
}
.llm-next-logit-row.picked { background: rgba(251,113,133,0.18); box-shadow: 0 0 0 1px rgba(251,113,133,0.6); }
.llm-next-logit-tok { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11.5px; color: #f1f5f9; font-weight: 600; }
.llm-next-logit-bar {
  height: 16px;
  padding: 0 6px;
  background: linear-gradient(90deg, rgba(34,211,238,0.55), rgba(34,211,238,0.85));
  color: #0f172a;
  font-size: 9.5px;
  line-height: 16px;
  border-radius: 2px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-weight: 600;
  white-space: nowrap;
}
.llm-next-prob-bar {
  height: 16px;
  padding: 0 6px;
  background: linear-gradient(90deg, rgba(251,191,36,0.55), rgba(251,191,36,0.95));
  color: #0f172a;
  font-size: 10px;
  line-height: 16px;
  border-radius: 2px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-weight: 700;
  white-space: nowrap;
}
.llm-next-sampled-title { font-size: 11px; text-transform: uppercase; color: #94a3b8; letter-spacing: 0.4px; margin-bottom: 4px; font-weight: 700; }
.llm-next-sampled-chip {
  display: inline-block;
  padding: 4px 10px;
  background: rgba(251,113,133,0.2);
  border: 1px solid rgba(251,113,133,0.7);
  border-radius: 6px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 13px;
  font-weight: 700;
  color: #fda4af;
}

/* ---- KV Cache ---- */
.llm-kv-tokens, .llm-kv-cache, .llm-kv-cost {
  margin-bottom: 12px;
  padding: 10px;
  background: rgba(15,23,42,0.5);
  border: 1px solid rgba(71,85,105,0.4);
  border-radius: 6px;
}
.llm-kv-panel-title { font-size: 11px; text-transform: uppercase; color: #94a3b8; letter-spacing: 0.4px; margin-bottom: 6px; font-weight: 700; }
.llm-kv-tokens-row { display: flex; flex-wrap: nowrap; gap: 5px; overflow-x: auto; padding-bottom: 4px; }
.llm-kv-tok {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 8px;
  background: rgba(148,163,184,0.15);
  border: 1px solid rgba(148,163,184,0.45);
  border-radius: 5px;
  min-width: 50px;
  transition: all 0.25s;
}
.llm-kv-tok.gen   { background: rgba(34,197,94,0.16);  border-color: rgba(134,239,172,0.55); }
.llm-kv-tok.isnew { box-shadow: 0 0 12px rgba(34,211,238,0.5); border-color: rgba(34,211,238,0.85); }
.llm-kv-tok-pos  { font-size: 9.5px; color: #94a3b8; }
.llm-kv-tok-text { font-size: 12.5px; font-weight: 700; color: #f1f5f9; font-family: ui-monospace, Menlo, Consolas, monospace; }
.llm-kv-tok.gen .llm-kv-tok-text { color: #bbf7d0; }
.llm-kv-cache-body { max-height: 360px; overflow-y: auto; }
.llm-kv-tbl { width: 100%; border-collapse: collapse; font-size: 11px; }
.llm-kv-tbl th, .llm-kv-tbl td {
  padding: 3px 6px;
  text-align: left;
  border-bottom: 1px dashed rgba(71,85,105,0.25);
  color: #e2e8f0;
}
.llm-kv-tbl th { color: #94a3b8; font-size: 10px; text-transform: uppercase; }
.llm-kv-tbl tr.isnew { background: rgba(34,211,238,0.16); }
.llm-kv-vec { display: flex; gap: 2px; flex-wrap: nowrap; }
.llm-kv-cell {
  display: inline-block;
  min-width: 36px;
  padding: 1px 3px;
  background: rgba(34,211,238,0.10);
  border: 1px solid rgba(34,211,238,0.30);
  border-radius: 2px;
  text-align: center;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 10px;
  color: #bae6fd;
}
.llm-kv-cache-note { padding: 12px; border-radius: 6px; font-size: 12.5px; font-weight: 500; }
.llm-kv-cache-note.full  { background: rgba(251,191,36,0.14); border: 1px solid rgba(251,191,36,0.45); color: #fde68a; }
.llm-kv-cache-note.evict { background: rgba(251,113,133,0.16); border: 1px solid rgba(251,113,133,0.5);  color: #fda4af; }
.llm-kv-empty { color: #64748b; font-size: 12px; font-style: italic; padding: 4px; }
.llm-kv-cost { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0; background: transparent; border: none; }
.llm-kv-cost-card {
  padding: 8px 12px;
  background: rgba(15,23,42,0.6);
  border: 1px solid rgba(71,85,105,0.4);
  border-radius: 6px;
}
.llm-kv-cost-card.good  { border-color: rgba(134,239,172,0.55); }
.llm-kv-cost-card.bad   { border-color: rgba(251,113,133,0.55); }
.llm-kv-cost-title { font-size: 10.5px; text-transform: uppercase; color: #94a3b8; font-weight: 700; letter-spacing: 0.4px; margin-bottom: 4px; }
.llm-kv-cost-card.good .llm-kv-cost-title  { color: #86efac; }
.llm-kv-cost-card.bad  .llm-kv-cost-title  { color: #fca5a5; }
.llm-kv-cost-val { font-size: 14px; font-weight: 700; color: #f1f5f9; font-family: ui-monospace, Menlo, Consolas, monospace; }

/* ===================================================================== */
/* AI state-based visualisations (aiviz-* shared + topic-specific)       */
/* ===================================================================== */
.aiviz-zoom-host {
  /* `margin: auto` centres the host on BOTH axes when it fits the stage. When
     the host is bigger than the stage the auto margins collapse to 0, letting
     `align-self: flex-start` anchor it at top-left so the user can scroll the
     overflow naturally. */
  margin: auto;
  align-self: flex-start;
}
.aiviz-host {
  width: max-content;
  min-width: 100%;
  padding: 14px 16px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #e2e8f0;
}
.aiviz-header { margin-bottom: 10px; }
.aiviz-header-title { font-size: 17px; font-weight: 700; color: #f1f5f9; }
.aiviz-header-subtitle { font-size: 12.5px; color: #94a3b8; margin-top: 3px; }
.aiviz-legend {
  display: flex; flex-wrap: wrap; gap: 14px;
  padding: 8px 10px; margin-bottom: 12px;
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(71, 85, 105, 0.45);
  border-radius: 6px;
  font-size: 11.5px; color: #cbd5e1;
}
.aiviz-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.aiviz-legend-dot  { width: 10px; height: 10px; border-radius: 50%; }
.aiviz-banner {
  margin-top: 10px; padding: 8px 12px; border-radius: 6px;
  font-size: 12.5px; font-weight: 500; border: 1px solid;
}
.aiviz-banner-info    { background: rgba(56,189,248,0.10); border-color: rgba(125,211,252,0.45); color: #bae6fd; }
.aiviz-banner-success { background: rgba(34,197,94,0.12);  border-color: rgba(134,239,172,0.5);  color: #bbf7d0; }
.aiviz-banner-warn    { background: rgba(234,179,8,0.12);  border-color: rgba(253,224,71,0.5);   color: #fde68a; }
.aiviz-banner-err     { background: rgba(239,68,68,0.12);  border-color: rgba(252,165,165,0.5);  color: #fecaca; }
.aiviz-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px; margin-top: 10px;
}
.aiviz-stat {
  padding: 6px 10px; background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(71, 85, 105, 0.45); border-radius: 6px;
}
.aiviz-stat-label { font-size: 10px; text-transform: uppercase; color: #94a3b8; letter-spacing: 0.4px; }
.aiviz-stat-value { font-size: 14px; font-weight: 700; color: #f1f5f9; margin-top: 2px; }

/* ---- LLM Inference ---- */
.ai-llm-prompt, .ai-llm-tokens, .ai-llm-pipe, .ai-llm-logits, .ai-llm-output {
  margin-bottom: 10px; padding: 10px;
  background: rgba(15,23,42,0.5);
  border: 1px solid rgba(71,85,105,0.4);
  border-radius: 6px;
}
.ai-llm-panel-title { font-size: 11px; text-transform: uppercase; color: #94a3b8; letter-spacing: 0.4px; margin-bottom: 6px; font-weight: 700; }
.ai-llm-prompt-text { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 14px; color: #f1f5f9; font-weight: 600; }
.ai-llm-tokens-row { display: flex; flex-wrap: nowrap; gap: 5px; overflow-x: auto; padding-bottom: 4px; }
.ai-llm-tok {
  display: flex; flex-direction: column; align-items: center;
  padding: 4px 9px;
  background: rgba(148,163,184,0.15);
  border: 1px solid rgba(148,163,184,0.45);
  border-radius: 5px;
  min-width: 50px;
  transition: all 0.25s;
}
.ai-llm-tok.gen { background: rgba(34,197,94,0.16); border-color: rgba(134,239,172,0.55); }
.ai-llm-tok.current { box-shadow: 0 0 12px rgba(34,211,238,0.5); border-color: rgba(34,211,238,0.85); transform: translateY(-2px); }
.ai-llm-tok-pos  { font-size: 9.5px; color: #94a3b8; }
.ai-llm-tok-text { font-size: 12.5px; font-weight: 700; color: #f1f5f9; font-family: ui-monospace, Menlo, Consolas, monospace; }
.ai-llm-tok.gen .ai-llm-tok-text { color: #bbf7d0; }
.ai-llm-pipe-card { padding: 8px 10px; background: rgba(15,23,42,0.6); border: 1px solid rgba(71,85,105,0.45); border-radius: 6px; }
.ai-llm-pipe-title { font-size: 10.5px; text-transform: uppercase; color: #94a3b8; letter-spacing: 0.4px; margin-bottom: 6px; font-weight: 700; }
.ai-llm-pipe-progress { height: 12px; background: rgba(71,85,105,0.45); border-radius: 6px; overflow: hidden; margin-bottom: 4px; }
.ai-llm-pipe-bar { height: 100%; background: linear-gradient(90deg, #22d3ee, #34d399); width: 0; transition: width 0.3s; }
.ai-llm-pipe-counter { font-size: 10.5px; color: #94a3b8; font-family: ui-monospace, Menlo, Consolas, monospace; }
.ai-llm-logits-body { display: flex; flex-direction: column; gap: 4px; }
.ai-llm-empty { color: #64748b; font-size: 11px; font-style: italic; padding: 4px; }
.ai-llm-logit-row {
  display: grid; grid-template-columns: 140px 1fr;
  gap: 8px; align-items: center;
  padding: 3px 4px; border-radius: 3px;
}
.ai-llm-logit-row.picked { background: rgba(251,113,133,0.18); box-shadow: 0 0 0 1px rgba(251,113,133,0.6); }
.ai-llm-logit-tok { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11.5px; color: #f1f5f9; font-weight: 600; }
.ai-llm-prob-bar {
  height: 16px; padding: 0 6px;
  background: linear-gradient(90deg, rgba(251,191,36,0.55), rgba(251,191,36,0.95));
  color: #0f172a; font-size: 10px; line-height: 16px;
  border-radius: 2px;
  font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 700;
  white-space: nowrap;
}
.ai-llm-output-text {
  padding: 8px 10px; background: rgba(15,23,42,0.6);
  border: 1px solid rgba(34,197,94,0.45); border-radius: 4px;
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px;
  color: #bbf7d0; min-height: 18px;
}

/* ---- RAG Pipeline ---- */
.ai-rag-query, .ai-rag-db, .ai-rag-ctx, .ai-rag-answer {
  margin-bottom: 10px; padding: 10px;
  background: rgba(15,23,42,0.5);
  border: 1px solid rgba(71,85,105,0.4); border-radius: 6px;
}
.ai-rag-panel-title { font-size: 11px; text-transform: uppercase; color: #94a3b8; letter-spacing: 0.4px; margin-bottom: 6px; font-weight: 700; }
.ai-rag-query-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ai-rag-query-text { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13.5px; color: #f1f5f9; font-weight: 600; min-width: 200px; }
.ai-rag-query-vec { display: flex; gap: 2px; flex-wrap: nowrap; }
.ai-rag-qbar {
  height: 16px; padding: 0 4px;
  font-size: 9.5px; line-height: 16px;
  color: #fff;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  border-radius: 2px; text-align: right; white-space: nowrap;
}
.ai-rag-qbar.pos { background: rgba(34,211,238,0.7); }
.ai-rag-qbar.neg { background: rgba(251,113,133,0.7); }
.ai-rag-empty { color: #64748b; font-size: 11px; font-style: italic; }
.ai-rag-db-body { display: flex; flex-direction: column; gap: 4px; max-height: 320px; overflow-y: auto; }
.ai-rag-row {
  display: grid;
  grid-template-columns: 36px 1fr 180px;
  gap: 8px; align-items: center;
  padding: 5px 6px;
  background: rgba(15,23,42,0.6);
  border: 1px solid rgba(71,85,105,0.4);
  border-radius: 4px;
}
.ai-rag-row.hi      { border-color: rgba(251,191,36,0.55); background: rgba(251,191,36,0.06); }
.ai-rag-row.selected{ border-color: rgba(134,239,172,0.7); background: rgba(34,197,94,0.10); box-shadow: 0 0 0 1px rgba(134,239,172,0.4); }
.ai-rag-row-id { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11px; color: #94a3b8; font-weight: 700; text-align: center; }
.ai-rag-row.selected .ai-rag-row-id { color: #bbf7d0; }
.ai-rag-row-title { font-size: 12px; font-weight: 700; color: #f1f5f9; }
.ai-rag-row-snippet { font-size: 11px; color: #94a3b8; margin-top: 2px; }
.ai-rag-score-bar {
  height: 16px; padding: 0 6px;
  color: #0f172a; font-size: 10px; line-height: 16px;
  border-radius: 2px;
  font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 700;
  text-align: center;
}
.ai-rag-score-bar.hi  { background: linear-gradient(90deg, rgba(251,191,36,0.7), rgba(251,191,36,1)); }
.ai-rag-score-bar.mid { background: linear-gradient(90deg, rgba(125,211,252,0.7), rgba(125,211,252,1)); color: #0f172a; }
.ai-rag-score-bar.lo  { background: rgba(71,85,105,0.6); color: #cbd5e1; }
.ai-rag-ctx-pre {
  margin: 0; padding: 8px 10px;
  background: rgba(15,23,42,0.6);
  border: 1px solid rgba(134,239,172,0.45);
  border-radius: 4px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 11.5px; color: #bbf7d0;
  white-space: pre-wrap; word-break: break-word;
  max-height: 200px; overflow-y: auto;
}
.ai-rag-answer-text {
  padding: 8px 10px; background: rgba(15,23,42,0.6);
  border: 1px solid rgba(71,85,105,0.4); border-radius: 4px;
  font-size: 13px; color: #f1f5f9; line-height: 1.5;
}
.ai-rag-cite {
  display: inline-block; margin: 0 2px;
  padding: 0 4px;
  background: rgba(251,113,133,0.2);
  border: 1px solid rgba(251,113,133,0.5);
  border-radius: 3px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 10.5px; color: #fda4af; font-weight: 700;
}
.ai-rag-cite-strip {
  margin-top: 6px;
  padding: 4px 8px;
  font-size: 10.5px; color: #94a3b8;
}

/* ---- Agent Loop ---- */
.ai-agent-goal, .ai-agent-two, .ai-agent-side { padding: 10px; background: rgba(15,23,42,0.5); border: 1px solid rgba(71,85,105,0.4); border-radius: 6px; margin-bottom: 10px; }
.ai-agent-two { display: grid; grid-template-columns: 1.4fr 1fr; gap: 10px; background: transparent; border: none; padding: 0; }
.ai-agent-panel-title { font-size: 11px; text-transform: uppercase; color: #94a3b8; letter-spacing: 0.4px; margin-bottom: 6px; font-weight: 700; }
.ai-agent-goal-text { font-size: 13.5px; color: #f1f5f9; font-weight: 600; }
.ai-agent-scratch { display: flex; flex-direction: column; gap: 6px; max-height: 360px; overflow-y: auto; }
.ai-agent-entry {
  padding: 5px 8px;
  border: 1px solid;
  border-radius: 4px;
}
.ai-agent-entry.thought     { background: rgba(34,211,238,0.10);  border-color: rgba(34,211,238,0.4); }
.ai-agent-entry.action      { background: rgba(251,191,36,0.10);  border-color: rgba(251,191,36,0.45); }
.ai-agent-entry.observation { background: rgba(34,197,94,0.10);   border-color: rgba(134,239,172,0.45); }
.ai-agent-entry.final       { background: rgba(251,113,133,0.14); border-color: rgba(251,113,133,0.6); }
.ai-agent-entry-hdr { display: flex; gap: 6px; margin-bottom: 2px; font-size: 9.5px; text-transform: uppercase; font-weight: 700; letter-spacing: 0.4px; }
.ai-agent-entry-iter { color: #94a3b8; }
.ai-agent-entry.thought      .ai-agent-entry-kind { color: #67e8f9; }
.ai-agent-entry.action       .ai-agent-entry-kind { color: #fbbf24; }
.ai-agent-entry.observation  .ai-agent-entry-kind { color: #86efac; }
.ai-agent-entry.final        .ai-agent-entry-kind { color: #fda4af; }
.ai-agent-entry-text {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 11.5px; color: #e2e8f0;
  word-break: break-word;
}
.ai-agent-empty { color: #64748b; font-size: 11px; font-style: italic; padding: 4px; }
.ai-agent-tools { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; }
.ai-agent-tool {
  padding: 5px 8px;
  background: rgba(15,23,42,0.6);
  border: 1px solid rgba(71,85,105,0.4); border-radius: 4px;
}
.ai-agent-tool-name { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; font-weight: 700; color: #fbbf24; }
.ai-agent-tool-desc { font-size: 10.5px; color: #94a3b8; }
.ai-agent-tool-calls { font-size: 10.5px; color: #67e8f9; margin-top: 2px; }
.ai-agent-final {
  margin-top: 8px;
  padding: 10px;
  background: rgba(251,113,133,0.14);
  border: 1px solid rgba(251,113,133,0.55);
  border-radius: 6px;
}
.ai-agent-final-text { font-size: 13px; color: #fecaca; font-weight: 600; line-height: 1.5; }

/* ===================================================================== */
/* LLM upgrades (MHA, Transformer Block, Softmax, Sampling, Flash Attn)  */
/* ===================================================================== */

/* ---- Multi-Head Attention (llm-mha) ---- */
.llm-mha-tokens { display: flex; gap: 6px; flex-wrap: nowrap; padding: 8px 0; }
.llm-mha-tok { min-width: 52px; padding: 6px 8px; border-radius: 6px; background: rgba(125,211,252,0.10); border: 1px solid rgba(125,211,252,0.45); text-align: center; }
.llm-mha-tok-pos { font-size: 10px; color: #94a3b8; }
.llm-mha-tok-text { font-size: 13px; color: #e0f2fe; font-weight: 600; }
.llm-mha-heads { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 8px 0; }
.llm-mha-head { padding: 10px; border-radius: 8px; background: rgba(30,41,59,0.55); border: 1px solid rgba(148,163,184,0.30); transition: transform 220ms, box-shadow 220ms, border 220ms; }
.llm-mha-head.computed { border-color: var(--head-c, #475569); background: rgba(30,41,59,0.85); }
.llm-mha-head.active { transform: translateY(-2px); box-shadow: 0 6px 20px -8px var(--head-c, #94a3b8); }
.llm-mha-head-title { font-size: 12px; font-weight: 700; color: var(--head-c, #e2e8f0); margin-bottom: 6px; }
.llm-mha-head-peak { font-size: 11px; color: #cbd5e1; }
.llm-mha-head-peak.idle { color: #475569; font-style: italic; }
.llm-mha-concat, .llm-mha-proj { margin-top: 12px; padding: 10px; background: rgba(167,139,250,0.10); border: 1px solid rgba(167,139,250,0.35); border-radius: 8px; }
.llm-mha-panel-title { font-size: 11px; color: #c4b5fd; font-weight: 700; margin-bottom: 6px; letter-spacing: 0.4px; text-transform: uppercase; }
.llm-mha-mtx { display: flex; flex-direction: column; gap: 2px; }
.llm-mha-mtx-empty { font-size: 11px; color: #64748b; font-style: italic; padding: 8px; }
.llm-mha-row { display: flex; gap: 2px; align-items: center; }
.llm-mha-rowhdr { font-size: 10px; color: #94a3b8; width: 18px; text-align: right; }
.llm-mha-cell { display: inline-block; min-width: 36px; padding: 3px 4px; text-align: center; font-size: 10px; color: #e2e8f0; background: rgba(167,139,250,0.18); border-radius: 3px; }

/* ---- Transformer Block (llm-block) ---- */
.llm-block-info { display: flex; gap: 6px; flex-wrap: nowrap; margin: 4px 0 8px 0; }
.llm-block-info-pill { font-size: 11px; padding: 3px 8px; background: rgba(110,231,183,0.14); border: 1px solid rgba(110,231,183,0.40); color: #d1fae5; border-radius: 12px; }
.llm-block-pipe { display: flex; align-items: center; gap: 4px; flex-wrap: nowrap; overflow-x: auto; padding: 6px 0; }
.llm-block-node { min-width: 100px; padding: 8px 10px; border-radius: 8px; background: rgba(30,41,59,0.55); border: 1px solid rgba(148,163,184,0.30); transition: transform 220ms, border 220ms; }
.llm-block-node.active { border-color: #22d3ee; background: rgba(34,211,238,0.14); transform: translateY(-2px); }
.llm-block-node-label { font-size: 11px; color: #e2e8f0; font-weight: 600; }
.llm-block-node-norm { font-size: 10px; color: #94a3b8; margin-top: 2px; font-family: ui-monospace, monospace; }
.llm-block-arrow { font-size: 18px; color: #475569; padding: 0 4px; }
.llm-block-arrow.from { color: #22d3ee; }
.llm-block-arrow.to { color: #34d399; }
.llm-block-skips { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.llm-block-skip { padding: 10px; background: rgba(167,139,250,0.08); border: 1px dashed rgba(167,139,250,0.40); border-radius: 8px; }
.llm-block-skip-title { font-size: 11px; color: #c4b5fd; margin-bottom: 4px; }
.llm-block-skip-state { font-size: 12px; color: #94a3b8; font-weight: 600; }
.llm-block-skip-state.on { color: #6ee7b7; }

/* ---- Softmax & Temperature (llm-soft) ---- */
.llm-soft-info { display: flex; gap: 6px; flex-wrap: nowrap; margin: 4px 0 8px 0; }
.llm-soft-info-pill { font-size: 11px; padding: 3px 8px; background: rgba(253,186,116,0.14); border: 1px solid rgba(253,186,116,0.40); color: #fed7aa; border-radius: 12px; }
.llm-soft-tbl { background: rgba(30,41,59,0.40); border: 1px solid rgba(148,163,184,0.20); border-radius: 8px; overflow: hidden; }
.llm-soft-thead { display: grid; grid-template-columns: 90px 80px 100px 100px 1fr; gap: 8px; padding: 8px 12px; background: rgba(148,163,184,0.10); font-size: 10px; color: #cbd5e1; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; }
.llm-soft-tbody { display: flex; flex-direction: column; }
.llm-soft-row { display: grid; grid-template-columns: 90px 80px 100px 100px 1fr; gap: 8px; padding: 8px 12px; align-items: center; border-top: 1px solid rgba(148,163,184,0.10); font-size: 12px; color: #e2e8f0; transition: background 200ms; }
.llm-soft-row.top { background: rgba(251,113,133,0.12); }
.llm-soft-tok { font-family: ui-monospace, monospace; color: #fbbf24; }
.llm-soft-logit, .llm-soft-scaled, .llm-soft-exp { font-family: ui-monospace, monospace; color: #cbd5e1; }
.llm-soft-prob { display: flex; align-items: center; gap: 8px; position: relative; height: 16px; }
.llm-soft-bar { background: linear-gradient(90deg, #34d399, #6ee7b7); height: 8px; border-radius: 4px; transition: width 360ms; }
.llm-soft-prob span { font-size: 11px; color: #d1fae5; font-family: ui-monospace, monospace; }

/* ---- Sampling Strategies (llm-sample) ---- */
.llm-sample-info { display: flex; gap: 6px; flex-wrap: nowrap; margin: 4px 0 8px 0; }
.llm-sample-info-pill { font-size: 11px; padding: 3px 8px; background: rgba(129,140,248,0.14); border: 1px solid rgba(129,140,248,0.40); color: #c7d2fe; border-radius: 12px; }
.llm-sample-tbl { background: rgba(30,41,59,0.40); border: 1px solid rgba(148,163,184,0.20); border-radius: 8px; overflow: hidden; }
.llm-sample-thead { display: grid; grid-template-columns: 90px 1fr 70px 100px; gap: 8px; padding: 8px 12px; background: rgba(148,163,184,0.10); font-size: 10px; color: #cbd5e1; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; }
.llm-sample-row { display: grid; grid-template-columns: 90px 1fr 70px 100px; gap: 8px; padding: 8px 12px; align-items: center; border-top: 1px solid rgba(148,163,184,0.10); font-size: 12px; color: #e2e8f0; transition: background 200ms; }
.llm-sample-row.kept { background: rgba(52,211,153,0.10); }
.llm-sample-row.cut { background: rgba(251,113,133,0.10); color: #94a3b8; opacity: 0.7; }
.llm-sample-row.sampled { background: rgba(251,191,36,0.16); }
.llm-sample-row.picked { background: rgba(251,113,133,0.18); }
.llm-sample-tok { font-family: ui-monospace, monospace; color: #fbbf24; }
.llm-sample-prob { display: flex; align-items: center; gap: 8px; height: 16px; }
.llm-sample-bar { background: linear-gradient(90deg, #34d399, #6ee7b7); height: 8px; border-radius: 4px; transition: width 360ms; }
.llm-sample-prob span { font-size: 11px; color: #d1fae5; font-family: ui-monospace, monospace; }
.llm-sample-cum { font-size: 11px; color: #cbd5e1; font-family: ui-monospace, monospace; }
.llm-sample-status { font-size: 10px; color: #cbd5e1; text-transform: uppercase; letter-spacing: 0.4px; }
.llm-sample-beams { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.llm-sample-beams-title { font-size: 11px; color: #c4b5fd; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 4px; }
.llm-sample-beam { display: grid; grid-template-columns: 50px 1fr 80px; gap: 10px; align-items: center; padding: 8px 12px; background: rgba(167,139,250,0.10); border: 1px solid rgba(167,139,250,0.40); border-radius: 6px; }
.llm-sample-beam.active { border-color: #a78bfa; background: rgba(167,139,250,0.20); }
.llm-sample-beam.done { background: rgba(110,231,183,0.16); border-color: rgba(110,231,183,0.50); }
.llm-sample-beam-idx { font-size: 11px; color: #c4b5fd; font-weight: 700; }
.llm-sample-beam-tokens { font-family: ui-monospace, monospace; color: #e0e7ff; font-size: 12px; }
.llm-sample-beam-lp { font-family: ui-monospace, monospace; color: #cbd5e1; font-size: 11px; text-align: right; }

/* ---- Flash Attention (llm-flash) ---- */
.llm-flash-mem { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 4px 0 12px 0; }
.llm-flash-mem-card { padding: 10px; border-radius: 8px; }
.llm-flash-mem-card.hbm { background: rgba(251,113,133,0.10); border: 1px solid rgba(251,113,133,0.40); }
.llm-flash-mem-card.sram { background: rgba(34,211,238,0.10); border: 1px solid rgba(34,211,238,0.40); }
.llm-flash-mem-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; }
.llm-flash-mem-card.hbm .llm-flash-mem-title { color: #fb7185; }
.llm-flash-mem-card.sram .llm-flash-mem-title { color: #22d3ee; }
.llm-flash-mem-val { font-size: 12px; color: #e2e8f0; margin-top: 4px; font-family: ui-monospace, monospace; }
.llm-flash-grid { display: grid; gap: 1px; padding: 4px; background: rgba(30,41,59,0.35); border: 1px solid rgba(148,163,184,0.20); border-radius: 6px; margin-bottom: 10px; }
.llm-flash-cell { width: 100%; height: 22px; background: rgba(148,163,184,0.06); border-radius: 2px; transition: background 200ms; }
.llm-flash-cell.hbm { background: rgba(251,113,133,0.35); }
.llm-flash-cell.tile { background: rgba(34,211,238,0.55); box-shadow: 0 0 6px rgba(34,211,238,0.50); }
.llm-flash-cell.done { background: rgba(52,211,153,0.30); }
.llm-flash-stats-row { padding: 10px; background: rgba(251,191,36,0.08); border: 1px solid rgba(251,191,36,0.35); border-radius: 8px; }
.llm-flash-stats-title { font-size: 11px; color: #fbbf24; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 6px; }
.llm-flash-stat-row { display: grid; grid-template-columns: 70px 1fr 1fr; gap: 12px; padding: 4px 0; border-top: 1px solid rgba(251,191,36,0.20); font-size: 11px; color: #e2e8f0; font-family: ui-monospace, monospace; }
.llm-flash-stat-idx { color: #fbbf24; font-weight: 600; }
.llm-flash-stats-empty { font-size: 11px; color: #94a3b8; font-style: italic; }

@media (max-width: 720px) {
  .llm-mha-heads { grid-template-columns: repeat(2, 1fr); }
  .llm-block-skips { grid-template-columns: 1fr; }
  .llm-soft-thead, .llm-soft-row { grid-template-columns: 70px 60px 80px 80px 1fr; font-size: 11px; }
  .llm-sample-thead, .llm-sample-row { grid-template-columns: 60px 1fr 50px 80px; font-size: 11px; }
}

/* =================================================================== */
/* AI: state-based topics - MCP, Fine-Tuning, CoT, Tool Use, HNSW, PE  */
/* =================================================================== */

/* ---- ai-mcp ---- */
.ai-mcp-pipe { display: flex; align-items: center; gap: 6px; padding: 12px; background: rgba(15,23,42,0.6); border: 1px solid rgba(103,232,249,0.25); border-radius: 8px; }
.ai-mcp-node { display: flex; flex-direction: column; align-items: center; padding: 8px 10px; background: rgba(30,41,59,0.7); border: 1px solid rgba(148,163,184,0.3); border-radius: 8px; min-width: 88px; transition: all 0.3s ease; }
.ai-mcp-node.active { border-color: #22d3ee; background: rgba(34,211,238,0.16); box-shadow: 0 0 0 2px rgba(34,211,238,0.18); }
.ai-mcp-node-icon { width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(180deg,#67e8f9,#0e7490); color: #0f172a; font-weight: 800; display: flex; align-items: center; justify-content: center; font-size: 13px; }
.ai-mcp-node-label { font-size: 11px; color: #e2e8f0; margin-top: 6px; font-weight: 600; }
.ai-mcp-arrow { color: #64748b; font-size: 18px; font-weight: 700; padding: 0 2px; }
.ai-mcp-edge { margin-top: 10px; }
.ai-mcp-edge-card { padding: 8px 10px; border-radius: 8px; border: 1px solid rgba(148,163,184,0.3); background: rgba(15,23,42,0.5); display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12px; color: #cbd5e1; }
.ai-mcp-edge-card.req { border-color: #22d3ee; background: rgba(34,211,238,0.10); }
.ai-mcp-edge-card.resp { border-color: #34d399; background: rgba(52,211,153,0.10); }
.ai-mcp-edge-card.event { border-color: #a78bfa; background: rgba(167,139,250,0.10); }
.ai-mcp-edge-from, .ai-mcp-edge-to { color: #fbbf24; font-weight: 700; font-family: ui-monospace, monospace; font-size: 11px; }
.ai-mcp-edge-arrow { color: #94a3b8; font-weight: 700; }
.ai-mcp-edge-label { margin: 0; padding: 6px 8px; background: rgba(15,23,42,0.7); border-radius: 6px; color: #e2e8f0; font-family: ui-monospace, monospace; font-size: 10.5px; white-space: pre-wrap; flex: 1; min-width: 200px; max-width: 100%; }
.ai-mcp-edge-empty { padding: 8px 10px; color: #94a3b8; font-size: 11px; font-style: italic; border: 1px dashed rgba(148,163,184,0.25); border-radius: 8px; }
.ai-mcp-caps { margin-top: 10px; padding: 10px 12px; background: rgba(15,23,42,0.55); border: 1px solid rgba(103,232,249,0.18); border-radius: 8px; }
.ai-mcp-panel-title { font-size: 11px; font-weight: 700; color: #67e8f9; letter-spacing: 0.5px; text-transform: uppercase; margin-bottom: 6px; }
.ai-mcp-caps-body { display: flex; flex-direction: column; gap: 4px; }
.ai-mcp-cap { display: flex; gap: 10px; padding: 4px 8px; border-radius: 6px; background: rgba(30,41,59,0.5); font-size: 11.5px; }
.ai-mcp-cap.hl { background: rgba(34,211,238,0.16); border: 1px solid #22d3ee; }
.ai-mcp-cap-name { color: #fbbf24; font-weight: 700; font-family: ui-monospace, monospace; min-width: 90px; }
.ai-mcp-cap-val { color: #cbd5e1; font-family: ui-monospace, monospace; }
.ai-mcp-log { margin-top: 10px; padding: 10px 12px; background: rgba(15,23,42,0.55); border: 1px solid rgba(103,232,249,0.18); border-radius: 8px; }
.ai-mcp-log-body { display: flex; flex-direction: column; gap: 4px; max-height: 220px; overflow: auto; }
.ai-mcp-log-row { display: flex; align-items: flex-start; gap: 8px; padding: 4px 6px; border-radius: 6px; background: rgba(30,41,59,0.5); }
.ai-mcp-log-row.req { border-left: 3px solid #22d3ee; }
.ai-mcp-log-row.resp { border-left: 3px solid #34d399; }
.ai-mcp-log-dir { color: #fbbf24; font-weight: 800; font-family: ui-monospace, monospace; padding-top: 2px; }
.ai-mcp-log-json { margin: 0; flex: 1; color: #e2e8f0; font-family: ui-monospace, monospace; font-size: 10.5px; white-space: pre-wrap; word-break: break-word; }
.ai-mcp-log-empty { padding: 6px; color: #94a3b8; font-size: 11px; font-style: italic; }

/* ---- ai-ft ---- */
.ai-ft-params { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px; background: rgba(15,23,42,0.6); border: 1px solid rgba(134,239,172,0.25); border-radius: 8px; }
.ai-ft-param-pill { padding: 3px 8px; border-radius: 999px; background: rgba(52,211,153,0.14); border: 1px solid rgba(52,211,153,0.35); color: #d1fae5; font-size: 11px; font-family: ui-monospace, monospace; }
.ai-ft-param-pill b { color: #6ee7b7; margin-right: 4px; }
.ai-ft-data, .ai-ft-model, .ai-ft-curve { margin-top: 10px; padding: 10px 12px; background: rgba(15,23,42,0.55); border: 1px solid rgba(134,239,172,0.18); border-radius: 8px; }
.ai-ft-panel-title { font-size: 11px; font-weight: 700; color: #86efac; letter-spacing: 0.5px; text-transform: uppercase; margin-bottom: 6px; }
.ai-ft-data-body { display: flex; flex-direction: column; gap: 3px; }
.ai-ft-row { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-radius: 6px; background: rgba(30,41,59,0.55); font-size: 11px; transition: all 0.25s ease; }
.ai-ft-row.taken { background: rgba(34,211,238,0.15); border: 1px solid #22d3ee; }
.ai-ft-row-idx { color: #fbbf24; font-weight: 700; font-family: ui-monospace, monospace; min-width: 24px; }
.ai-ft-row-prompt { color: #cbd5e1; flex: 1; }
.ai-ft-row-arrow { color: #64748b; font-weight: 700; }
.ai-ft-row-completion { color: #86efac; flex: 1; font-style: italic; }
.ai-ft-model-body { display: flex; flex-wrap: wrap; gap: 8px; }
.ai-ft-block { padding: 6px 12px; border-radius: 8px; font-size: 11px; font-weight: 600; }
.ai-ft-block.base { background: rgba(148,163,184,0.18); color: #cbd5e1; border: 1px solid rgba(148,163,184,0.35); }
.ai-ft-block.base.frozen { background: rgba(96,165,250,0.18); border-color: #60a5fa; color: #bfdbfe; }
.ai-ft-block.adapter { background: rgba(251,191,36,0.18); border: 1px solid #fbbf24; color: #fde68a; }
.ai-ft-fwd, .ai-ft-grads, .ai-ft-opt { font-size: 11.5px; color: #cbd5e1; padding: 4px 0; font-family: ui-monospace, monospace; }
.ai-ft-fwd-line b, .ai-ft-grads b, .ai-ft-opt b { color: #6ee7b7; margin-right: 6px; }
.ai-ft-fwd-empty { color: #64748b; font-style: italic; }
.ai-ft-curve-body { display: flex; flex-direction: column; gap: 3px; }
.ai-ft-curve-row { display: grid; grid-template-columns: 60px 1fr 60px 1fr 60px; align-items: center; gap: 6px; font-size: 10.5px; font-family: ui-monospace, monospace; }
.ai-ft-curve-step { color: #94a3b8; }
.ai-ft-curve-bar { height: 8px; background: rgba(30,41,59,0.6); border-radius: 4px; overflow: hidden; }
.ai-ft-curve-train { height: 100%; background: linear-gradient(90deg,#22d3ee,#0ea5e9); }
.ai-ft-curve-val { height: 100%; background: linear-gradient(90deg,#fb7185,#e11d48); }
.ai-ft-curve-val-train { color: #22d3ee; text-align: right; }
.ai-ft-curve-val-val { color: #fb7185; text-align: right; }
.ai-ft-curve-empty { font-size: 11px; color: #94a3b8; font-style: italic; }

/* ---- ai-cot ---- */
.ai-cot-prob { padding: 10px 12px; background: rgba(15,23,42,0.6); border: 1px solid rgba(252,211,77,0.3); border-radius: 8px; display: flex; flex-direction: column; gap: 4px; }
.ai-cot-prob-label { font-size: 10px; font-weight: 700; color: #fcd34d; text-transform: uppercase; letter-spacing: 0.5px; }
.ai-cot-prob-text { font-size: 13px; color: #e2e8f0; font-weight: 500; }
.ai-cot-steps, .ai-cot-samples, .ai-cot-final { margin-top: 10px; }
.ai-cot-steps { padding: 10px 12px; background: rgba(15,23,42,0.55); border: 1px solid rgba(252,211,77,0.18); border-radius: 8px; }
.ai-cot-panel-title { font-size: 11px; font-weight: 700; color: #fcd34d; letter-spacing: 0.5px; text-transform: uppercase; margin-bottom: 6px; }
.ai-cot-steps-body { display: flex; flex-direction: column; gap: 4px; }
.ai-cot-step { display: flex; gap: 10px; padding: 6px 10px; border-radius: 8px; background: rgba(30,41,59,0.55); border: 1px solid rgba(148,163,184,0.2); font-size: 12px; color: #e2e8f0; transition: all 0.25s ease; }
.ai-cot-step.active { border-color: #22d3ee; background: rgba(34,211,238,0.14); }
.ai-cot-step.answer { border-color: #34d399; background: rgba(52,211,153,0.14); color: #d1fae5; font-weight: 600; }
.ai-cot-step.wrong { border-color: #fb7185; background: rgba(251,113,133,0.14); color: #fecaca; }
.ai-cot-step-idx { color: #fbbf24; font-weight: 700; min-width: 18px; font-family: ui-monospace, monospace; }
.ai-cot-step-text { flex: 1; }
.ai-cot-empty { font-size: 11px; color: #94a3b8; font-style: italic; padding: 4px 0; }
.ai-cot-samples { padding: 10px 12px; background: rgba(15,23,42,0.55); border: 1px solid rgba(252,211,77,0.18); border-radius: 8px; }
.ai-cot-samples-body { display: flex; flex-direction: column; gap: 4px; }
.ai-cot-sample { display: grid; grid-template-columns: 80px 1fr 90px; align-items: center; gap: 8px; padding: 4px 0; font-size: 11.5px; }
.ai-cot-sample-ans { color: #e2e8f0; font-weight: 700; font-family: ui-monospace, monospace; }
.ai-cot-sample-bar { height: 8px; background: rgba(30,41,59,0.6); border-radius: 4px; overflow: hidden; }
.ai-cot-sample-bar > div { height: 100%; background: linear-gradient(90deg,#fcd34d,#fbbf24); }
.ai-cot-sample-count { color: #94a3b8; font-family: ui-monospace, monospace; font-size: 10.5px; text-align: right; }
.ai-cot-final-card { display: inline-flex; align-items: center; gap: 10px; padding: 8px 14px; border-radius: 999px; font-size: 12.5px; font-weight: 600; }
.ai-cot-final-card.ok { background: rgba(52,211,153,0.18); border: 1px solid #34d399; color: #d1fae5; }
.ai-cot-final-card.bad { background: rgba(251,113,133,0.18); border: 1px solid #fb7185; color: #fecaca; }
.ai-cot-final-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; color: #94a3b8; }
.ai-cot-final-val { font-family: ui-monospace, monospace; font-size: 14px; font-weight: 800; }
.ai-cot-final-tag { font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; }

/* ---- ai-tool ---- */
.ai-tool-tools { padding: 10px 12px; background: rgba(15,23,42,0.55); border: 1px solid rgba(165,180,252,0.25); border-radius: 8px; }
.ai-tool-panel-title { font-size: 11px; font-weight: 700; color: #a5b4fc; letter-spacing: 0.5px; text-transform: uppercase; margin-bottom: 6px; }
.ai-tool-tools-body { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 6px; }
.ai-tool-tool { padding: 6px 10px; border-radius: 8px; background: rgba(30,41,59,0.55); border: 1px solid rgba(148,163,184,0.25); }
.ai-tool-tool.selected { border-color: #fbbf24; background: rgba(251,191,36,0.15); box-shadow: 0 0 0 2px rgba(251,191,36,0.15); }
.ai-tool-tool-name { font-size: 12px; font-weight: 700; color: #e2e8f0; font-family: ui-monospace, monospace; }
.ai-tool-tool-desc { font-size: 11px; color: #94a3b8; margin-top: 2px; }
.ai-tool-tool-schema { font-size: 10.5px; color: #a5b4fc; font-family: ui-monospace, monospace; margin-top: 2px; }
.ai-tool-chat { margin-top: 10px; padding: 10px 12px; background: rgba(15,23,42,0.55); border: 1px solid rgba(165,180,252,0.18); border-radius: 8px; }
.ai-tool-chat-body { display: flex; flex-direction: column; gap: 6px; max-height: 300px; overflow: auto; }
.ai-tool-msg { padding: 6px 10px; border-radius: 8px; background: rgba(30,41,59,0.55); border-left: 3px solid #64748b; display: flex; flex-direction: column; gap: 3px; }
.ai-tool-msg.user { border-left-color: #94a3b8; }
.ai-tool-msg.assistant { border-left-color: #22d3ee; }
.ai-tool-msg.assistant.tool-call { border-left-color: #fbbf24; background: rgba(251,191,36,0.10); }
.ai-tool-msg.tool { border-left-color: #34d399; background: rgba(52,211,153,0.10); }
.ai-tool-msg-role { font-size: 10px; font-weight: 700; color: #fbbf24; text-transform: uppercase; letter-spacing: 0.5px; font-family: ui-monospace, monospace; }
.ai-tool-msg-cid { font-size: 9.5px; color: #94a3b8; font-family: ui-monospace, monospace; align-self: flex-start; padding: 1px 5px; border-radius: 4px; background: rgba(15,23,42,0.6); }
.ai-tool-msg-content { margin: 0; font-size: 11.5px; color: #e2e8f0; font-family: ui-monospace, monospace; white-space: pre-wrap; word-break: break-word; }
.ai-tool-empty { font-size: 11px; color: #94a3b8; font-style: italic; padding: 6px; }

/* ---- ai-vec ---- */
.ai-vec-layers { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; background: rgba(15,23,42,0.55); border: 1px solid rgba(240,171,252,0.22); border-radius: 8px; }
.ai-vec-layer { display: flex; align-items: center; gap: 8px; }
.ai-vec-layer-label { min-width: 130px; font-size: 11px; font-weight: 700; color: #f0abfc; font-family: ui-monospace, monospace; }
.ai-vec-svg { flex: 1; min-width: 320px; max-width: 100%; height: 100px; background: rgba(30,41,59,0.5); border-radius: 6px; border: 1px solid rgba(148,163,184,0.15); }
.ai-vec-topk { margin-top: 10px; padding: 10px 12px; background: rgba(15,23,42,0.55); border: 1px solid rgba(240,171,252,0.18); border-radius: 8px; }
.ai-vec-panel-title { font-size: 11px; font-weight: 700; color: #f0abfc; letter-spacing: 0.5px; text-transform: uppercase; margin-bottom: 6px; }
.ai-vec-topk-body { display: flex; flex-direction: column; gap: 3px; }
.ai-vec-topk-row { display: flex; gap: 12px; padding: 4px 8px; border-radius: 6px; background: rgba(30,41,59,0.55); font-size: 11.5px; font-family: ui-monospace, monospace; }
.ai-vec-topk-rank { color: #fbbf24; font-weight: 700; min-width: 32px; }
.ai-vec-topk-id { color: #e2e8f0; font-weight: 700; min-width: 32px; }
.ai-vec-topk-dist { color: #94a3b8; }
.ai-vec-empty { font-size: 11px; color: #94a3b8; font-style: italic; }

/* ---- ai-pe ---- */
.ai-pe-task { padding: 10px 12px; background: rgba(15,23,42,0.6); border: 1px solid rgba(251,113,133,0.28); border-radius: 8px; display: grid; grid-template-columns: 60px 1fr; gap: 6px 10px; align-items: center; }
.ai-pe-task-label { font-size: 10px; font-weight: 700; color: #fb7185; text-transform: uppercase; letter-spacing: 0.5px; }
.ai-pe-task-text { font-size: 12px; color: #e2e8f0; }
.ai-pe-task-text.input { color: #fcd34d; font-style: italic; font-family: ui-monospace, monospace; font-size: 11.5px; }
.ai-pe-prompt, .ai-pe-out { margin-top: 10px; padding: 10px 12px; background: rgba(15,23,42,0.55); border: 1px solid rgba(251,113,133,0.18); border-radius: 8px; }
.ai-pe-panel-title { font-size: 11px; font-weight: 700; color: #fb7185; letter-spacing: 0.5px; text-transform: uppercase; margin-bottom: 6px; }
.ai-pe-prompt-body { display: flex; flex-direction: column; gap: 4px; }
.ai-pe-part { display: flex; align-items: flex-start; gap: 8px; padding: 5px 10px; border-radius: 8px; background: rgba(30,41,59,0.55); border-left: 3px solid #64748b; font-size: 11.5px; transition: all 0.25s ease; }
.ai-pe-part.instr { border-left-color: #22d3ee; }
.ai-pe-part.ex { border-left-color: #fbbf24; }
.ai-pe-part.schema { border-left-color: #fbbf24; background: rgba(251,191,36,0.08); }
.ai-pe-part.role { border-left-color: #a78bfa; background: rgba(167,139,250,0.08); }
.ai-pe-part.input { border-left-color: #f0abfc; }
.ai-pe-part.active { box-shadow: 0 0 0 2px rgba(34,211,238,0.20); }
.ai-pe-part-tag { font-size: 10px; font-weight: 700; color: #fbbf24; text-transform: uppercase; letter-spacing: 0.5px; min-width: 56px; padding-top: 1px; font-family: ui-monospace, monospace; }
.ai-pe-part-text { flex: 1; color: #e2e8f0; word-break: break-word; }
.ai-pe-out-card { padding: 8px 12px; border-radius: 8px; }
.ai-pe-out-card.valid { background: rgba(52,211,153,0.14); border: 1px solid #34d399; }
.ai-pe-out-card.invalid { background: rgba(251,191,36,0.10); border: 1px dashed #fbbf24; }
.ai-pe-out-card pre { margin: 0; font-size: 11.5px; color: #e2e8f0; font-family: ui-monospace, monospace; white-space: pre-wrap; word-break: break-word; }
.ai-pe-out-tag { font-size: 10px; color: #6ee7b7; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; margin-top: 4px; }
.ai-pe-out-card.invalid .ai-pe-out-tag { color: #fbbf24; }
.ai-pe-empty { font-size: 11px; color: #94a3b8; font-style: italic; }

@media (max-width: 720px) {
  .ai-mcp-pipe { flex-wrap: nowrap; overflow-x: auto; }
  .ai-tool-tools-body { grid-template-columns: 1fr; }
  .ai-vec-layer { flex-direction: column; align-items: stretch; }
  .ai-vec-layer-label { min-width: 0; }
  .ai-ft-curve-row { grid-template-columns: 50px 1fr 50px 1fr 50px; font-size: 10px; }
  .ai-pe-task { grid-template-columns: 1fr; }
}

/* =================================================================== */
/* OS: state-based topics - MemAlloc, Disk, FileSystem, Mutex          */
/* =================================================================== */

.memalloc-container, .disk-container, .fs-container, .mutex-container { display: flex; flex-direction: column; gap: 10px; padding: 12px; }
.memalloc-section-title, .disk-section-title, .fs-section-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: #f0abfc; margin-bottom: 4px; }

/* ---- Memory Allocation ---- */
.memalloc-requests { padding: 8px 10px; background: rgba(15,23,42,0.55); border: 1px solid rgba(244,114,182,0.25); border-radius: 8px; }
.memalloc-requests .memalloc-section-title { color: #fbcfe8; }
.memalloc-reqs-body { display: flex; flex-wrap: wrap; gap: 6px; }
.memalloc-req { padding: 4px 10px; border-radius: 999px; font-size: 11px; font-family: ui-monospace, monospace; border: 1px solid rgba(148,163,184,0.3); background: rgba(30,41,59,0.6); color: #cbd5e1; }
.memalloc-req-pending { border-color: #fbbf24; color: #fde68a; }
.memalloc-req-placed  { border-color: #34d399; color: #d1fae5; background: rgba(52,211,153,0.12); }
.memalloc-req-failed  { border-color: #fb7185; color: #fecaca; background: rgba(251,113,133,0.12); }
.memalloc-req-status { font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.5px; margin-left: 4px; opacity: 0.85; }
.memalloc-memory { padding: 8px 10px; background: rgba(15,23,42,0.55); border: 1px solid rgba(244,114,182,0.18); border-radius: 8px; }
.memalloc-memory .memalloc-section-title { color: #fbcfe8; }
.memalloc-bar { display: flex; height: 56px; border-radius: 6px; overflow: hidden; border: 1px solid rgba(148,163,184,0.25); }
.memalloc-block { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: #e2e8f0; font-size: 10px; font-family: ui-monospace, monospace; border-right: 1px solid rgba(15,23,42,0.6); padding: 4px; transition: all 0.25s ease; }
.memalloc-block:last-child { border-right: none; }
.memalloc-block.free { background: rgba(94,234,212,0.15); color: #99f6e4; }
.memalloc-block.used { background: rgba(244,114,182,0.22); color: #fce7f3; }
.memalloc-block.scan { box-shadow: inset 0 0 0 2px #fbbf24; }
.memalloc-block.scan.skip { box-shadow: inset 0 0 0 2px #64748b; opacity: 0.7; }
.memalloc-block.pick { box-shadow: inset 0 0 0 2px #34d399; }
.memalloc-block.scan.placed { box-shadow: inset 0 0 0 2px #34d399; background: rgba(52,211,153,0.22); }
.memalloc-block b { font-size: 11px; color: #fff; }

/* ---- Disk Scheduling ---- */
.disk-queue-row { padding: 8px 10px; background: rgba(15,23,42,0.55); border: 1px solid rgba(186,230,253,0.25); border-radius: 8px; }
.disk-queue-row .disk-section-title { color: #bae6fd; }
.disk-queue-body { display: flex; flex-wrap: wrap; gap: 6px; }
.disk-req { padding: 3px 9px; border-radius: 999px; font-size: 11px; font-family: ui-monospace, monospace; border: 1px solid rgba(148,163,184,0.3); background: rgba(30,41,59,0.6); color: #cbd5e1; }
.disk-req.pending { border-color: #22d3ee; color: #cffafe; }
.disk-req.served  { border-color: #34d399; color: #d1fae5; background: rgba(52,211,153,0.12); }
.disk-track { padding: 8px 10px; background: rgba(15,23,42,0.55); border: 1px solid rgba(186,230,253,0.18); border-radius: 8px; }
.disk-track .disk-section-title { color: #bae6fd; }
.disk-track svg { width: 100%; height: auto; }

/* ---- File System ---- */
.fs-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fs-inode, .fs-indirect, .fs-blocks { padding: 8px 10px; background: rgba(15,23,42,0.55); border: 1px solid rgba(253,230,138,0.22); border-radius: 8px; }
.fs-blocks { grid-column: 1 / -1; }
.fs-inode .fs-section-title, .fs-indirect .fs-section-title, .fs-blocks .fs-section-title { color: #fde68a; }
.fs-inode-meta { display: flex; flex-wrap: wrap; gap: 8px; font-size: 11px; color: #cbd5e1; padding: 4px 0; font-family: ui-monospace, monospace; }
.fs-inode-ptrs, .fs-indirect-ptrs { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 4px; }
.fs-ptr { display: flex; flex-direction: column; padding: 4px 6px; border-radius: 6px; background: rgba(30,41,59,0.6); border: 1px solid rgba(148,163,184,0.25); font-family: ui-monospace, monospace; transition: all 0.25s ease; }
.fs-ptr.active { border-color: #fbbf24; background: rgba(251,191,36,0.18); box-shadow: 0 0 0 2px rgba(251,191,36,0.15); }
.fs-ptr-label { font-size: 9.5px; color: #94a3b8; }
.fs-ptr-val { font-size: 12px; color: #fde68a; font-weight: 700; }
.fs-empty { font-size: 11px; color: #94a3b8; font-style: italic; padding: 4px; }
.fs-blocks-grid { display: grid; grid-template-columns: repeat(16, 1fr); gap: 3px; }
.fs-block { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; border-radius: 4px; background: rgba(30,41,59,0.55); color: #94a3b8; border: 1px solid rgba(148,163,184,0.25); font-family: ui-monospace, monospace; transition: all 0.25s ease; }
.fs-block-meta { background: rgba(96,165,250,0.20); color: #bfdbfe; border-color: #60a5fa; }
.fs-block-data { background: rgba(52,211,153,0.20); color: #d1fae5; border-color: #34d399; }
.fs-block-index { background: rgba(251,191,36,0.22); color: #fde68a; border-color: #fbbf24; }
.fs-block-free { background: rgba(30,41,59,0.55); color: #64748b; }
.fs-block.hot { box-shadow: 0 0 0 2px #fb7185; }

/* ---- Mutex ---- */
.mutex-body { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.mutex-threads, .mutex-middle, .mutex-history { padding: 8px 10px; background: rgba(15,23,42,0.55); border: 1px solid rgba(253,164,175,0.22); border-radius: 8px; display: flex; flex-direction: column; gap: 6px; }
.mutex-thread { padding: 6px 8px; border-radius: 6px; background: rgba(30,41,59,0.6); border-left: 3px solid #64748b; font-family: ui-monospace, monospace; font-size: 11px; transition: all 0.25s ease; }
.mutex-thread-id { font-weight: 800; font-size: 13px; color: #fecaca; }
.mutex-thread-state { font-size: 10px; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.5px; }
.mutex-thread-pc, .mutex-thread-local { font-size: 10.5px; color: #cbd5e1; }
.mutex-thread-ready   { border-left-color: #94a3b8; }
.mutex-thread-running { border-left-color: #34d399; background: rgba(52,211,153,0.10); }
.mutex-thread-blocked { border-left-color: #fb7185; background: rgba(251,113,133,0.12); opacity: 0.9; }
.mutex-thread-done    { border-left-color: #6b7280; opacity: 0.6; }
.mutex-lock { padding: 8px; border-radius: 6px; background: rgba(30,41,59,0.7); text-align: center; border: 1px solid rgba(148,163,184,0.25); }
.mutex-lock-title { font-size: 10px; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.5px; }
.mutex-lock-state { font-size: 13px; font-weight: 800; font-family: ui-monospace, monospace; margin: 4px 0; }
.mutex-lock-state.unlocked { color: #34d399; }
.mutex-lock-state.locked   { color: #fb7185; }
.mutex-lock-waiters { font-size: 10.5px; color: #fcd34d; font-family: ui-monospace, monospace; }
.mutex-counter { padding: 8px; border-radius: 6px; background: rgba(30,41,59,0.7); text-align: center; border: 1px solid rgba(148,163,184,0.25); }
.mutex-counter-title { font-size: 10px; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.5px; }
.mutex-counter-val { font-size: 26px; font-weight: 800; color: #fde68a; font-family: ui-monospace, monospace; }
.mutex-history-title { font-size: 11px; font-weight: 700; color: #fda4af; text-transform: uppercase; letter-spacing: 0.5px; }
.mutex-history-body { display: flex; flex-direction: column; gap: 2px; max-height: 220px; overflow: auto; font-family: ui-monospace, monospace; font-size: 11px; }
.mutex-history-row { padding: 2px 6px; border-radius: 4px; background: rgba(30,41,59,0.55); color: #e2e8f0; }
.mutex-history-row b { color: #fecaca; margin-right: 4px; }
.mutex-history-row i { color: #fcd34d; font-style: normal; margin-left: 6px; }
.mutex-ok-yes { color: #34d399; }
.mutex-ok-no  { color: #fb7185; }
.mutex-ok-na  { color: #94a3b8; }

@media (max-width: 720px) {
  .fs-layout { grid-template-columns: 1fr; }
  .fs-blocks-grid { grid-template-columns: repeat(8, 1fr); }
  .mutex-body { grid-template-columns: 1fr; }
}

/* =================================================================== */
/* DBMS new query topics: Window Functions, CTE, Set Operations         */
/* =================================================================== */

.qop-grid-window, .qop-grid-cte { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: flex-start; }
.qop-grid-setops { display: grid; grid-template-columns: 1fr 1.1fr 1fr; gap: 12px; align-items: flex-start; }
@media (max-width: 780px) {
  .qop-grid-window, .qop-grid-cte, .qop-grid-setops { grid-template-columns: 1fr; }
}

/* ---- Window Functions ---- */
.qop-window-spec, .qop-window-parts, .qop-window-computed { padding: 8px 10px; background: rgba(15,23,42,0.55); border: 1px solid rgba(253,164,175,0.22); border-radius: 8px; margin-bottom: 8px; }
.qop-window-spec-title, .qop-window-title { font-size: 11px; font-weight: 700; color: #fda4af; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.qop-window-spec-row { font-size: 11.5px; color: #cbd5e1; font-family: ui-monospace, monospace; padding: 2px 0; }
.qop-window-spec-row b { color: #fbbf24; margin-right: 6px; }
.qop-window-parts-body { display: flex; flex-direction: column; gap: 4px; }
.qop-window-part { padding: 6px 8px; border-radius: 6px; background: rgba(30,41,59,0.55); border-left: 3px solid rgba(148,163,184,0.4); transition: all 0.25s ease; }
.qop-window-part.highlighted { border-left-color: #fda4af; background: rgba(253,164,175,0.10); box-shadow: inset 0 0 0 1px rgba(253,164,175,0.30); }
.qop-window-part-key { font-size: 11px; color: #fcd34d; font-family: ui-monospace, monospace; margin-bottom: 4px; }
.qop-window-prow { font-size: 11.5px; color: #e2e8f0; padding: 2px 6px; border-radius: 4px; background: rgba(15,23,42,0.4); margin-bottom: 2px; font-family: ui-monospace, monospace; }
.qop-window-prow.frame-current { background: rgba(34,211,238,0.18); border: 1px solid #22d3ee; }
.qop-window-prow b { color: #34d399; }
.qop-window-comp-body { display: flex; flex-direction: column; gap: 3px; }
.qop-window-comp-row { display: flex; gap: 10px; align-items: center; padding: 3px 6px; border-radius: 4px; background: rgba(30,41,59,0.55); font-family: ui-monospace, monospace; font-size: 11.5px; }
.qop-window-comp-rid { color: #94a3b8; min-width: 56px; }
.qop-window-comp-val { color: #fcd34d; font-weight: 700; }
.qop-window-empty { font-size: 11px; color: #94a3b8; font-style: italic; }

/* ---- CTE ---- */
.qop-cte-spec, .qop-cte-iters, .qop-cte-acc { padding: 8px 10px; background: rgba(15,23,42,0.55); border: 1px solid rgba(196,181,253,0.22); border-radius: 8px; margin-bottom: 8px; }
.qop-cte-spec-title, .qop-cte-title { font-size: 11px; font-weight: 700; color: #c4b5fd; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.qop-cte-spec-title b, .qop-cte-spec-title [data-cte-name] { color: #fcd34d; font-family: ui-monospace, monospace; }
.qop-cte-spec-body { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-family: ui-monospace, monospace; font-size: 11px; }
.qop-cte-mode { padding: 2px 8px; border-radius: 999px; font-size: 10px; font-weight: 800; letter-spacing: 0.5px; }
.qop-cte-mode-simple    { background: rgba(148,163,184,0.20); color: #e2e8f0; }
.qop-cte-mode-recursive { background: rgba(196,181,253,0.22); color: #ddd6fe; border: 1px solid #a78bfa; }
.qop-cte-sql { color: #cbd5e1; }
.qop-cte-iters-body { display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow: auto; }
.qop-cte-iter { padding: 6px 8px; border-radius: 6px; background: rgba(30,41,59,0.55); border-left: 3px solid #a78bfa; }
.qop-cte-iter-head { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; }
.qop-cte-iter-head b { color: #ddd6fe; font-family: ui-monospace, monospace; }
.qop-cte-iter-note { color: #94a3b8; font-style: italic; font-size: 10.5px; }
.qop-cte-iter-working { font-size: 11px; color: #cbd5e1; margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.qop-cte-iter-working i { color: #64748b; }
.qop-cte-pill { padding: 2px 8px; border-radius: 999px; background: rgba(34,211,238,0.18); border: 1px solid #22d3ee; color: #cffafe; font-family: ui-monospace, monospace; font-size: 10.5px; }
.qop-cte-acc-body table { width: 100%; border-collapse: collapse; font-size: 11px; font-family: ui-monospace, monospace; }
.qop-cte-acc-body td { padding: 3px 6px; border: 1px solid rgba(148,163,184,0.18); color: #e2e8f0; }
.qop-cte-acc-body td b { color: #94a3b8; font-weight: 500; margin-right: 3px; }
.qop-cte-empty { font-size: 11px; color: #94a3b8; font-style: italic; }

/* ---- Set Operations ---- */
.qop-setops-op, .qop-setops-mem { padding: 8px 10px; background: rgba(15,23,42,0.55); border: 1px solid rgba(147,197,253,0.22); border-radius: 8px; margin-bottom: 8px; }
.qop-setops-op-title, .qop-setops-title { font-size: 11px; font-weight: 700; color: #93c5fd; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.qop-setops-op-val { font-size: 18px; font-weight: 800; color: #dbeafe; font-family: ui-monospace, monospace; text-align: center; padding: 6px 0; background: rgba(29,78,216,0.18); border-radius: 6px; }
.qop-setops-mem-body { display: flex; flex-direction: column; gap: 3px; max-height: 260px; overflow: auto; }
.qop-setops-mem-row { display: flex; align-items: center; gap: 8px; padding: 3px 8px; border-radius: 4px; background: rgba(30,41,59,0.55); font-family: ui-monospace, monospace; font-size: 11.5px; }
.qop-setops-mem-key { flex: 1; color: #e2e8f0; }
.qop-setops-mem-l, .qop-setops-mem-r { width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; border-radius: 4px; font-size: 10px; font-weight: 800; background: rgba(15,23,42,0.6); color: #64748b; border: 1px solid rgba(148,163,184,0.25); }
.qop-setops-mem-l.on { background: rgba(34,211,238,0.22); color: #cffafe; border-color: #22d3ee; }
.qop-setops-mem-r.on { background: rgba(251,191,36,0.22); color: #fde68a; border-color: #fbbf24; }
.qop-setops-empty { font-size: 11px; color: #94a3b8; font-style: italic; }

/* =================================================================== */
/* Networking new topics: UDP, ICMP/Ping, DHCP DORA                     */
/* =================================================================== */

/* ---- UDP ---- */
.udp-hosts { display: grid; grid-template-columns: 200px 1fr 200px; gap: 10px; align-items: stretch; margin: 8px 0; }
.udp-host { padding: 8px 10px; background: rgba(15,23,42,0.55); border: 1px solid rgba(252,211,77,0.25); border-radius: 8px; display: flex; flex-direction: column; gap: 4px; }
.udp-host-tx { border-color: #22d3ee; }
.udp-host-rx { border-color: #34d399; }
.udp-host-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: #fcd34d; }
.udp-host-addr  { font-size: 12px; color: #e2e8f0; font-family: ui-monospace, monospace; }
.udp-host-stat  { font-size: 11px; color: #cbd5e1; font-family: ui-monospace, monospace; }
.udp-host-stat b { color: #94a3b8; margin-right: 4px; }
.udp-wire { padding: 8px 10px; background: rgba(15,23,42,0.55); border: 1px dashed rgba(252,211,77,0.30); border-radius: 8px; }
.udp-wire-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: #fcd34d; margin-bottom: 6px; }
.udp-wire-body { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 60px; }
.udp-wire-idle { font-size: 11px; color: #94a3b8; font-style: italic; }
.udp-pkt { display: inline-flex; gap: 6px; align-items: center; padding: 4px 10px; border-radius: 6px; background: rgba(30,41,59,0.7); border: 1px solid rgba(148,163,184,0.3); font-family: ui-monospace, monospace; font-size: 11px; }
.udp-pkt-seq { color: #fbbf24; font-weight: 700; }
.udp-pkt-pay { color: #cbd5e1; }
.udp-pkt-st  { font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.5px; padding: 1px 5px; border-radius: 4px; background: rgba(15,23,42,0.7); color: #94a3b8; }
.udp-pkt-flight    { border-color: #22d3ee; background: rgba(34,211,238,0.12); }
.udp-pkt-flight .udp-pkt-st    { color: #cffafe; background: rgba(34,211,238,0.30); }
.udp-pkt-delivered { border-color: #34d399; background: rgba(52,211,153,0.14); }
.udp-pkt-delivered .udp-pkt-st { color: #d1fae5; background: rgba(52,211,153,0.30); }
.udp-pkt-lost      { border-color: #fb7185; background: rgba(251,113,133,0.16); text-decoration: line-through; opacity: 0.7; }
.udp-pkt-lost .udp-pkt-st      { color: #fecaca; background: rgba(251,113,133,0.32); }
.netviz-legend-swatch.udp-flight    { background: #22d3ee; }
.netviz-legend-swatch.udp-delivered { background: #34d399; }
.netviz-legend-swatch.udp-lost      { background: #fb7185; }

/* ---- ICMP / Ping ---- */
.icmp-path, .icmp-pkts, .icmp-rtt { padding: 8px 10px; background: rgba(15,23,42,0.55); border: 1px solid rgba(253,164,175,0.22); border-radius: 8px; margin: 8px 0; }
.icmp-path-title, .icmp-pkts-title, .icmp-rtt-title { font-size: 11px; font-weight: 700; color: #fda4af; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.icmp-hops { display: flex; gap: 4px; align-items: stretch; flex-wrap: wrap; }
.icmp-hop { display: flex; flex-direction: column; align-items: center; padding: 6px 10px; border-radius: 8px; background: rgba(30,41,59,0.55); border: 1px solid rgba(148,163,184,0.25); min-width: 90px; transition: all 0.25s ease; }
.icmp-hop.icmp-active  { border-color: #fbbf24; background: rgba(251,191,36,0.14); }
.icmp-hop.icmp-replied { border-color: #34d399; background: rgba(52,211,153,0.14); }
.icmp-hop-id    { font-size: 14px; font-weight: 800; color: #fcd34d; font-family: ui-monospace, monospace; }
.icmp-hop-ip    { font-size: 11px; color: #cbd5e1; font-family: ui-monospace, monospace; }
.icmp-hop-label { font-size: 10.5px; color: #94a3b8; font-style: italic; }
.icmp-hop-arr   { align-self: center; color: #64748b; font-size: 18px; padding: 0 4px; }
.icmp-pkt { display: inline-flex; gap: 8px; align-items: center; padding: 4px 10px; border-radius: 6px; background: rgba(30,41,59,0.6); border: 1px solid rgba(148,163,184,0.3); font-family: ui-monospace, monospace; font-size: 11px; color: #e2e8f0; }
.icmp-pkt-kind { font-weight: 800; color: #fbbf24; }
.icmp-pkt-info { color: #cbd5e1; }
.icmp-pkt-echo-req     { border-color: #22d3ee; background: rgba(34,211,238,0.14); }
.icmp-pkt-echo-reply   { border-color: #34d399; background: rgba(52,211,153,0.14); }
.icmp-pkt-time-exceeded { border-color: #fb7185; background: rgba(251,113,133,0.14); }
.icmp-pkts-idle, .icmp-rtt-idle { font-size: 11px; color: #94a3b8; font-style: italic; }
.icmp-rtt-body { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.icmp-rtt-chip { padding: 3px 8px; border-radius: 999px; background: rgba(52,211,153,0.18); border: 1px solid #34d399; color: #d1fae5; font-family: ui-monospace, monospace; font-size: 11px; }
.icmp-rtt-summary { margin-left: 10px; color: #fcd34d; font-family: ui-monospace, monospace; font-size: 11px; font-weight: 700; }
.netviz-legend-swatch.icmp-active   { background: #fbbf24; }
.netviz-legend-swatch.icmp-replied  { background: #34d399; }
.netviz-legend-swatch.icmp-req      { background: #22d3ee; }
.netviz-legend-swatch.icmp-reply    { background: #34d399; }
.netviz-legend-swatch.icmp-exc      { background: #fb7185; }

/* ---- DHCP DORA ---- */
.dhcp-hosts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: stretch; margin: 8px 0; }
.dhcp-client, .dhcp-server { padding: 8px 10px; background: rgba(15,23,42,0.55); border: 1px solid rgba(165,180,252,0.25); border-radius: 8px; }
.dhcp-host-title { font-size: 11px; font-weight: 700; color: #a5b4fc; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.dhcp-host-line { font-size: 11.5px; color: #cbd5e1; font-family: ui-monospace, monospace; padding: 2px 0; }
.dhcp-host-line b { color: #94a3b8; min-width: 50px; display: inline-block; margin-right: 4px; }
.dhcp-state { padding: 1px 7px; border-radius: 999px; font-size: 10px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; background: rgba(148,163,184,0.18); color: #e2e8f0; }
.dhcp-state-discover  { background: rgba(34,211,238,0.20); color: #cffafe; border: 1px solid #22d3ee; }
.dhcp-state-wait-offer{ background: rgba(251,191,36,0.20); color: #fde68a; border: 1px solid #fbbf24; }
.dhcp-state-request   { background: rgba(167,139,250,0.22); color: #ddd6fe; border: 1px solid #a78bfa; }
.dhcp-state-bound     { background: rgba(52,211,153,0.22); color: #d1fae5; border: 1px solid #34d399; }
.dhcp-leases { margin-top: 8px; }
.dhcp-leases-title { font-size: 10.5px; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.dhcp-leases-body { display: flex; flex-direction: column; gap: 3px; }
.dhcp-lease { padding: 3px 8px; border-radius: 4px; background: rgba(30,41,59,0.55); font-family: ui-monospace, monospace; font-size: 11px; color: #cbd5e1; }
.dhcp-lease b { color: #fbbf24; }
.dhcp-lease i { font-style: normal; color: #fcd34d; margin-left: 6px; }
.dhcp-lease-rem { color: #94a3b8; margin-left: 6px; font-size: 10px; }
.dhcp-lease-offered { border-left: 3px solid #fbbf24; }
.dhcp-lease-bound   { border-left: 3px solid #34d399; }
.dhcp-leases-idle, .dhcp-msgs-idle { font-size: 11px; color: #94a3b8; font-style: italic; }
.dhcp-msgs { padding: 8px 10px; background: rgba(15,23,42,0.55); border: 1px solid rgba(165,180,252,0.18); border-radius: 8px; }
.dhcp-msgs-title { font-size: 11px; font-weight: 700; color: #a5b4fc; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.dhcp-msgs-body { display: flex; flex-direction: column; gap: 4px; max-height: 240px; overflow: auto; }
.dhcp-msg { padding: 6px 8px; border-radius: 6px; background: rgba(30,41,59,0.55); border-left: 3px solid #64748b; }
.dhcp-msg-head { font-size: 11.5px; display: flex; gap: 10px; align-items: baseline; }
.dhcp-msg-head b { color: #fbbf24; font-family: ui-monospace, monospace; }
.dhcp-msg-flow { color: #94a3b8; font-size: 10.5px; font-family: ui-monospace, monospace; }
.dhcp-msg-fields { font-size: 10.5px; color: #cbd5e1; font-family: ui-monospace, monospace; margin-top: 3px; display: flex; flex-wrap: wrap; gap: 6px; }
.dhcp-msg-fields b { color: #94a3b8; }
.dhcp-msg-discover { border-left-color: #22d3ee; }
.dhcp-msg-offer    { border-left-color: #fbbf24; }
.dhcp-msg-request  { border-left-color: #a78bfa; }
.dhcp-msg-ack      { border-left-color: #34d399; background: rgba(52,211,153,0.08); }
.netviz-legend-swatch.dhcp-discover { background: #22d3ee; }
.netviz-legend-swatch.dhcp-offer    { background: #fbbf24; }
.netviz-legend-swatch.dhcp-request  { background: #a78bfa; }
.netviz-legend-swatch.dhcp-ack      { background: #34d399; }

@media (max-width: 720px) {
  .udp-hosts { grid-template-columns: 1fr; }
  .dhcp-hosts { grid-template-columns: 1fr; }
}

/* ============================================================
   net-tcp3: TCP 3-Way Handshake state machine
   ============================================================ */
.tcp3-pair { display: grid; grid-template-columns: 1fr 1.4fr 1fr; gap: 10px; align-items: stretch; margin-top: 10px; }
.tcp3-side { background: rgba(15,23,42,0.55); border: 1px solid rgba(148,163,184,0.18); border-radius: 8px; padding: 8px 10px; min-width: 0; }
.tcp3-side-head { font-size: 11.5px; font-weight: 700; color: #e2e8f0; margin-bottom: 4px; }
.tcp3-line { font-size: 11px; color: #cbd5e1; font-family: ui-monospace, monospace; display: flex; gap: 6px; }
.tcp3-line b { color: #94a3b8; min-width: 36px; display: inline-block; }
.tcp3-state { padding: 1px 6px; border-radius: 4px; font-weight: 600; background: rgba(100,116,139,0.25); color: #cbd5e1; }
.tcp3-st-closed,
.tcp3-st-listen { background: rgba(100,116,139,0.25); color: #cbd5e1; }
.tcp3-st-syn-sent,
.tcp3-st-syn-rcvd { background: rgba(34,211,238,0.18); color: #67e8f9; }
.tcp3-st-established { background: rgba(52,211,153,0.18); color: #6ee7b7; }
.tcp3-st-fin-wait-1,
.tcp3-st-fin-wait-2,
.tcp3-st-close-wait,
.tcp3-st-last-ack { background: rgba(251,191,36,0.18); color: #fde68a; }
.tcp3-st-time-wait { background: rgba(248,113,113,0.18); color: #fca5a5; }
.tcp3-wire { position: relative; height: 38px; border-top: 1px dashed rgba(148,163,184,0.35); border-bottom: 1px dashed rgba(148,163,184,0.35); margin: auto 6px; align-self: center; min-height: 38px; }
.tcp3-wire-active { background: linear-gradient(90deg, rgba(34,211,238,0.06), rgba(167,139,250,0.08)); }
.tcp3-pkt { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); padding: 2px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 700; color: #0f172a; }
.tcp3-pkt-cs { background: #22d3ee; }
.tcp3-pkt-sc { background: #a78bfa; }
.tcp3-pkt-fin { background: #fda4af; }
.tcp3-seg { margin-top: 10px; padding: 8px 10px; border: 1px solid rgba(148,163,184,0.18); border-radius: 8px; background: rgba(15,23,42,0.5); }
.tcp3-seg-title { font-size: 11px; color: #94a3b8; margin-bottom: 4px; }
.tcp3-seg-body { font-size: 11.5px; color: #e2e8f0; font-family: ui-monospace, monospace; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.tcp3-seg-idle { color: #64748b; font-style: italic; }
.tcp3-seg-dir { font-weight: 700; }
.tcp3-dir-cs { color: #67e8f9; }
.tcp3-dir-sc { color: #c4b5fd; }
.tcp3-flag { padding: 1px 6px; border-radius: 4px; font-size: 10.5px; background: rgba(100,116,139,0.25); color: #cbd5e1; margin-right: 4px; }
.tcp3-fl-syn { background: rgba(34,211,238,0.22); color: #67e8f9; }
.tcp3-fl-ack { background: rgba(52,211,153,0.18); color: #6ee7b7; }
.tcp3-fl-fin { background: rgba(248,113,113,0.18); color: #fca5a5; }
.tcp3-fl-psh { background: rgba(251,191,36,0.18); color: #fde68a; }
.tcp3-seg-payload { width: 100%; padding: 4px 6px; border-radius: 4px; background: rgba(15,23,42,0.6); color: #e2e8f0; font-size: 10.5px; }
.netviz-legend-swatch.tcp3-syn { background: #22d3ee; }
.netviz-legend-swatch.tcp3-synack { background: linear-gradient(90deg, #22d3ee, #a78bfa); }
.netviz-legend-swatch.tcp3-ack { background: #34d399; }
.netviz-legend-swatch.tcp3-fin { background: #fda4af; }
.netviz-legend-swatch.tcp3-est { background: #6ee7b7; }

/* ============================================================
   net-dns: DNS Resolution
   ============================================================ */
.dns-graph { margin-top: 10px; padding: 8px 10px; border: 1px solid rgba(148,163,184,0.18); border-radius: 8px; background: rgba(15,23,42,0.5); }
.dns-q { font-size: 12px; color: #e2e8f0; font-family: ui-monospace, monospace; margin-bottom: 6px; }
.dns-q b { color: #fbbf24; }
.dns-xid { color: #94a3b8; font-size: 10.5px; margin-left: 8px; }
.dns-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; align-items: stretch; }
.dns-node { padding: 6px 8px; border-radius: 6px; background: rgba(30,41,59,0.6); border: 1px solid rgba(148,163,184,0.18); min-width: 0; }
.dns-node-title { font-size: 11px; font-weight: 700; color: #e2e8f0; }
.dns-node-sub { font-size: 10.5px; color: #94a3b8; font-family: ui-monospace, monospace; }
.dns-state-asking, .dns-state-recv { border-color: #22d3ee; background: rgba(34,211,238,0.08); }
.dns-state-replied, .dns-state-done { border-color: #34d399; background: rgba(52,211,153,0.08); }
.dns-cache { margin-top: 4px; font-size: 10px; color: #cbd5e1; font-family: ui-monospace, monospace; max-height: 64px; overflow: auto; }
.dns-cache-title { color: #94a3b8; font-weight: 600; }
.dns-cache-empty { color: #64748b; font-style: italic; }
.dns-wire { margin-top: 8px; padding: 6px 8px; border-radius: 6px; background: rgba(15,23,42,0.6); color: #cbd5e1; font-size: 11px; font-family: ui-monospace, monospace; }
.dns-wire-query { border-left: 3px solid #22d3ee; }
.dns-wire-referral { border-left: 3px solid #fbbf24; }
.dns-wire-answer { border-left: 3px solid #34d399; }
.dns-trace { margin-top: 8px; padding: 8px 10px; border: 1px solid rgba(148,163,184,0.18); border-radius: 8px; background: rgba(15,23,42,0.5); }
.dns-trace-title { font-size: 11px; color: #94a3b8; margin-bottom: 4px; }
.dns-trace-tbl { width: 100%; border-collapse: collapse; font-size: 10.5px; color: #cbd5e1; font-family: ui-monospace, monospace; }
.dns-trace-tbl th, .dns-trace-tbl td { padding: 3px 6px; border-bottom: 1px solid rgba(148,163,184,0.15); text-align: left; }
.dns-trace-tbl th { color: #94a3b8; font-weight: 600; }
.dns-trace-cur td { background: rgba(34,211,238,0.08); }
.dns-trace-empty { color: #64748b; font-style: italic; }
.netviz-legend-swatch.dns-query { background: #22d3ee; }
.netviz-legend-swatch.dns-referral { background: #fbbf24; }
.netviz-legend-swatch.dns-answer { background: #34d399; }
.netviz-legend-swatch.dns-active { background: rgba(34,211,238,0.4); border: 1px solid #22d3ee; }

/* ============================================================
   net-http: HTTP Lifecycle
   ============================================================ */
.http-url { margin-top: 10px; font-size: 11.5px; color: #e2e8f0; font-family: ui-monospace, monospace; }
.http-url b { color: #94a3b8; margin-right: 6px; }
.http-bar { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; margin-top: 8px; }
.http-phase { padding: 6px 8px; border-radius: 6px; background: rgba(30,41,59,0.6); border-left: 3px solid #64748b; min-width: 0; }
.http-phase-label { font-size: 11px; font-weight: 700; color: #e2e8f0; }
.http-phase-detail { font-size: 10.5px; color: #cbd5e1; font-family: ui-monospace, monospace; word-break: break-word; }
.http-phase-lat { font-size: 10px; color: #94a3b8; font-family: ui-monospace, monospace; }
.http-pending { opacity: 0.7; }
.http-active { border-left-color: #22d3ee; background: rgba(34,211,238,0.1); }
.http-done { border-left-color: #34d399; background: rgba(52,211,153,0.08); }
.http-skip { border-left-color: #fbbf24; background: rgba(251,191,36,0.08); opacity: 0.85; }
.http-wire { margin-top: 8px; padding: 6px 8px; border-radius: 6px; background: rgba(15,23,42,0.6); color: #cbd5e1; font-size: 11px; font-family: ui-monospace, monospace; min-height: 24px; }
.http-wire-req { border-left: 3px solid #22d3ee; }
.http-wire-resp { border-left: 3px solid #34d399; }
.http-wire-dns { border-left: 3px solid #a78bfa; }
.http-wire-tcp { border-left: 3px solid #67e8f9; }
.http-wire-tls { border-left: 3px solid #fda4af; }
.http-wire-wait { border-left: 3px solid #fbbf24; }
.http-wire-type { color: #fbbf24; font-weight: 700; }
.http-split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.http-card { padding: 8px 10px; border-radius: 8px; border: 1px solid rgba(148,163,184,0.18); background: rgba(15,23,42,0.55); min-width: 0; }
.http-card-title { font-size: 11px; color: #94a3b8; margin-bottom: 4px; font-weight: 600; }
.http-req { border-left: 3px solid #22d3ee; }
.http-res { border-left: 3px solid #34d399; }
.http-card-line { font-size: 11px; color: #cbd5e1; font-family: ui-monospace, monospace; }
.http-card-line b { color: #94a3b8; margin-right: 6px; }
.http-headers { margin-top: 4px; max-height: 100px; overflow: auto; }
.http-hdr { font-size: 10.5px; color: #cbd5e1; font-family: ui-monospace, monospace; }
.http-hdr b { color: #a78bfa; }
.http-body { margin-top: 4px; padding: 4px 6px; border-radius: 4px; background: rgba(15,23,42,0.6); color: #cbd5e1; font-size: 10.5px; font-family: ui-monospace, monospace; max-height: 60px; overflow: auto; }
.http-conn { margin-top: 6px; font-size: 11px; color: #cbd5e1; font-family: ui-monospace, monospace; }
.http-conn b { color: #94a3b8; }
.http-reused { color: #6ee7b7; font-weight: 700; }
.http-fresh { color: #67e8f9; font-weight: 700; }
.netviz-legend-swatch.http-pending { background: #64748b; }
.netviz-legend-swatch.http-active { background: #22d3ee; }
.netviz-legend-swatch.http-done { background: #34d399; }
.netviz-legend-swatch.http-skip { background: #fbbf24; }

/* ============================================================
   net-tls: TLS Handshake
   ============================================================ */
.tls-params { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 10px; }
.tls-param { padding: 4px 8px; border-radius: 6px; background: rgba(30,41,59,0.6); font-size: 11px; color: #cbd5e1; font-family: ui-monospace, monospace; }
.tls-param b { color: #94a3b8; margin-right: 4px; }
.tls-mode { padding: 1px 6px; border-radius: 4px; background: rgba(100,116,139,0.25); color: #cbd5e1; font-weight: 600; }
.tls-mode-handshake-keys { background: rgba(167,139,250,0.18); color: #c4b5fd; }
.tls-mode-app-keys { background: rgba(52,211,153,0.18); color: #6ee7b7; }
.tls-mode-early-data { background: rgba(251,191,36,0.18); color: #fde68a; }
.tls-pair { display: grid; grid-template-columns: 1fr 1.2fr 1fr; gap: 10px; align-items: stretch; margin-top: 8px; }
.tls-side { padding: 8px 10px; border-radius: 8px; border: 1px solid rgba(148,163,184,0.18); background: rgba(15,23,42,0.55); min-width: 0; }
.tls-side-head { font-size: 11.5px; font-weight: 700; color: #e2e8f0; margin-bottom: 4px; }
.tls-flight { font-size: 10.5px; color: #cbd5e1; font-family: ui-monospace, monospace; }
.tls-flight-name { font-weight: 700; color: #fbbf24; }
.tls-flight-fields { margin-top: 3px; display: flex; flex-direction: column; gap: 2px; }
.tls-field b { color: #a78bfa; }
.tls-wire { position: relative; min-height: 36px; align-self: center; border-top: 1px dashed rgba(148,163,184,0.35); border-bottom: 1px dashed rgba(148,163,184,0.35); }
.tls-pkt { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); padding: 2px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 700; color: #0f172a; background: #64748b; }
.tls-pkt.tls-c2s { background: #22d3ee; }
.tls-pkt.tls-s2c { background: #a78bfa; }
.tls-cert, .tls-psk, .tls-transcript { margin-top: 8px; padding: 6px 10px; border: 1px solid rgba(148,163,184,0.18); border-radius: 8px; background: rgba(15,23,42,0.5); }
.tls-cert-title, .tls-psk-title, .tls-transcript-title { font-size: 11px; color: #94a3b8; margin-bottom: 4px; font-weight: 600; }
.tls-cert-body, .tls-psk-body { font-size: 10.5px; color: #cbd5e1; font-family: ui-monospace, monospace; display: flex; flex-wrap: wrap; gap: 12px; }
.tls-cert-body b, .tls-psk-body b { color: #a78bfa; margin-right: 4px; }
.tls-yes { color: #6ee7b7; font-weight: 700; }
.tls-no { color: #fca5a5; font-weight: 700; }
.tls-empty { color: #64748b; font-style: italic; }
.tls-transcript-body { font-size: 10.5px; color: #cbd5e1; font-family: ui-monospace, monospace; }
.tls-trans-msg { padding: 1px 6px; border-radius: 4px; background: rgba(100,116,139,0.2); color: #cbd5e1; }
.tls-trans-cur { background: rgba(34,211,238,0.18); color: #67e8f9; font-weight: 600; }
.netviz-legend-swatch.tls-c2s { background: #22d3ee; }
.netviz-legend-swatch.tls-s2c { background: #a78bfa; }
.netviz-legend-swatch.tls-keys { background: linear-gradient(90deg, #a78bfa, #34d399); }
.netviz-legend-swatch.tls-sec { background: #6ee7b7; }

@media (max-width: 720px) {
  .tcp3-pair { grid-template-columns: 1fr; }
  .tcp3-wire { display: none; }
  .dns-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .http-bar { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .http-split { grid-template-columns: 1fr; }
  .tls-params { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tls-pair { grid-template-columns: 1fr; }
  .tls-wire { display: none; }
}

/* ============================================================
   dbms-btree: B-Tree index lookup
   ============================================================ */
.dbms-btree { padding: 10px; }
.dbms-btree-tree { display: flex; flex-direction: column; gap: 12px; align-items: stretch; margin-top: 8px; }
/* `safe center` keeps the row centred when it fits, but falls back to
   flex-start when it overflows so the left edge stays reachable via scroll
   (plain `center` on an overflowing flex row clips content on the left). */
.dbms-btree-row { display: flex; gap: 8px; justify-content: safe center; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; padding-bottom: 4px; }
.dbms-btree-row-root { justify-content: safe center; }
.dbms-btree-node { padding: 6px 10px; border: 1px solid rgba(148,163,184,0.25); border-radius: 6px; background: rgba(30,41,59,0.55); min-width: 96px; }
.dbms-btree-leaf { padding: 6px 8px; border: 1px solid rgba(148,163,184,0.18); border-radius: 6px; background: rgba(15,23,42,0.5); min-width: 84px; }
.dbms-btree-node.bn-active, .dbms-btree-leaf.bn-active { border-color: #22d3ee; background: rgba(34,211,238,0.12); box-shadow: 0 0 0 1px rgba(34,211,238,0.4); }
.dbms-btree-node.bn-path, .dbms-btree-leaf.bn-path { border-color: #a78bfa; }
.dbms-btree-node-title { font-size: 10.5px; color: #94a3b8; font-weight: 700; }
.dbms-btree-node-range { font-size: 10px; color: #cbd5e1; font-family: ui-monospace, monospace; }
.dbms-btree-keys { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.dbms-btree-key { padding: 1px 6px; border-radius: 4px; background: rgba(100,116,139,0.25); color: #e2e8f0; font-size: 11px; font-family: ui-monospace, monospace; }
.dbms-btree-key.bk-cmp { background: rgba(251,191,36,0.25); color: #fde68a; }
.dbms-btree-key.bk-match { background: rgba(52,211,153,0.25); color: #6ee7b7; font-weight: 700; }
.dbms-btree-info { margin-top: 8px; padding: 6px 10px; border: 1px solid rgba(148,163,184,0.18); border-radius: 6px; background: rgba(15,23,42,0.5); font-size: 11px; color: #cbd5e1; font-family: ui-monospace, monospace; display: flex; flex-direction: column; gap: 4px; }
.dbms-btree-info b { color: #94a3b8; margin-right: 4px; }
.qop-leg-btree-active { background: rgba(34,211,238,0.5); border: 1px solid #22d3ee; }
.qop-leg-btree-path { background: rgba(167,139,250,0.4); border: 1px solid #a78bfa; }
.qop-leg-btree-cmp { background: rgba(251,191,36,0.5); }
.qop-leg-btree-match { background: rgba(52,211,153,0.5); }

/* ============================================================
   dbms-acid: ACID transaction
   ============================================================ */
.dbms-acid { padding: 10px; }
.dbms-acid-grid { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto auto auto; gap: 8px; margin-top: 8px; }
.dbms-acid-tx { grid-column: 1 / span 2; padding: 8px 10px; border: 1px solid rgba(148,163,184,0.18); border-radius: 6px; background: rgba(15,23,42,0.5); }
.dbms-acid-title { font-size: 11px; color: #94a3b8; font-weight: 600; margin-bottom: 4px; }
.dbms-acid-tx-body { display: flex; flex-wrap: wrap; gap: 14px; font-size: 11.5px; color: #cbd5e1; font-family: ui-monospace, monospace; }
.dbms-acid-tx-body b { color: #94a3b8; margin-right: 4px; }
.dbms-acid-tx-body code { background: rgba(15,23,42,0.7); padding: 2px 6px; border-radius: 4px; color: #fde68a; }
.dbms-acid-state { padding: 1px 6px; border-radius: 4px; background: rgba(100,116,139,0.25); color: #cbd5e1; font-weight: 600; }
.dbms-acid-st-active { background: rgba(34,211,238,0.18); color: #67e8f9; }
.dbms-acid-st-committing { background: rgba(251,191,36,0.18); color: #fde68a; }
.dbms-acid-st-committed { background: rgba(52,211,153,0.18); color: #6ee7b7; }
.dbms-acid-st-aborting { background: rgba(248,113,113,0.18); color: #fca5a5; }
.dbms-acid-st-aborted { background: rgba(248,113,113,0.25); color: #fca5a5; }
.dbms-acid-locks, .dbms-acid-wal, .dbms-acid-buf, .dbms-acid-disk { padding: 8px 10px; border: 1px solid rgba(148,163,184,0.18); border-radius: 6px; background: rgba(15,23,42,0.5); min-height: 70px; }
.dbms-acid-locks-body, .dbms-acid-wal-body, .dbms-acid-buf-body, .dbms-acid-disk-body { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: #cbd5e1; font-family: ui-monospace, monospace; max-height: 160px; overflow: auto; }
.dbms-acid-lock { padding: 2px 6px; border-radius: 4px; background: rgba(248,113,113,0.12); border-left: 3px solid #fca5a5; }
.dbms-acid-lock b { color: #fca5a5; margin-right: 4px; }
.dbms-acid-lock-xid { color: #94a3b8; font-size: 10.5px; margin-left: 6px; }
.dbms-acid-wal-rec { padding: 3px 6px; border-radius: 4px; background: rgba(30,41,59,0.6); border-left: 3px solid #64748b; }
.dbms-acid-wal-update { border-left-color: #22d3ee; }
.dbms-acid-wal-commit { border-left-color: #34d399; }
.dbms-acid-wal-clr { border-left-color: #fda4af; }
.dbms-acid-wal-head { display: flex; gap: 8px; align-items: baseline; font-size: 10.5px; }
.dbms-acid-wal-head b { color: #fde68a; }
.dbms-acid-wal-type { color: #c4b5fd; font-weight: 700; }
.dbms-acid-fsynced { background: rgba(52,211,153,0.18); color: #6ee7b7; padding: 0 6px; border-radius: 4px; font-size: 10px; }
.dbms-acid-buffered { background: rgba(251,191,36,0.18); color: #fde68a; padding: 0 6px; border-radius: 4px; font-size: 10px; }
.dbms-acid-wal-line { font-size: 10.5px; color: #cbd5e1; word-break: break-word; }
.dbms-acid-page { padding: 2px 6px; border-radius: 4px; background: rgba(30,41,59,0.6); font-size: 11px; }
.dbms-acid-page.dbms-acid-dirty { background: rgba(251,191,36,0.12); border-left: 3px solid #fde68a; }
.dbms-acid-page b { color: #94a3b8; margin-right: 4px; }
.dbms-acid-lsn { color: #64748b; font-size: 10px; margin-left: 6px; }
.dbms-acid-cp { color: #94a3b8; font-size: 10.5px; font-family: ui-monospace, monospace; }
.dbms-acid-empty { color: #64748b; font-style: italic; }
.qop-leg-acid-tx { background: #67e8f9; }
.qop-leg-acid-locks { background: #fca5a5; }
.qop-leg-acid-wal { background: #c4b5fd; }
.qop-leg-acid-buffer { background: #fde68a; }
.qop-leg-acid-disk { background: #cbd5e1; }

/* ============================================================
   dbms-repl: Database replication
   ============================================================ */
.dbms-repl { padding: 10px; }
.dbms-repl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.dbms-repl-primary, .dbms-repl-write, .dbms-repl-replicas, .dbms-repl-slots { padding: 8px 10px; border: 1px solid rgba(148,163,184,0.18); border-radius: 6px; background: rgba(15,23,42,0.5); }
.dbms-repl-replicas, .dbms-repl-slots { grid-column: 1 / span 2; }
.dbms-repl-title { font-size: 11px; color: #94a3b8; font-weight: 600; margin-bottom: 4px; }
.dbms-repl-row { font-size: 11px; color: #cbd5e1; font-family: ui-monospace, monospace; }
.dbms-repl-row b { color: #94a3b8; margin-right: 4px; }
.dbms-repl-state { padding: 1px 6px; border-radius: 4px; background: rgba(100,116,139,0.25); color: #cbd5e1; font-weight: 600; }
.dbms-repl-st-idle { background: rgba(100,116,139,0.25); }
.dbms-repl-st-writing { background: rgba(34,211,238,0.18); color: #67e8f9; }
.dbms-repl-st-committed { background: rgba(52,211,153,0.18); color: #6ee7b7; }
.dbms-repl-write-body { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: #cbd5e1; font-family: ui-monospace, monospace; }
.dbms-repl-write-body code { background: rgba(15,23,42,0.7); padding: 2px 6px; border-radius: 4px; color: #fde68a; }
.dbms-repl-waiting { color: #fca5a5; font-weight: 600; }
.dbms-repl-replicas-body, .dbms-repl-slots-body { display: flex; flex-wrap: wrap; gap: 8px; }
.dbms-repl-replica { flex: 1 1 220px; padding: 6px 8px; border-radius: 6px; background: rgba(30,41,59,0.55); border-left: 3px solid #64748b; min-width: 0; }
.dbms-repl-rst-streaming { border-left-color: #22d3ee; }
.dbms-repl-rst-receiving { border-left-color: #67e8f9; }
.dbms-repl-rst-flushed { border-left-color: #fde68a; }
.dbms-repl-rst-replaying { border-left-color: #fbbf24; }
.dbms-repl-rst-caught-up { border-left-color: #34d399; }
.dbms-repl-rep-head { font-size: 11px; }
.dbms-repl-rep-head b { color: #e2e8f0; margin-right: 6px; }
.dbms-repl-rstate { color: #94a3b8; font-size: 10.5px; }
.dbms-repl-rep-line { font-size: 10.5px; color: #cbd5e1; font-family: ui-monospace, monospace; }
.dbms-repl-rep-line span { color: #fde68a; }
.dbms-repl-lag-ok { color: #6ee7b7; }
.dbms-repl-lag-warn { color: #fde68a; }
.dbms-repl-slot { padding: 4px 8px; border-radius: 4px; background: rgba(30,41,59,0.55); font-size: 11px; color: #cbd5e1; font-family: ui-monospace, monospace; border-left: 3px solid #a78bfa; }
.dbms-repl-slot b { color: #c4b5fd; }
.dbms-repl-slot-lsn { color: #94a3b8; font-size: 10px; margin-left: 6px; }
.dbms-repl-empty { color: #64748b; font-style: italic; }
.qop-leg-repl-primary { background: #67e8f9; }
.qop-leg-repl-replica { background: #34d399; }
.qop-leg-repl-slot { background: #a78bfa; }
.qop-leg-repl-lag { background: #fde68a; }

/* ============================================================
   dbms-qopt: Query optimizer
   ============================================================ */
.dbms-qopt { padding: 10px; }
.dbms-qopt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.dbms-qopt-sql { grid-column: 1 / span 2; padding: 8px 10px; border: 1px solid rgba(148,163,184,0.18); border-radius: 6px; background: rgba(15,23,42,0.5); }
.dbms-qopt-sql code { display: block; font-size: 11.5px; color: #fde68a; font-family: ui-monospace, monospace; word-break: break-word; }
.dbms-qopt-ast, .dbms-qopt-stats, .dbms-qopt-cands, .dbms-qopt-exec { padding: 8px 10px; border: 1px solid rgba(148,163,184,0.18); border-radius: 6px; background: rgba(15,23,42,0.5); min-height: 80px; }
.dbms-qopt-cands { grid-column: 1 / span 2; }
.dbms-qopt-title { font-size: 11px; color: #94a3b8; font-weight: 600; margin-bottom: 4px; }
.dbms-qopt-ast-body, .dbms-qopt-exec-body { font-size: 11px; color: #cbd5e1; font-family: ui-monospace, monospace; }
.dbms-qopt-plan-node { padding: 2px 6px; border-left: 2px solid rgba(167,139,250,0.4); margin: 2px 0; }
.dbms-qopt-plan-node b { color: #c4b5fd; }
.dbms-qopt-plan-kids { margin-left: 14px; border-left: 1px dashed rgba(148,163,184,0.25); padding-left: 6px; }
.dbms-qopt-stats-body { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: #cbd5e1; font-family: ui-monospace, monospace; }
.dbms-qopt-stat { padding: 2px 6px; border-radius: 4px; background: rgba(30,41,59,0.6); }
.dbms-qopt-stat b { color: #fde68a; margin-right: 4px; }
.dbms-qopt-cands-body { display: flex; flex-direction: column; gap: 6px; }
.dbms-qopt-cand { padding: 6px 8px; border-radius: 6px; background: rgba(30,41,59,0.55); border-left: 3px solid #64748b; }
.dbms-qopt-cand.dbms-qopt-win { border-left-color: #34d399; background: rgba(52,211,153,0.08); }
.dbms-qopt-cand-head { font-size: 11px; }
.dbms-qopt-cand-head b { color: #e2e8f0; margin-right: 8px; }
.dbms-qopt-cost { color: #fde68a; font-family: ui-monospace, monospace; }
.dbms-qopt-win-tag { padding: 0 6px; border-radius: 4px; background: rgba(52,211,153,0.25); color: #6ee7b7; font-size: 10px; font-weight: 700; margin-left: 6px; }
.dbms-qopt-cand-ops { font-size: 10.5px; color: #cbd5e1; margin-top: 3px; }
.dbms-qopt-cand-ops code { background: rgba(15,23,42,0.6); padding: 1px 6px; border-radius: 4px; }
.dbms-qopt-cand-breakdown { font-size: 10px; color: #94a3b8; margin-top: 2px; font-style: italic; }
.dbms-qopt-empty { color: #64748b; font-style: italic; }
.qop-leg-qopt-ast { background: #67e8f9; }
.qop-leg-qopt-log { background: #a78bfa; }
.qop-leg-qopt-stats { background: #fde68a; }
.qop-leg-qopt-cand { background: #cbd5e1; }
.qop-leg-qopt-win { background: #34d399; }

/* ============================================================
   dbms-cpool: Connection pooling
   ============================================================ */
.dbms-cpool { padding: 10px; }
.dbms-cpool-cfg { margin-top: 6px; font-size: 11px; color: #cbd5e1; font-family: ui-monospace, monospace; padding: 4px 8px; background: rgba(15,23,42,0.5); border-radius: 4px; }
.dbms-cpool-cfg b { color: #94a3b8; margin-right: 4px; }
.dbms-cpool-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 8px; margin-top: 8px; }
.dbms-cpool-slots, .dbms-cpool-waiters, .dbms-cpool-clients, .dbms-cpool-events { padding: 8px 10px; border: 1px solid rgba(148,163,184,0.18); border-radius: 6px; background: rgba(15,23,42,0.5); min-height: 70px; }
.dbms-cpool-slots { grid-row: span 2; }
.dbms-cpool-title { font-size: 11px; color: #94a3b8; font-weight: 600; margin-bottom: 4px; }
.dbms-cpool-slots-body { display: flex; flex-direction: column; gap: 6px; }
.cpool-slot { padding: 6px 8px; border-radius: 6px; background: rgba(30,41,59,0.55); border-left: 3px solid #64748b; }
.cpool-st-idle { border-left-color: #6ee7b7; background: rgba(52,211,153,0.06); }
.cpool-st-in-use { border-left-color: #22d3ee; background: rgba(34,211,238,0.08); }
.cpool-st-opening { border-left-color: #fde68a; background: rgba(251,191,36,0.08); }
.cpool-slot-head { font-size: 11.5px; color: #e2e8f0; }
.cpool-slot-head b { color: #c4b5fd; margin-right: 6px; }
.cpool-slot-state { color: #94a3b8; font-size: 10.5px; }
.cpool-slot-meta { font-size: 10.5px; color: #cbd5e1; font-family: ui-monospace, monospace; }
.cpool-slot-owner { font-size: 10.5px; color: #cbd5e1; }
.cpool-slot-owner b { color: #fde68a; }
.cpool-slot-q { margin-top: 2px; }
.cpool-slot-q code { background: rgba(15,23,42,0.7); padding: 1px 6px; border-radius: 4px; font-size: 10.5px; color: #cbd5e1; }
.dbms-cpool-waiters-body, .dbms-cpool-clients-body, .dbms-cpool-events-body { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: #cbd5e1; }
.cpool-waiter { padding: 3px 8px; border-radius: 4px; background: rgba(248,113,113,0.12); border-left: 3px solid #fca5a5; font-family: ui-monospace, monospace; }
.cpool-waiter b { color: #fca5a5; margin-right: 6px; }
.cpool-client { padding: 2px 6px; border-radius: 4px; background: rgba(30,41,59,0.6); font-family: ui-monospace, monospace; font-size: 10.5px; }
.cpool-client b { color: #c4b5fd; margin-right: 6px; }
.cpool-event { padding: 2px 8px; border-radius: 4px; background: rgba(30,41,59,0.6); font-size: 10.5px; border-left: 3px solid #64748b; }
.cpool-ev-info { border-left-color: #67e8f9; }
.cpool-ev-success { border-left-color: #34d399; }
.cpool-ev-warn { border-left-color: #fde68a; }
.cpool-ev-error { border-left-color: #fca5a5; }
.cpool-empty { color: #64748b; font-style: italic; font-size: 10.5px; }
.qop-leg-cpool-idle { background: #6ee7b7; }
.qop-leg-cpool-use { background: #22d3ee; }
.qop-leg-cpool-opening { background: #fde68a; }
.qop-leg-cpool-wait { background: #fca5a5; }
.qop-leg-cpool-event { background: #cbd5e1; }

@media (max-width: 720px) {
  .dbms-btree-row { overflow-x: auto; flex-wrap: nowrap; justify-content: flex-start; }
  .dbms-acid-grid { grid-template-columns: 1fr; }
  .dbms-acid-tx { grid-column: 1; }
  .dbms-repl-grid { grid-template-columns: 1fr; }
  .dbms-repl-replicas, .dbms-repl-slots { grid-column: 1; }
  .dbms-qopt-grid { grid-template-columns: 1fr; }
  .dbms-qopt-sql, .dbms-qopt-cands { grid-column: 1; }
  .dbms-cpool-grid { grid-template-columns: 1fr; }
  .dbms-cpool-slots { grid-row: auto; }
}

/* =========================================================================
   New LLM topics: RoPE, Norm, GQA, Speculative, Quant, MoE, Paged, Beam, LoRA, Context
   ========================================================================= */
/* ---- RoPE ---- */
.llm-rope-positions { display: flex; flex-wrap: nowrap; gap: 8px; align-items: center; margin: 10px 0; }
.llm-rope-pos-title, .llm-rope-theta-title, .llm-rope-rot-title, .llm-rope-dots-title {
  font-size: 12px; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px;
}
.llm-rope-pos {
  border: 1px solid #334155; border-radius: 8px; padding: 6px 10px; min-width: 60px; text-align: center;
  background: #0f172a; color: #cbd5e1; transition: all 0.2s ease;
}
.llm-rope-pos.active { border-color: #fbbf24; box-shadow: 0 0 0 2px rgba(251,191,36,0.18); background: #1e293b; }
.llm-rope-pos-m { font-size: 11px; color: #94a3b8; }
.llm-rope-pos-tok { font-size: 14px; font-weight: 600; color: #f1f5f9; }
.llm-rope-theta { background: rgba(15,23,42,0.6); border: 1px solid #1e293b; border-radius: 10px; padding: 10px; margin: 8px 0; }
.llm-rope-theta-row { font-family: ui-monospace, monospace; font-size: 12px; color: #cbd5e1; padding: 2px 0; }
.llm-rope-rot { background: rgba(15,23,42,0.6); border: 1px solid #1e293b; border-radius: 10px; padding: 10px; margin: 8px 0; }
.llm-rope-rot-vec { font-family: ui-monospace, monospace; font-size: 12px; color: #94a3b8; margin-bottom: 8px; }
.llm-rope-rot-list { display: flex; flex-direction: column; gap: 6px; }
.llm-rope-rot-row { background: rgba(251,191,36,0.08); border-left: 3px solid #fbbf24; border-radius: 6px; padding: 6px 10px; font-family: ui-monospace, monospace; font-size: 12px; color: #fde68a; }
.llm-rope-rot-pair { font-weight: 600; color: #fbbf24; }
.llm-rope-rot-in, .llm-rope-rot-out { color: #cbd5e1; }
.llm-rope-dots { margin-top: 8px; }
.llm-rope-dot-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-radius: 8px; margin: 4px 0; font-family: ui-monospace, monospace; }
.llm-rope-dot-row.match { background: rgba(52,211,153,0.10); border: 1px solid rgba(52,211,153,0.4); color: #6ee7b7; }
.llm-rope-dot-row.diff  { background: rgba(251,113,133,0.10); border: 1px solid rgba(251,113,133,0.4); color: #fda4af; }

/* ---- LayerNorm vs RMSNorm ---- */
.llm-norm-input { padding: 10px; background: rgba(15,23,42,0.6); border: 1px solid #1e293b; border-radius: 10px; margin: 10px 0; }
.llm-norm-input-title { font-size: 12px; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.06em; }
.llm-norm-input-vec { font-family: ui-monospace, monospace; font-size: 14px; color: #f1f5f9; margin-top: 4px; }
.llm-norm-dual { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.llm-norm-col { border: 1px solid #1e293b; border-radius: 10px; padding: 10px; background: rgba(15,23,42,0.6); transition: all 0.25s ease; }
.llm-norm-col.active.llm-norm-ln  { border-color: #22d3ee; box-shadow: 0 0 0 1px rgba(34,211,238,0.25); }
.llm-norm-col.active.llm-norm-rms { border-color: #fbbf24; box-shadow: 0 0 0 1px rgba(251,191,36,0.25); }
.llm-norm-col-title { font-size: 13px; font-weight: 700; margin-bottom: 8px; color: #e2e8f0; }
.llm-norm-col.llm-norm-ln .llm-norm-col-title { color: #22d3ee; }
.llm-norm-col.llm-norm-rms .llm-norm-col-title { color: #fbbf24; }
.llm-norm-row { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; font-family: ui-monospace, monospace; font-size: 12px; color: #cbd5e1; }
.llm-norm-k { color: #94a3b8; }
.llm-norm-v { color: #f1f5f9; text-align: right; }
.llm-norm-row.final { border-top: 1px dashed #334155; padding-top: 6px; margin-top: 4px; color: #6ee7b7; }
.llm-norm-row.final .llm-norm-v { color: #6ee7b7; font-weight: 600; }

/* ---- GQA / MQA ---- */
.llm-gqa-variant { display: flex; align-items: center; gap: 12px; margin: 10px 0; }
.llm-gqa-variant-pill { background: linear-gradient(135deg, #6d28d9, #a78bfa); color: #fff; padding: 4px 14px; border-radius: 999px; font-weight: 700; }
.llm-gqa-variant-meta { color: #94a3b8; font-size: 13px; font-family: ui-monospace, monospace; }
.llm-gqa-heads { background: rgba(15,23,42,0.6); border: 1px solid #1e293b; border-radius: 10px; padding: 12px; margin: 8px 0; }
.llm-gqa-q-row, .llm-gqa-kv-row { display: flex; align-items: center; gap: 8px; margin: 6px 0; flex-wrap: nowrap; overflow-x: auto; }
.llm-gqa-row-title { min-width: 90px; font-size: 12px; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.05em; }
.llm-gqa-head {
  position: relative; padding: 8px 10px; border: 2px solid #334155; border-radius: 8px;
  background: #0f172a; color: #f1f5f9; font-family: ui-monospace, monospace; font-size: 12px; min-width: 56px; text-align: center;
}
.llm-gqa-head.q { background: rgba(167,139,250,0.10); }
.llm-gqa-head.kv { font-weight: 700; }
.llm-gqa-head-arrow { position: absolute; bottom: -10px; left: 50%; transform: translateX(-50%); width: 2px; height: 10px; }
.llm-gqa-cache { background: rgba(15,23,42,0.6); border: 1px solid #1e293b; border-radius: 10px; padding: 12px; margin: 8px 0; }
.llm-gqa-cache-title { font-size: 12px; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; }
.llm-gqa-cache-row { display: flex; justify-content: space-between; padding: 3px 0; font-family: ui-monospace, monospace; font-size: 13px; color: #cbd5e1; }
.llm-gqa-cache-row.savings { border-top: 1px dashed #334155; padding-top: 6px; margin-top: 4px; color: #6ee7b7; }
.llm-gqa-cache-row.savings strong { color: #6ee7b7; }

/* ---- Speculative Decoding ---- */
.llm-spec-prompt { padding: 10px; background: rgba(15,23,42,0.6); border: 1px solid #1e293b; border-radius: 10px; margin: 10px 0; font-family: ui-monospace, monospace; }
.llm-spec-prompt-label { color: #94a3b8; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; margin-right: 6px; }
.llm-spec-prompt-text { color: #f1f5f9; font-size: 14px; }
.llm-spec-draft, .llm-spec-target { background: rgba(15,23,42,0.6); border: 1px solid #1e293b; border-radius: 10px; padding: 10px; margin: 8px 0; }
.llm-spec-section-title { font-size: 12px; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; }
.llm-spec-draft-body, .llm-spec-target-body { display: flex; gap: 8px; flex-wrap: nowrap; overflow-x: auto; }
.llm-spec-tok { border-radius: 8px; padding: 6px 10px; min-width: 70px; text-align: center; border: 1px solid #334155; background: #0f172a; transition: all 0.2s ease; }
.llm-spec-tok.pending { color: #94a3b8; }
.llm-spec-tok.accept  { border-color: #34d399; background: rgba(52,211,153,0.10); color: #6ee7b7; }
.llm-spec-tok.reject  { border-color: #fb7185; background: rgba(251,113,133,0.10); color: #fda4af; }
.llm-spec-tok.resample{ border-color: #fbbf24; background: rgba(251,191,36,0.12); color: #fde68a; }
.llm-spec-tok-text { font-weight: 700; font-family: ui-monospace, monospace; font-size: 13px; }
.llm-spec-tok-p { font-size: 11px; opacity: 0.85; margin-top: 2px; }
.llm-spec-empty { color: #64748b; font-style: italic; font-size: 12px; }
.llm-spec-output { background: rgba(52,211,153,0.06); border: 1px solid rgba(52,211,153,0.3); border-radius: 10px; padding: 10px; margin: 8px 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.llm-spec-output-label { font-size: 12px; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.06em; }
.llm-spec-out-tok { background: #1e293b; border: 1px solid #334155; border-radius: 6px; padding: 2px 8px; font-family: ui-monospace, monospace; color: #6ee7b7; }
.llm-spec-output-text { color: #6ee7b7; font-family: ui-monospace, monospace; }

/* ---- Quantization ---- */
.llm-quant-params { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0; }
.llm-quant-pill { padding: 4px 12px; border-radius: 999px; font-weight: 700; color: #fff; }
.llm-quant-pill.fp32 { background: #475569; }
.llm-quant-pill.int8 { background: linear-gradient(135deg, #0e7490, #22d3ee); }
.llm-quant-pill.int4 { background: linear-gradient(135deg, #6d28d9, #c084fc); }
.llm-quant-meta { color: #94a3b8; font-family: ui-monospace, monospace; font-size: 12px; }
.llm-quant-tbl { background: rgba(15,23,42,0.6); border: 1px solid #1e293b; border-radius: 10px; overflow: hidden; }
.llm-quant-thead, .llm-quant-row { display: grid; grid-template-columns: 40px 1fr 1fr 1fr 1fr; gap: 8px; padding: 6px 12px; font-family: ui-monospace, monospace; font-size: 12px; }
.llm-quant-thead { background: rgba(30,41,59,0.6); color: #94a3b8; text-transform: uppercase; letter-spacing: 0.05em; }
.llm-quant-row { border-top: 1px solid #1e293b; color: #cbd5e1; }
.llm-quant-code.int8 { color: #67e8f9; font-weight: 700; }
.llm-quant-code.int4 { color: #c084fc; font-weight: 700; }
.llm-quant-err { color: #94a3b8; }
.llm-quant-err.high { color: #fda4af; font-weight: 700; }

/* ---- MoE ---- */
.llm-moe-experts, .llm-moe-tokens { background: rgba(15,23,42,0.6); border: 1px solid #1e293b; border-radius: 10px; padding: 10px; margin: 8px 0; }
.llm-moe-section-title { font-size: 12px; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 8px; }
.llm-moe-experts-row { display: flex; gap: 8px; flex-wrap: nowrap; overflow-x: auto; }
.llm-moe-expert { min-width: 86px; padding: 8px; border: 1px solid #334155; background: #0f172a; border-radius: 8px; text-align: center; opacity: 0.5; transition: all 0.25s ease; }
.llm-moe-expert.active { opacity: 1; border-color: #fbbf24; box-shadow: 0 0 0 2px rgba(251,191,36,0.18); background: rgba(251,191,36,0.08); }
.llm-moe-expert-id { font-weight: 700; color: #f1f5f9; }
.llm-moe-expert-role { font-size: 11px; color: #94a3b8; text-transform: capitalize; }
.llm-moe-expert-load { font-size: 11px; color: #cbd5e1; margin-top: 4px; }
.llm-moe-token-row { display: grid; grid-template-columns: 80px 1fr 1fr; gap: 10px; padding: 8px 0; border-top: 1px solid #1e293b; align-items: center; }
.llm-moe-token-row:first-of-type { border-top: none; }
.llm-moe-token-tok { font-family: ui-monospace, monospace; font-weight: 700; color: #f1f5f9; }
.llm-moe-scores { display: flex; flex-wrap: wrap; gap: 4px; }
.llm-moe-score { background: #0f172a; border: 1px solid #1e293b; border-radius: 6px; padding: 2px 6px; font-size: 11px; font-family: ui-monospace, monospace; color: #94a3b8; }
.llm-moe-score.picked { border-color: #fbbf24; background: rgba(251,191,36,0.10); color: #fde68a; font-weight: 700; }
.llm-moe-picked { display: flex; flex-wrap: wrap; gap: 4px; }
.llm-moe-picked-pill { background: rgba(52,211,153,0.10); border: 1px solid #34d399; border-radius: 999px; padding: 2px 8px; font-size: 11px; color: #6ee7b7; font-family: ui-monospace, monospace; }
.llm-moe-empty { color: #64748b; font-size: 11px; font-style: italic; }
.llm-moe-token-out { grid-column: 1 / -1; font-family: ui-monospace, monospace; font-size: 12px; color: #94a3b8; padding-left: 90px; }

/* ---- PagedAttention ---- */
.llm-paged-pool, .llm-paged-seqs, .llm-paged-events { background: rgba(15,23,42,0.6); border: 1px solid #1e293b; border-radius: 10px; padding: 10px; margin: 8px 0; }
.llm-paged-section-title { font-size: 12px; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 8px; }
.llm-paged-pool-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.llm-paged-page { border: 1px solid #334155; border-radius: 8px; padding: 8px; background: #0f172a; }
.llm-paged-page.free { opacity: 0.5; }
.llm-paged-page.owner-A { border-color: #22d3ee; background: rgba(34,211,238,0.06); }
.llm-paged-page.owner-B { border-color: #fbbf24; background: rgba(251,191,36,0.06); }
.llm-paged-page.tail { border-style: dashed; border-color: #fb7185; }
.llm-paged-page-id { font-size: 11px; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.05em; }
.llm-paged-page-owner { font-weight: 700; color: #f1f5f9; font-family: ui-monospace, monospace; font-size: 12px; }
.llm-paged-page-cells { display: flex; gap: 2px; margin-top: 6px; }
.llm-paged-cell { flex: 1; text-align: center; font-family: ui-monospace, monospace; font-size: 10px; padding: 2px 0; border-radius: 3px; background: rgba(15,23,42,0.6); color: #64748b; }
.llm-paged-cell.filled { background: rgba(148,163,184,0.18); color: #f1f5f9; }
.llm-paged-seq { padding: 6px 10px; border-radius: 8px; margin: 4px 0; background: #0f172a; }
.llm-paged-seq.owner-A { border-left: 3px solid #22d3ee; }
.llm-paged-seq.owner-B { border-left: 3px solid #fbbf24; }
.llm-paged-seq-head { font-family: ui-monospace, monospace; font-size: 13px; color: #f1f5f9; font-weight: 600; }
.llm-paged-seq-bt { font-family: ui-monospace, monospace; font-size: 12px; color: #94a3b8; margin-top: 2px; }
.llm-paged-event { font-family: ui-monospace, monospace; font-size: 12px; color: #cbd5e1; padding: 2px 0; }
.llm-paged-empty { color: #64748b; font-style: italic; font-size: 12px; }

/* ---- Beam Search ---- */
.llm-beam-step { margin: 10px 0; }
.llm-beam-step-pill { background: linear-gradient(135deg, #4338ca, #818cf8); color: #fff; padding: 4px 12px; border-radius: 999px; font-weight: 700; font-family: ui-monospace, monospace; font-size: 12px; }
.llm-beam-cand, .llm-beam-beams, .llm-beam-finished { background: rgba(15,23,42,0.6); border: 1px solid #1e293b; border-radius: 10px; padding: 10px; margin: 8px 0; }
.llm-beam-section-title { font-size: 12px; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; }
.llm-beam-cand-row, .llm-beam-row { display: grid; grid-template-columns: 70px 1fr 110px; gap: 8px; padding: 4px 8px; font-family: ui-monospace, monospace; font-size: 12px; align-items: center; border-radius: 6px; margin: 2px 0; }
.llm-beam-cand-row.kept   { background: rgba(52,211,153,0.10); color: #6ee7b7; }
.llm-beam-cand-row.pruned { background: rgba(251,113,133,0.08); color: #fda4af; text-decoration: line-through; opacity: 0.7; }
.llm-beam-row.alive       { background: rgba(167,139,250,0.10); color: #ddd6fe; }
.llm-beam-row.finished    { background: rgba(251,191,36,0.10); color: #fde68a; }
.llm-beam-cand-from, .llm-beam-id { color: #94a3b8; font-weight: 600; }
.llm-beam-cand-tok, .llm-beam-tokens { color: #f1f5f9; }
.llm-beam-cand-lp, .llm-beam-lp { text-align: right; color: #cbd5e1; }
.llm-beam-empty { color: #64748b; font-style: italic; font-size: 12px; }

/* ---- LoRA ---- */
.llm-lora-diagram { display: flex; align-items: center; gap: 10px; flex-wrap: nowrap; overflow-x: auto; padding: 12px; background: rgba(15,23,42,0.6); border: 1px solid #1e293b; border-radius: 10px; margin: 10px 0; }
.llm-lora-box { border: 2px solid #334155; background: #0f172a; border-radius: 10px; padding: 10px 14px; text-align: center; min-width: 92px; opacity: 0.55; transition: all 0.3s ease; }
.llm-lora-box.W { border-color: #475569; }
.llm-lora-box.A, .llm-lora-box.B { border-color: #fbbf24; }
.llm-lora-box.Weff { border-color: #34d399; }
.llm-lora-box.active { opacity: 1; box-shadow: 0 0 0 2px rgba(255,255,255,0.06); }
.llm-lora-box-title { font-weight: 700; font-family: ui-monospace, monospace; color: #f1f5f9; }
.llm-lora-box-shape { font-size: 11px; color: #94a3b8; margin-top: 2px; }
.llm-lora-stack { display: flex; align-items: center; gap: 6px; }
.llm-lora-plus, .llm-lora-eq, .llm-lora-dot { color: #94a3b8; font-size: 22px; font-weight: 700; }
.llm-lora-detail { background: rgba(15,23,42,0.6); border: 1px solid #1e293b; border-radius: 10px; padding: 10px; margin: 8px 0; }
.llm-lora-row { display: flex; justify-content: space-between; padding: 3px 0; font-family: ui-monospace, monospace; font-size: 13px; color: #cbd5e1; }
.llm-lora-row.hl { background: rgba(52,211,153,0.08); border-radius: 6px; padding: 6px 8px; margin-top: 6px; color: #6ee7b7; }
.llm-lora-k { color: #94a3b8; }
.llm-lora-v { color: #f1f5f9; text-align: right; }

/* ---- Context Window ---- */
.llm-ctx-mode { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0; }
.llm-ctx-mode-pill { background: linear-gradient(135deg, #15803d, #86efac); color: #022c22; padding: 4px 14px; border-radius: 999px; font-weight: 700; }
.llm-ctx-meta { color: #94a3b8; font-family: ui-monospace, monospace; font-size: 12px; }
.llm-ctx-seq, .llm-ctx-rope { background: rgba(15,23,42,0.6); border: 1px solid #1e293b; border-radius: 10px; padding: 10px; margin: 8px 0; }
.llm-ctx-section-title { font-size: 12px; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; }
.llm-ctx-grid { display: grid; grid-template-columns: repeat(16, 1fr); gap: 3px; }
.llm-ctx-cell { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; font-size: 10px; font-family: ui-monospace, monospace; border-radius: 4px; }
.llm-ctx-cell.q     { background: #fb7185; color: #fff; font-weight: 700; }
.llm-ctx-cell.kv    { background: rgba(52,211,153,0.30); color: #6ee7b7; }
.llm-ctx-cell.sink  { background: rgba(251,191,36,0.30); color: #fde68a; }
.llm-ctx-cell.skip  { background: #1e293b; color: #475569; }
.llm-ctx-rope-row { font-family: ui-monospace, monospace; font-size: 13px; color: #cbd5e1; padding: 2px 0; }

@media (max-width: 720px) {
  .llm-norm-dual { grid-template-columns: 1fr; }
  .llm-paged-pool-grid { grid-template-columns: repeat(2, 1fr); }
  .llm-ctx-grid { grid-template-columns: repeat(8, 1fr); }
  .llm-quant-thead, .llm-quant-row { grid-template-columns: 30px 1fr 1fr 1fr 1fr; font-size: 11px; padding: 4px 8px; }
  .llm-beam-cand-row, .llm-beam-row { grid-template-columns: 50px 1fr 90px; }
  .llm-moe-token-row { grid-template-columns: 1fr; }
  .llm-moe-token-out { padding-left: 0; }
  .llm-lora-diagram { flex-direction: column; }
}
