﻿:root {
        --grid-bg: #f4f4f4;
        --grid-line: #e7e7e7;
        --ink: #262626;
        --accent: #7a35ff;
        --accent-soft: #efe7ff;
        --danger: #d64b4b;
      }

      * {
        box-sizing: border-box;
      }

      body {
        margin: 0;
        font-family: "Segoe UI", "Yu Gothic UI", sans-serif;
        color: var(--ink);
        background: var(--grid-bg);
        overflow: hidden;
      }

      .app {
        height: 100vh;
        position: relative;
        overflow: hidden;
        background-image:
          linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
          linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
        background-size: 46px 46px;
      }

      .overlay-ui {
        position: absolute;
        inset: 14px;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        pointer-events: none;
      }

      .toolbar {
        position: relative;
        z-index: 5;
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
        border: 1px solid #ddd;
        border-radius: 14px;
        background: rgba(255, 255, 255, 0.9);
        backdrop-filter: blur(10px);
        box-shadow: 0 16px 34px rgba(24, 24, 24, 0.12);
        padding: 10px;
        max-width: min(1320px, calc(100vw - 28px));
        pointer-events: auto;
      }

      .mode-switch {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        padding: 3px;
        border: 1px solid #d4d4d4;
        border-radius: 10px;
        background: #ffffff;
      }

      .mode-btn {
        min-width: 72px;
      }

      .mode-btn.is-active {
        border-color: var(--accent);
        background: var(--accent-soft);
        color: #5221b2;
        font-weight: 700;
      }

      .toolbar-sep {
        color: #ccc;
        font-size: 18px;
        user-select: none;
        padding: 0 2px;
      }

      /* ── Hamburger menu ── */
      .hamburger-wrap, .import-wrap, .export-wrap, .integrate-wrap {
        position: relative;
      }
      .hamburger-btn {
        font-size: 20px;
        line-height: 1;
        padding: 4px 8px;
        border: 1px solid #d4d4d4;
        border-radius: 8px;
        background: #fff;
        cursor: pointer;
      }
      .hamburger-btn:hover { background: #f5f5f5; }
      .hamburger-menu, .export-menu {
        position: absolute;
        top: calc(100% + 6px);
        left: 0;
        z-index: 20;
        flex-direction: column;
        gap: 6px;
        min-width: 160px;
        padding: 10px;
        background: #fff;
        border: 1px solid #ddd;
        border-radius: 10px;
        box-shadow: 0 8px 24px rgba(0,0,0,0.15);
      }
      .hamburger-menu:not([hidden]), .export-menu:not([hidden]) {
        display: flex;
      }
      .export-menu { left: auto; right: 0; min-width: 100px; }
      .integrate-menu {
        min-width: 220px;
      }
      .menu-section-title {
        font-size: 10px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        color: #999;
        margin-bottom: 2px;
      }
      .menu-section {
        display: flex;
        flex-direction: column;
        gap: 4px;
      }

      .integrate-menu button.is-active {
        border-color: var(--accent);
        background: var(--accent-soft);
        color: #5221b2;
        font-weight: 700;
      }

      .cloud-sync-badge {
        font-size: 12px;
        font-weight: 600;
        padding: 4px 8px;
        border-radius: 999px;
        border: 1px solid #d8d8d8;
        background: #f6f6f6;
        color: #6b6b6b;
      }

      .cloud-sync-badge.on {
        border-color: #7ebf95;
        background: #e8f7ee;
        color: #1f7a43;
      }

      .cloud-sync-badge.conflict {
        border-color: #e0a35c;
        background: #fff3e2;
        color: #a35d16;
      }

      .menu-text-input {
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
        border: 1px solid rgba(0, 0, 0, 0.12);
        border-radius: 8px;
        padding: 8px 10px;
        font: inherit;
        background: rgba(255, 255, 255, 0.96);
        color: #222;
        outline: none;
      }

      .menu-text-input:focus {
        border-color: rgba(54, 110, 255, 0.65);
        box-shadow: 0 0 0 3px rgba(54, 110, 255, 0.14);
      }

      .menu-meta {
        font-size: 12px;
        color: #666;
        line-height: 1.4;
      }

      .mode-badge {
        position: fixed;
        top: 12px;
        left: 50%;
        transform: translateX(-50%);
        z-index: 1000;
        font-size: 24px;
        font-weight: 700;
        letter-spacing: 0.08em;
        padding: 8px 20px;
        border-radius: 999px;
        border: 2px solid #d8d8d8;
        background: #f6f6f6;
        color: #6b6b6b;
        pointer-events: none;
        user-select: none;
      }

      .mode-badge.review {
        font-size: 28px;
        padding: 12px 28px;
        border: 3px solid #9b59b6;
        background: #f3e8f8;
        color: #6a3a82;
        box-shadow: 0 2px 12px rgba(155, 89, 182, 0.4);
        animation: mode-badge-pulse 2s ease-in-out infinite;
      }

      .mode-badge.readonly {
        border-color: #4b8fd7;
        background: #e8f3ff;
        color: #255a91;
      }

      .readonly-banner {
        position: fixed;
        top: 64px;
        left: 50%;
        transform: translateX(-50%);
        z-index: 1000;
        padding: 6px 14px;
        border: 1px solid #9bc1e8;
        border-radius: 999px;
        background: #f2f8ff;
        color: #255a91;
        font-size: 13px;
        font-weight: 600;
        pointer-events: none;
      }

      body.readonly-link .linear-text {
        background: #f7f9fb;
        color: #39424b;
      }

      @keyframes mode-badge-pulse {
        0%, 100% { box-shadow: 0 2px 12px rgba(155, 89, 182, 0.4); }
        50% { box-shadow: 0 2px 24px rgba(155, 89, 182, 0.7); }
      }

      button,
      select,
      input[type="file"],
      input[type="text"] {
        border: 1px solid #d4d4d4;
        border-radius: 8px;
        background: #fff;
        padding: 6px 10px;
        font-size: 13px;
      }

      input[type="text"] {
        min-width: 240px;
      }

      button {
        cursor: pointer;
      }

      button.primary {
        border-color: var(--accent);
        background: var(--accent);
        color: #fff;
      }

      button.danger {
        border-color: var(--danger);
        color: var(--danger);
      }

      .meta,
      .shortcuts,
      .status,
      .visual-check {
        font-size: 12px;
        color: #5d5d5d;
      }

      .status,
      .visual-check {
        min-height: 18px;
      }

      .meta-panel {
        position: relative;
        z-index: 5;
        display: flex;
        flex-direction: column;
        gap: 6px;
        max-width: min(520px, calc(100vw - 28px));
        padding: 12px 14px;
        border: 1px solid rgba(223, 223, 223, 0.95);
        border-radius: 16px;
        background: rgba(255, 255, 255, 0.82);
        backdrop-filter: blur(10px);
        box-shadow: 0 12px 28px rgba(24, 24, 24, 0.1);
        pointer-events: auto;
      }

      .meta-panel[hidden] {
        display: none;
      }

      .visual-check {
        display: none;
        padding: 8px 10px;
        border: 1px solid #dfdfdf;
        border-radius: 10px;
        background: #ffffffc7;
        white-space: pre-wrap;
      }

      .board {
        position: absolute;
        inset: 0;
        pointer-events: auto;
        border: 1px solid #dfdfdf;
        border-radius: 14px;
        background: #ffffff55;
        overflow: hidden;
        cursor: grab;
        user-select: none;
        touch-action: none;
      }

      .workspace {
        position: absolute;
        inset: 0;
        z-index: 1;
        pointer-events: auto;
      }

      .linear-panel {
        position: absolute;
        top: 12px;
        left: 12px;
        width: 380px;
        max-width: none;
        transform-origin: top left;
        z-index: 3;
        display: flex;
        align-items: stretch;
        border: none;
        background: transparent;
        box-shadow: none;
        padding: 0;
        min-height: 0;
        min-width: 220px;
        overflow: visible;
      }

      .linear-panel[hidden] {
        display: none;
      }

      .linear-menu {
        position: absolute;
        top: 10px;
        right: 24px;
        z-index: 4;
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        gap: 6px;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.12s ease;
      }

      .linear-panel.menu-visible .linear-menu {
        opacity: 1;
        pointer-events: auto;
      }

      .linear-menu-toggle {
        width: 34px;
        height: 34px;
        border-radius: 10px;
        border: 1px solid #d5d5d5;
        background: rgba(255, 255, 255, 0.92);
        color: #353535;
        font-size: 18px;
        font-weight: 700;
        line-height: 1;
        padding: 0;
      }

      .linear-adjust-controls {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 6px;
        border: 1px solid #d8d8d8;
        border-radius: 12px;
        background: rgba(255, 255, 255, 0.96);
        box-shadow: 0 8px 18px rgba(24, 24, 24, 0.12);
      }

      .linear-adjust-controls > button {
        min-width: 52px;
        padding: 5px 8px;
      }

      .linear-text {
        width: 100%;
        flex: 1;
        min-height: 0;
        resize: none;
        border: 4px solid var(--accent);
        border-radius: 34px;
        background: #fff;
        padding: 56px 20px 18px;
        font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
        font-size: var(--linear-text-font-size, 44px);
        line-height: 1.2;
        color: #222;
        box-shadow: 0 8px 18px rgba(24, 24, 24, 0.1);
        overflow: hidden;
      }

      .linear-resize-handle {
        position: absolute;
        top: 0;
        right: -10px;
        width: 20px;
        height: 100%;
        cursor: ew-resize;
        touch-action: none;
        background: transparent;
      }

      .linear-resize-handle::before {
        content: "";
        position: absolute;
        top: 8%;
        bottom: 8%;
        left: 9px;
        width: 2px;
        border-radius: 2px;
        background: rgba(122, 53, 255, 0.55);
      }

      .board.panning {
        cursor: grabbing;
      }

      svg {
        display: block;
        width: 100%;
        height: 100%;
        transform-origin: 0 0;
        will-change: transform;
        pointer-events: auto;
      }

      @media (max-width: 900px) {
        .overlay-ui {
          inset: 10px;
        }

        .toolbar,
        .meta-panel {
          max-width: calc(100vw - 20px);
        }

        .meta-panel {
          gap: 4px;
          padding: 10px 12px;
        }

        .linear-panel {
          width: 360px;
          max-width: none;
        }
      }

      .edge {
        fill: none;
        stroke-width: 4;
        stroke-linecap: round;
        pointer-events: none;
      }

      .graph-link {
        fill: none;
        stroke-width: 3;
        stroke-linecap: round;
        opacity: 0.95;
        pointer-events: none;
      }

      .graph-link-hit {
        fill: none;
        stroke: transparent;
        stroke-width: 18;
        stroke-linecap: round;
        pointer-events: stroke;
        cursor: pointer;
      }

      .graph-link.selected {
        stroke-width: 5;
        filter: drop-shadow(0 0 5px rgba(111, 57, 255, 0.55));
      }

      .graph-link-port {
        fill: #ffffff;
        stroke: var(--accent);
        stroke-width: 3;
        pointer-events: none;
      }

      .graph-link-port-source {
        fill: #efe8ff;
      }

      .graph-link-port-target {
        fill: #ffffff;
      }

      .graph-link.graph-link-soft {
        stroke-width: 2.5;
        opacity: 0.72;
      }

      .graph-link.graph-link-dashed {
        stroke-dasharray: 10 7;
      }

      .graph-link.graph-link-emphasis {
        stroke-width: 4.5;
      }

      .edge-label {
        fill: #666;
        font-size: 11px;
        font-weight: 600;
        pointer-events: none;
      }

      .graph-link-label {
        fill: #555;
        font-size: 12px;
        font-weight: 700;
        pointer-events: none;
      }

      .graph-link-label-bg {
        fill: rgba(255, 255, 255, 0.9);
        stroke: rgba(122, 53, 255, 0.22);
        stroke-width: 1.2;
        pointer-events: none;
      }

      .root-box {
        fill: #fff;
        stroke: var(--accent);
        stroke-width: 4;
      }

      .surface-scope-box {
        fill: rgba(255, 255, 255, 0.68);
        stroke: rgba(122, 53, 255, 0.42);
        stroke-width: 3;
        stroke-dasharray: 12 8;
      }

      .surface-scope-title {
        fill: #6f39ff;
        font-size: 22px;
        font-weight: 700;
        letter-spacing: 0.01em;
        pointer-events: none;
      }

      .folder-box {
        fill: #ffffff;
        stroke: #9a6b1f;
        stroke-width: 3;
      }

      .node-shape {
        fill: #ffffff;
        stroke: #666;
        stroke-width: 3;
      }

      .portal-bracket {
        fill: none;
        stroke: #9a6b1f;
        stroke-width: 4;
        stroke-linecap: round;
        stroke-linejoin: round;
      }

      .flow-preview-node {
        fill: rgba(255, 255, 255, 0.92);
        stroke: rgba(102, 102, 102, 0.72);
        stroke-width: 2;
      }

      .flow-preview-node-scope {
        stroke: rgba(154, 107, 31, 0.9);
        stroke-dasharray: 6 4;
      }

      .flow-preview-node-label {
        fill: #2f2f2f;
        font-size: 18px;
        font-weight: 600;
        pointer-events: none;
      }

      .flow-preview-edge {
        fill: none;
        stroke: rgba(122, 53, 255, 0.58);
        stroke-width: 2;
        stroke-linecap: round;
      }

      .flow-preview-edge-label {
        fill: #6f39ff;
        font-size: 10px;
        font-weight: 700;
        pointer-events: none;
      }

      .node-hit {
        fill: transparent;
        cursor: pointer;
      }

.node-hit.selected {
  fill: var(--accent-soft);
  stroke: var(--accent);
  stroke-width: 2;
}

.node-hit.multi-selected {
  fill: color-mix(in srgb, var(--accent-soft) 68%, #ffffff 32%);
  stroke: #9d75ff;
  stroke-width: 1.6;
}

.node-hit.primary-selected {
  stroke: var(--accent);
  stroke-width: 3;
}

.node-hit.reparent-source {
  stroke-dasharray: 8 5;
}

.node-hit.link-source {
  stroke: var(--accent);
  stroke-width: 3;
  stroke-dasharray: 5 4;
}

.node-hit.cut-pending {
  fill: rgba(160, 160, 160, 0.18);
  stroke: #8a8a8a;
  stroke-width: 2;
  stroke-dasharray: 6 4;
}

.node-hit.alias-read {
  fill: rgba(56, 115, 255, 0.08);
  stroke: #3873ff;
  stroke-width: 1.5;
  stroke-dasharray: 6 4;
}

.node-hit.alias-write {
  fill: rgba(17, 153, 92, 0.1);
  stroke: #11995c;
  stroke-width: 1.5;
}

.node-hit.alias-broken {
  fill: rgba(214, 75, 75, 0.1);
  stroke: var(--danger);
  stroke-width: 1.5;
  stroke-dasharray: 10 6;
}

.node-hit.drop-target {
  fill: #d9f5e8;
  stroke: #1b9c64;
  stroke-width: 2;
  stroke-dasharray: 8 6;
}

.node-hit.drag-source {
  fill: #fff1c9;
}

.node-hit.drag-invalid {
  fill: #ffe4e4;
  stroke: var(--danger);
  stroke-width: 2;
  stroke-dasharray: 6 4;
}

.reorder-line {
  stroke: #1b9c64;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 10 6;
  pointer-events: none;
}

      .label-root {
        font-size: 42px;
        font-weight: 500;
        fill: #232323;
        pointer-events: none;
      }

      .label-node {
        font-size: 44px;
        font-weight: 450;
        fill: #232323;
        pointer-events: none;
      }

      .label-node.selected {
        fill: #6f39ff;
        font-weight: 600;
      }

      .label-node.primary-selected {
        text-decoration: underline;
        text-decoration-thickness: 2px;
      }

      .label-node.alias-label {
        font-style: italic;
      }

      .label-node.alias-read-label {
        fill: #2f5fd9;
      }

      .label-node.alias-write-label {
        fill: #12774b;
      }

      .label-node.alias-broken-label {
        fill: var(--danger);
      }

      .alias-badge {
        font-size: 18px;
        font-weight: 700;
        letter-spacing: 0.04em;
        pointer-events: none;
        text-transform: uppercase;
      }

      .alias-badge-read {
        fill: #2f5fd9;
      }

      .alias-badge-write {
        fill: #12774b;
      }

      .alias-badge-broken {
        fill: var(--danger);
      }

      .alias-badge-scope {
        fill: #9a6b1f;
      }

      .collapsed-badge {
        fill: #ffffff;
        stroke: var(--accent);
        stroke-width: 2;
        cursor: pointer;
      }

      .collapsed-badge-node {
        fill: var(--accent-soft);
        stroke: var(--accent);
        stroke-width: 2;
        cursor: pointer;
      }

      .collapsed-badge-count {
        fill: var(--accent);
        font-size: 16px;
        font-weight: 700;
        letter-spacing: 0.02em;
        pointer-events: none;
      }

      /* ── m3e: visual style badges ── */
      .confidence-badge {
        opacity: 0.85;
        pointer-events: none;
      }

      .confidence-badge-text {
        fill: #fff;
        font-size: 13px;
        font-weight: 700;
        pointer-events: none;
      }

      /* ── m3e: status badges ── */
      .status-badge {
        opacity: 0.85;
        pointer-events: none;
      }
      .status-badge-text {
        fill: #fff;
        font-size: 12px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        pointer-events: none;
      }

      /* Status-specific node styles */
      .node-hit.status-placeholder {
        fill: rgba(153, 153, 153, 0.06);
      }
      .node-hit.status-confirmed {
        fill: rgba(45, 140, 78, 0.06);
      }
      .node-hit.status-contested {
        fill: rgba(217, 64, 64, 0.06);
      }
      .node-hit.status-frozen {
        fill: rgba(74, 127, 181, 0.06);
      }
      .node-hit.status-active {
        fill: rgba(232, 155, 26, 0.08);
      }
      .node-hit.status-review {
        fill: rgba(155, 89, 182, 0.06);
      }

      .label-node.status-placeholder {
        opacity: 0.55;
      }
      .label-node.status-frozen {
        opacity: 0.7;
      }

      .inline-node-editor {
        position: absolute;
        z-index: 20;
        border: 2px solid var(--accent);
        border-radius: 8px;
        background: #fff;
        color: #232323;
        padding: 4px 8px;
        font-size: 22px;
        line-height: 1.2;
        resize: none;
        overflow: hidden;
        white-space: pre-wrap;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.14);
      }

      .latex-node-content {
        display: flex;
        align-items: center;
        height: 100%;
        padding: 0 4px;
        box-sizing: border-box;
        color: var(--ink);
        font-size: 44px;
        pointer-events: none;
      }

      .latex-node-content .katex-display {
        margin: 0;
      }

      /* ── Entity List Panel (left sidebar, Miro Frames-style) ── */
      .entity-list-panel {
        position: absolute;
        top: 60px;
        left: 14px;
        z-index: 12;
        width: 320px;
        max-height: calc(100vh - 90px);
        display: flex;
        flex-direction: column;
        border: 1px solid #ddd;
        border-radius: 14px;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        box-shadow: 0 12px 34px rgba(24, 24, 24, 0.14);
        pointer-events: auto;
        overflow: hidden;
      }

      .entity-list-panel[hidden] {
        display: none;
      }

      .entity-list-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 12px 14px 8px;
        border-bottom: 1px solid #e8e8e8;
        flex-shrink: 0;
      }

      .entity-list-title {
        font-size: 14px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        color: var(--accent);
      }

      .entity-list-close {
        width: 28px;
        height: 28px;
        border: none;
        background: none;
        font-size: 18px;
        color: #999;
        cursor: pointer;
        border-radius: 6px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0;
      }

      .entity-list-close:hover {
        background: #f0f0f0;
        color: #333;
      }

      .entity-list-search-wrap {
        padding: 8px 14px;
        flex-shrink: 0;
      }

      .entity-list-search {
        width: 100%;
        min-width: 0;
        padding: 6px 10px;
        border: 1px solid #d4d4d4;
        border-radius: 8px;
        background: #fff;
        font-size: 13px;
        outline: none;
      }

      .entity-list-search:focus {
        border-color: var(--accent);
        box-shadow: 0 0 0 2px var(--accent-soft);
      }

      .entity-list-tree {
        flex: 1;
        overflow-y: auto;
        padding: 4px 0 8px;
      }

      .entity-row {
        display: flex;
        align-items: center;
        gap: 4px;
        padding: 4px 14px 4px;
        cursor: pointer;
        user-select: none;
        transition: background 0.08s ease;
        font-size: 13px;
        color: var(--ink);
        line-height: 1.4;
      }

      .entity-row:hover {
        background: rgba(122, 53, 255, 0.06);
      }

      .entity-row.is-selected {
        background: var(--accent-soft);
        color: #5221b2;
        font-weight: 600;
      }

      .entity-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 16px;
        height: 16px;
        font-size: 10px;
        color: #999;
        flex-shrink: 0;
        transition: transform 0.12s ease;
        border: none;
        background: none;
        padding: 0;
        cursor: pointer;
      }

      .entity-toggle.expanded {
        transform: rotate(90deg);
      }

      .entity-toggle.no-children {
        visibility: hidden;
      }

      .entity-name {
        flex: 1;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }

      .entity-badge {
        font-size: 10px;
        font-weight: 600;
        padding: 1px 5px;
        border-radius: 4px;
        flex-shrink: 0;
      }

      .entity-badge-folder {
        background: #fff3e2;
        color: #9a6b1f;
      }

      .entity-badge-alias {
        background: #e8f0ff;
        color: #2f5fd9;
      }

      .entity-children {
        padding-left: 16px;
      }

      .entity-children[hidden] {
        display: none;
      }

      .entity-row .entity-highlight {
        background: #ffe066;
        border-radius: 2px;
      }

      /* ── Entity Scope List (Frames-style) ── */
      .entity-scope-list {
        padding: 6px 10px 2px;
        border-bottom: 1px solid #e8e8e8;
        flex-shrink: 0;
        max-height: 160px;
        overflow-y: auto;
      }

      .entity-scope-list:empty {
        display: none;
      }

      .entity-scope-row {
        display: flex;
        align-items: center;
        gap: 6px;
        padding: 4px 8px;
        border-radius: 6px;
        cursor: pointer;
        user-select: none;
        transition: background 0.08s ease;
        font-size: 12px;
        color: var(--ink);
        line-height: 1.4;
      }

      .entity-scope-row:hover {
        background: rgba(122, 53, 255, 0.06);
      }

      .entity-scope-row.is-current-scope {
        background: var(--accent-soft);
        color: #5221b2;
        font-weight: 600;
      }

      .entity-scope-icon {
        flex-shrink: 0;
        font-size: 11px;
        color: #9a6b1f;
      }

      .entity-scope-name {
        flex: 1;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }

      .entity-scope-count {
        font-size: 10px;
        color: #999;
        flex-shrink: 0;
      }

      /* ── Presence Badge ── */
      .presence-badge {
        display: inline-block;
        width: 10px;
        height: 10px;
        border-radius: 50%;
        flex-shrink: 0;
        border: 1.5px solid #fff;
        box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
        margin-left: 2px;
      }

      .presence-badges {
        display: inline-flex;
        align-items: center;
        gap: 2px;
        flex-shrink: 0;
        margin-left: auto;
        padding-left: 4px;
      }

      /* ── Change Highlight (away changes) ── */
      .entity-row.has-changes {
        border-left: 3px solid #e0a35c;
        padding-left: 11px;
      }

      /* ── Conflict Panel ── */
      .conflict-panel {
        position: absolute;
        inset: 0;
        z-index: 25;
        display: flex;
        flex-direction: column;
        background: rgba(255, 255, 255, 0.96);
        backdrop-filter: blur(12px);
        pointer-events: auto;
        overflow: hidden;
      }

      .conflict-panel[hidden] {
        display: none;
      }

      .conflict-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 16px 24px 12px;
        border-bottom: 1px solid #e8e8e8;
        flex-shrink: 0;
      }

      .conflict-title {
        font-size: 18px;
        font-weight: 700;
        color: #a35d16;
        letter-spacing: 0.02em;
      }

      .conflict-close {
        width: 32px;
        height: 32px;
        border: none;
        background: none;
        font-size: 20px;
        color: #999;
        cursor: pointer;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0;
      }

      .conflict-close:hover {
        background: #f0f0f0;
        color: #333;
      }

      .conflict-body {
        flex: 1;
        display: flex;
        flex-direction: column;
        padding: 16px 24px;
        gap: 16px;
        overflow-y: auto;
      }

      .conflict-columns {
        display: flex;
        gap: 16px;
        flex: 1;
        min-height: 0;
      }

      .conflict-col {
        flex: 1;
        display: flex;
        flex-direction: column;
        border: 1px solid #e0e0e0;
        border-radius: 10px;
        overflow: hidden;
        min-width: 0;
      }

      .conflict-col-header {
        padding: 8px 12px;
        font-size: 12px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        color: #888;
        background: #f8f8f8;
        border-bottom: 1px solid #e8e8e8;
        flex-shrink: 0;
      }

      .conflict-tree {
        flex: 1;
        overflow-y: auto;
        padding: 8px 0;
      }

      .conflict-node-row {
        display: flex;
        align-items: center;
        gap: 6px;
        padding: 3px 12px;
        font-size: 13px;
        color: var(--ink);
        line-height: 1.4;
      }

      .conflict-node-row.diff-added {
        background: #e8f7ee;
        color: #1f7a43;
      }

      .conflict-node-row.diff-removed {
        background: #fde8e8;
        color: #b94040;
      }

      .conflict-node-row.diff-changed {
        background: #fff3e2;
        color: #a35d16;
      }

      .conflict-node-indent {
        display: inline-block;
        flex-shrink: 0;
      }

      .conflict-node-text {
        flex: 1;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }

      .conflict-diff {
        padding: 10px 14px;
        font-size: 12px;
        color: #666;
        background: #f8f8f8;
        border-radius: 8px;
        border: 1px solid #e8e8e8;
        flex-shrink: 0;
      }

      .conflict-actions {
        display: flex;
        gap: 10px;
        justify-content: flex-end;
        flex-shrink: 0;
      }

      .conflict-actions button {
        min-width: 120px;
        padding: 8px 16px;
        font-size: 14px;
        font-weight: 600;
        border-radius: 8px;
      }

      @media (max-width: 900px) {
        .entity-list-panel {
          width: 280px;
          left: 10px;
          top: 56px;
        }

        .conflict-columns {
          flex-direction: column;
        }
      }

      /* ── Shortcut Cheatsheet Overlay ── */
      .shortcut-cheatsheet {
        position: absolute;
        inset: 0;
        z-index: 30;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        background: rgba(0, 0, 0, 0.45);
        backdrop-filter: blur(4px);
        pointer-events: none;
      }
      .shortcut-cheatsheet:not([hidden]) {
        display: flex;
        pointer-events: auto;
      }
      .cheatsheet-header {
        font-size: 18px;
        font-weight: 700;
        color: #fff;
        margin-bottom: 12px;
        letter-spacing: 0.04em;
      }
      .cheatsheet-body {
        display: flex;
        gap: 32px;
        background: #fff;
        border-radius: 12px;
        padding: 20px 28px;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
        max-height: 80vh;
        overflow-y: auto;
      }
      .cheatsheet-col {
        display: flex;
        flex-direction: column;
        gap: 16px;
        min-width: 220px;
      }
      .cheatsheet-group-title {
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        color: var(--accent);
        letter-spacing: 0.08em;
        margin-bottom: 4px;
      }
      .cheatsheet-row {
        display: flex;
        align-items: center;
        gap: 8px;
        font-size: 13px;
        color: var(--ink);
        line-height: 1.7;
      }
      .cheatsheet-row kbd {
        display: inline-block;
        min-width: 24px;
        padding: 1px 6px;
        background: #f0f0f0;
        border: 1px solid #d0d0d0;
        border-radius: 4px;
        font-family: inherit;
        font-size: 12px;
        text-align: center;
        color: #333;
        box-shadow: 0 1px 0 #bbb;
      }
      .cheatsheet-row span {
        color: #555;
      }
      .cheatsheet-automaton {
        display: flex;
        align-items: center;
        gap: 0;
        margin-top: 14px;
        background: #fff;
        border-radius: 10px;
        padding: 14px 24px;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
      }
      .automaton-node {
        width: 96px;
        height: 96px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 11px;
        font-weight: 700;
        letter-spacing: 0.03em;
        flex-shrink: 0;
        border: 3px solid;
      }
      .automaton-navigating {
        border-color: var(--accent, #4a7adb);
        color: var(--accent, #4a7adb);
        background: rgba(74, 122, 219, 0.08);
      }
      .automaton-editing {
        border-color: #e67e22;
        color: #e67e22;
        background: rgba(230, 126, 34, 0.08);
      }
      .automaton-arrows {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        width: 160px;
        flex-shrink: 0;
      }
      .automaton-arrow {
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 100%;
      }
      .automaton-label {
        font-size: 9px;
        color: #666;
        white-space: nowrap;
        line-height: 1.3;
      }
      .automaton-svg {
        width: 100%;
        height: 12px;
      }
      .automaton-svg path {
        stroke: #888;
        stroke-width: 1.5;
        fill: none;
      }
      .automaton-svg polygon {
        fill: #888;
      }
      .automaton-self-loop {
        display: flex;
        flex-direction: row;
        align-items: center;
        margin-left: -4px;
      }
      .automaton-self-loop .automaton-label {
        text-align: left;
      }
      .automaton-self-svg {
        width: 24px;
        height: 80px;
        flex-shrink: 0;
      }
      .automaton-self-svg path {
        stroke: #e67e22;
        stroke-width: 1.5;
        fill: none;
      }
      .automaton-self-svg polygon {
        fill: #e67e22;
      }
      .cheatsheet-hint {
        margin-top: 10px;
        font-size: 12px;
        color: rgba(255, 255, 255, 0.7);
      }

      /* ── Home Screen ── */
      .home-screen {
        position: absolute;
        inset: 0;
        z-index: 10;
        display: flex;
        flex-direction: column;
        background: rgba(255, 255, 255, 0.92);
        backdrop-filter: blur(12px);
        overflow-y: auto;
        pointer-events: auto;
      }

      .home-screen[hidden] {
        display: none;
      }

      .home-header {
        flex-shrink: 0;
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 20px 28px 12px;
        border-bottom: 1px solid #e8e8e8;
      }

      .home-title {
        margin: 0;
        font-size: 22px;
        font-weight: 700;
        color: var(--accent);
        letter-spacing: 0.02em;
      }

      .home-body {
        flex: 1;
        padding: 20px 28px;
        max-width: 800px;
      }

      .home-section-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 12px;
      }

      .home-section-title {
        font-size: 14px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        color: #888;
      }

      .home-scope-tree {
        display: flex;
        flex-direction: column;
        gap: 0;
      }

      .home-scope-row {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 8px 12px;
        border-radius: 8px;
        cursor: pointer;
        user-select: none;
        transition: background 0.1s ease;
      }

      .home-scope-row:hover {
        background: rgba(122, 53, 255, 0.06);
      }

      .home-scope-row:active {
        background: rgba(122, 53, 255, 0.12);
      }

      .home-scope-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 20px;
        height: 20px;
        font-size: 12px;
        color: #999;
        flex-shrink: 0;
        transition: transform 0.15s ease;
        border: none;
        background: none;
        padding: 0;
        cursor: pointer;
      }

      .home-scope-toggle.expanded {
        transform: rotate(90deg);
      }

      .home-scope-toggle.no-children {
        visibility: hidden;
      }

      .home-scope-name {
        font-size: 15px;
        font-weight: 500;
        color: var(--ink);
        flex: 1;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }

      .home-scope-count {
        font-size: 12px;
        color: #999;
        flex-shrink: 0;
      }

      .home-scope-children {
        padding-left: 20px;
      }

      .home-scope-children[hidden] {
        display: none;
      }

      .home-breadcrumb {
        display: flex;
        align-items: center;
        gap: 4px;
        padding: 4px 0 8px;
        font-size: 12px;
        color: #888;
        flex-shrink: 0;
      }

      .home-breadcrumb-item {
        cursor: pointer;
        color: var(--accent);
        text-decoration: none;
        border: none;
        background: none;
        padding: 2px 4px;
        border-radius: 4px;
        font-size: 12px;
        font-family: inherit;
      }

      .home-breadcrumb-item:hover {
        background: var(--accent-soft);
      }

      .home-breadcrumb-item.current {
        color: var(--ink);
        cursor: default;
        font-weight: 600;
      }

      .home-breadcrumb-item.current:hover {
        background: transparent;
      }

      .home-breadcrumb-sep {
        color: #ccc;
        user-select: none;
      }

      /* ── Scope Lock Indicators ── */
      .node-hit.scope-locked {
        stroke: #c5890a;
        stroke-width: 2.5;
        stroke-dasharray: none;
      }

      .node-hit.scope-locked-by-other {
        stroke: #d64b4b;
        stroke-width: 2.5;
      }

      .lock-icon {
        font-size: 12px;
        fill: #c5890a;
        pointer-events: none;
      }

      .lock-icon-other {
        fill: #d64b4b;
      }

      .entity-scope-lock-badge {
        font-size: 9px;
        font-weight: 600;
        padding: 1px 4px;
        border-radius: 3px;
        flex-shrink: 0;
        margin-left: auto;
      }

      .entity-scope-lock-badge.lock-own {
        background: #fff3e2;
        color: #9a6b1f;
      }

      .entity-scope-lock-badge.lock-other {
        background: #ffe5e5;
        color: #c0392b;
      }

      .entity-scope-lock-tooltip {
        font-size: 10px;
        color: #999;
        margin-left: 4px;
        flex-shrink: 0;
      }

      /* Lock/Unlock action buttons in entity scope list */
      .entity-scope-lock-btn {
        font-size: 10px;
        padding: 1px 6px;
        border: 1px solid #ddd;
        border-radius: 4px;
        background: #fff;
        cursor: pointer;
        flex-shrink: 0;
        margin-left: 4px;
        line-height: 1.4;
        color: var(--ink);
        opacity: 0;
        transition: opacity 0.12s ease;
      }

      .entity-scope-row:hover .entity-scope-lock-btn {
        opacity: 1;
      }

      .entity-scope-lock-btn:hover {
        background: var(--accent-soft);
        border-color: var(--accent);
      }

      .entity-scope-lock-btn.unlock-btn {
        color: var(--danger);
        border-color: #f0c0c0;
      }

      .entity-scope-lock-btn.unlock-btn:hover {
        background: #ffe5e5;
      }

      /* ── Broken Alias Indicators ── */
      .entity-badge-broken {
        background: #ffe5e5;
        color: #c0392b;
      }

      .entity-row.alias-broken-row {
        background: rgba(214, 75, 75, 0.06);
      }

      .entity-alias-action-btn {
        font-size: 10px;
        padding: 1px 5px;
        border: 1px solid #ddd;
        border-radius: 4px;
        background: #fff;
        cursor: pointer;
        flex-shrink: 0;
        margin-left: 2px;
        line-height: 1.4;
        opacity: 0;
        transition: opacity 0.12s ease;
      }

      .entity-row:hover .entity-alias-action-btn {
        opacity: 1;
      }

      .entity-alias-action-btn.repair-btn {
        color: #2f5fd9;
        border-color: #b8ccf0;
      }

      .entity-alias-action-btn.repair-btn:hover {
        background: #e8f0ff;
      }

      .entity-alias-action-btn.delete-btn {
        color: var(--danger);
        border-color: #f0c0c0;
      }

      .entity-alias-action-btn.delete-btn:hover {
        background: #ffe5e5;
      }

      /* ── Context Menu ── */
      .scope-context-menu {
        position: fixed;
        z-index: 100;
        background: #fff;
        border: 1px solid #ddd;
        border-radius: 8px;
        box-shadow: 0 4px 16px rgba(0,0,0,0.12);
        padding: 4px 0;
        min-width: 160px;
      }

      .scope-context-menu-item {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 6px 14px;
        font-size: 13px;
        cursor: pointer;
        color: var(--ink);
        user-select: none;
        transition: background 0.08s ease;
      }

      .scope-context-menu-item:hover {
        background: rgba(122, 53, 255, 0.06);
      }

      .scope-context-menu-item.danger {
        color: var(--danger);
      }

      .scope-context-menu-item.danger:hover {
        background: #ffe5e5;
      }

      .scope-context-menu-sep {
        height: 1px;
        background: #eee;
        margin: 3px 8px;
      }

      /* ── Color Palette Popover (Miro-style node decoration) ── */
      .color-palette-popover {
        position: fixed;
        z-index: 100;
        background: #fff;
        border: 1px solid #ddd;
        border-radius: 10px;
        box-shadow: 0 4px 16px rgba(0,0,0,0.14);
        padding: 8px;
        display: grid;
        grid-template-columns: repeat(5, 24px);
        gap: 6px;
      }

      .color-palette-swatch {
        width: 24px;
        height: 24px;
        border-radius: 50%;
        border: 1px solid rgba(0,0,0,0.18);
        cursor: pointer;
        padding: 0;
        transition: transform 0.08s ease, box-shadow 0.08s ease;
      }

      .color-palette-swatch:hover {
        transform: scale(1.15);
        box-shadow: 0 2px 6px rgba(0,0,0,0.18);
      }

      .color-palette-swatch.clear {
        background: #fff;
        color: #888;
        font-size: 12px;
        line-height: 1;
      }

      /* Hide board and linear panel when home screen is visible */
      .app.home-active .workspace {
        visibility: hidden;
      }

      @media (max-width: 900px) {
        .label-root,
        .label-node {
          /* font-size now controlled by inline SVG attribute from tuning constants */
        }
      }

      /* ------------------------------------------------------------------
         Markdown preview panel (Alt+D)
         ------------------------------------------------------------------ */
      .markdown-preview-panel {
        position: absolute;
        top: 60px;
        right: 14px;
        z-index: 13;
        width: 420px;
        max-width: calc(100vw - 40px);
        max-height: calc(100vh - 90px);
        display: flex;
        flex-direction: column;
        border: 1px solid #ddd;
        border-radius: 14px;
        background: rgba(255, 255, 255, 0.97);
        backdrop-filter: blur(10px);
        box-shadow: 0 12px 34px rgba(24, 24, 24, 0.16);
        pointer-events: auto;
        overflow: hidden;
      }

      .markdown-preview-panel[hidden] {
        display: none;
      }

      .markdown-preview-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 10px 14px;
        border-bottom: 1px solid #e8e8e8;
        flex-shrink: 0;
      }

      .markdown-preview-title {
        font-size: 13px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        color: var(--accent, #3b6ea8);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }

      .markdown-preview-close {
        background: transparent;
        border: none;
        font-size: 20px;
        line-height: 1;
        cursor: pointer;
        color: #666;
        padding: 0 4px;
      }

      .markdown-preview-close:hover {
        color: #000;
      }

      .markdown-preview-body {
        padding: 12px 16px;
        overflow: auto;
        font-size: 13px;
        line-height: 1.55;
        color: #222;
      }

      .markdown-preview-body h1,
      .markdown-preview-body h2,
      .markdown-preview-body h3,
      .markdown-preview-body h4,
      .markdown-preview-body h5,
      .markdown-preview-body h6 {
        margin: 0.8em 0 0.4em;
        line-height: 1.25;
      }

      .markdown-preview-body h1 { font-size: 1.45em; }
      .markdown-preview-body h2 { font-size: 1.25em; }
      .markdown-preview-body h3 { font-size: 1.1em; }

      .markdown-preview-body p {
        margin: 0.5em 0;
      }

      .markdown-preview-body code {
        background: #f2f2f2;
        padding: 1px 4px;
        border-radius: 3px;
        font-family: "Menlo", "Consolas", monospace;
        font-size: 0.92em;
      }

      .markdown-preview-body pre {
        background: #f6f6f6;
        border: 1px solid #e4e4e4;
        border-radius: 6px;
        padding: 10px 12px;
        overflow: auto;
        font-size: 0.88em;
      }

      .markdown-preview-body pre code {
        background: transparent;
        padding: 0;
      }

      .markdown-preview-body blockquote {
        border-left: 3px solid #c6d2e0;
        margin: 0.6em 0;
        padding: 0.1em 0.9em;
        color: #555;
        background: #f7f9fc;
      }

      .markdown-preview-body ul,
      .markdown-preview-body ol {
        padding-left: 1.5em;
        margin: 0.4em 0;
      }

      .markdown-preview-body a {
        color: #2a6ac1;
        text-decoration: underline;
      }

      .markdown-preview-body img {
        max-width: 100%;
      }

      .markdown-preview-body hr {
        border: 0;
        border-top: 1px solid #e0e0e0;
        margin: 0.8em 0;
      }

      .markdown-mermaid {
        margin: 0.6em 0;
        text-align: center;
      }

      .markdown-mermaid svg {
        max-width: 100%;
        height: auto;
      }

      .markdown-mermaid-fallback,
      .markdown-mermaid-error {
        text-align: left;
      }

      .markdown-mermaid-error-msg {
        color: #b84a4a;
        font-size: 0.85em;
        margin-top: 4px;
      }

      .home-page {
        margin: 0;
        background: #fafafa;
        color: var(--ink);
        font-family: inherit;
        min-height: 100vh;
        overflow: auto;
      }

      .home-top {
        position: sticky;
        top: 0;
        z-index: 10;
        background: rgba(255, 255, 255, 0.92);
        backdrop-filter: blur(10px);
        border-bottom: 1px solid #e8e8e8;
      }

      .home-top-inner {
        max-width: 1080px;
        margin: 0 auto;
        padding: 14px 28px;
        display: flex;
        align-items: center;
        gap: 16px;
      }

      .home-logo {
        font-size: 22px;
        font-weight: 700;
        color: var(--accent);
        letter-spacing: 0.02em;
        text-decoration: none;
        cursor: default;
      }

      .home-top-spacer {
        flex: 1;
      }

      .home-main {
        max-width: 1080px;
        margin: 0 auto;
        padding: 28px;
        display: flex;
        flex-direction: column;
        gap: 36px;
      }

      .home-section {
        display: flex;
        flex-direction: column;
        gap: 12px;
      }

      .home-section-head {
        display: flex;
        align-items: center;
        gap: 12px;
        justify-content: space-between;
        flex-wrap: wrap;
      }

      .home-section-title {
        margin: 0;
        font-size: 13px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.08em;
        color: #888;
        display: inline-flex;
        align-items: center;
        gap: 6px;
      }

      .home-section-icon {
        color: #f0ad00;
        font-size: 14px;
      }

      .home-create-grid {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 12px;
      }

      @media (max-width: 780px) {
        .home-create-grid {
          grid-template-columns: 1fr;
        }
      }

      .home-create-card {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        padding: 20px;
        border: 1px dashed #cfcfd6;
        border-radius: 14px;
        background: #fff;
        cursor: pointer;
        transition: border-color 0.12s ease, box-shadow 0.12s ease, transform 0.05s ease;
        text-align: left;
        font: inherit;
        color: inherit;
      }

      .home-create-card:hover {
        border-color: var(--accent);
        box-shadow: 0 6px 18px rgba(122, 53, 255, 0.08);
      }

      .home-create-card:active {
        transform: translateY(1px);
      }

      .home-create-icon {
        font-size: 22px;
      }

      .home-create-label {
        font-size: 15px;
        font-weight: 600;
      }

      .home-create-sub {
        font-size: 12px;
        color: #888;
      }

      .home-pinned-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 12px;
      }

      .home-pinned-card {
        display: flex;
        flex-direction: column;
        gap: 6px;
        padding: 14px;
        border: 1px solid #e6e6ea;
        border-radius: 12px;
        background: #fff;
        cursor: pointer;
        transition: border-color 0.12s ease, box-shadow 0.12s ease;
      }

      .home-pinned-card:hover {
        border-color: var(--accent);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
      }

      .home-pinned-icon {
        font-size: 22px;
      }

      .home-pinned-label {
        font-size: 14px;
        font-weight: 600;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }

      .home-pinned-meta {
        font-size: 11px;
        color: #888;
      }

      .home-search {
        min-width: 220px;
        padding: 8px 12px;
        border: 1px solid #ddd;
        border-radius: 10px;
        background: #fff;
        font: inherit;
      }

      .home-search:focus {
        outline: none;
        border-color: var(--accent);
        box-shadow: 0 0 0 3px rgba(122, 53, 255, 0.14);
      }

      .home-map-list {
        display: flex;
        flex-direction: column;
        gap: 0;
        border: 1px solid #e6e6ea;
        border-radius: 12px;
        background: #fff;
        overflow: hidden;
      }

      .home-map-row {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 14px;
        border-bottom: 1px solid #f0f0f3;
      }

      .home-map-row:last-child {
        border-bottom: none;
      }

      .home-map-row:hover {
        background: #fafafb;
      }

      .home-map-row.is-archived {
        opacity: 0.72;
      }

      .home-map-pin {
        width: 28px;
        height: 28px;
        border: none;
        background: none;
        cursor: pointer;
        font-size: 18px;
        color: #bbb;
        flex-shrink: 0;
        border-radius: 6px;
      }

      .home-map-pin:hover {
        background: rgba(240, 173, 0, 0.14);
        color: #f0ad00;
      }

      .home-map-pin.is-pinned {
        color: #f0ad00;
      }

      .home-map-icon {
        font-size: 18px;
        flex-shrink: 0;
      }

      .home-map-body {
        flex: 1;
        min-width: 0;
        display: flex;
        flex-direction: column;
        gap: 2px;
      }

      .home-map-label {
        font-size: 15px;
        font-weight: 600;
        color: var(--ink);
        text-decoration: none;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }

      .home-map-label:hover {
        color: var(--accent);
        text-decoration: underline;
      }

      .home-map-meta {
        font-size: 12px;
        color: #888;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }

      .home-map-actions {
        display: flex;
        align-items: center;
        gap: 4px;
        flex-shrink: 0;
      }

      .home-map-action {
        padding: 5px 10px;
        border: 1px solid transparent;
        border-radius: 6px;
        background: none;
        cursor: pointer;
        font: inherit;
        font-size: 12px;
        color: #555;
      }

      .home-map-action:hover {
        background: #f0f0f3;
        border-color: #ddd;
      }

      .home-map-action.primary {
        border-color: var(--accent);
        color: var(--accent);
        font-weight: 600;
      }

      .home-map-action.primary:hover {
        background: var(--accent-soft);
      }

      .home-map-action.danger {
        color: #c33;
      }

      .home-map-action.danger:hover {
        background: rgba(204, 51, 51, 0.08);
        border-color: #d88;
      }

      .home-empty {
        padding: 40px;
        text-align: center;
        color: #888;
        font-size: 14px;
        border: 1px dashed #e0e0e5;
        border-radius: 12px;
        background: #fff;
      }

      .home-archived-toggle {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        padding: 8px 12px;
        border: none;
        background: none;
        cursor: pointer;
        font: inherit;
        font-size: 13px;
        font-weight: 600;
        color: #666;
        border-radius: 8px;
      }

      .home-archived-toggle:hover {
        background: #efeff2;
      }

      .home-archived-caret {
        display: inline-block;
        transition: transform 0.15s ease;
      }

      .home-archived-toggle.is-expanded .home-archived-caret {
        transform: rotate(90deg);
      }

      .home-archived-count {
        color: #888;
        font-weight: 500;
        font-size: 12px;
      }

      .home-map-list--archived {
        margin-top: 10px;
      }

      .home-status {
        position: fixed;
        bottom: 18px;
        right: 18px;
        padding: 10px 14px;
        border-radius: 8px;
        background: rgba(30, 30, 30, 0.92);
        color: #fff;
        font-size: 12px;
        max-width: 320px;
        pointer-events: none;
        transition: opacity 0.2s ease;
      }

      .home-status:empty {
        opacity: 0;
      }

      .home-menu {
        position: fixed;
        z-index: 100;
        display: flex;
        flex-direction: column;
        gap: 2px;
        padding: 6px;
        background: #fff;
        border: 1px solid #ddd;
        border-radius: 10px;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
        min-width: 180px;
      }

      .home-menu[hidden] {
        display: none;
      }

      .home-menu-item {
        text-align: left;
        padding: 6px 10px;
        border: none;
        background: none;
        border-radius: 6px;
        cursor: pointer;
        font: inherit;
        font-size: 13px;
        color: #333;
      }

      .home-menu-item:hover {
        background: #f2f2f6;
      }

      .home-menu-item.danger {
        color: #c33;
      }

      .home-menu-item.danger:hover {
        background: rgba(204, 51, 51, 0.08);
      }

      .viewer-logo {
        font-size: 16px;
        font-weight: 700;
        color: var(--accent);
        letter-spacing: 0.02em;
        padding: 4px 8px;
        border-radius: 8px;
        text-decoration: none;
        pointer-events: auto;
      }

      .viewer-logo:hover {
        background: var(--accent-soft);
      }

      /* ── m3e: table view ── */
      .m3e-table-container {
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
        font-size: 13px;
        overflow: auto;
        max-height: 780px;
        background: #fff;
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.08);
      }
      .m3e-table-view {
        border-collapse: collapse;
        width: 100%;
      }
      .m3e-table-view th {
        background: #f5f5f7;
        border-bottom: 2px solid #ddd;
        padding: 6px 10px;
        text-align: left;
        font-weight: 600;
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: #555;
        position: sticky;
        top: 0;
        z-index: 1;
      }
      .m3e-table-view td {
        padding: 5px 10px;
        border-bottom: 1px solid #eee;
        color: #333;
        max-width: 300px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      .m3e-table-view tr:hover {
        background: rgba(106, 53, 255, 0.04);
      }
      .m3e-table-view .m3e-table-name {
        font-weight: 500;
        color: #232323;
      }
      .m3e-table-view tr.status-placeholder td { opacity: 0.5; }
      .m3e-table-view tr.status-confirmed td:first-child { border-left: 3px solid #2d8c4e; }
      .m3e-table-view tr.status-contested td:first-child { border-left: 3px solid #d94040; }
      .m3e-table-view tr.status-frozen td { opacity: 0.7; }
      .m3e-table-view tr.status-active td:first-child { border-left: 3px solid #e89b1a; }
      .m3e-table-view tr.status-review td:first-child { border-left: 3px solid #9b59b6; }
