/* =============================================================
   Admember 組織図 (紹介 / バイナリ)
   ============================================================= */

.org-map-page {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 10px;
}

.org-map-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.org-map-toolbar .map-zoom-in,
.org-map-toolbar .map-zoom-out,
.org-map-toolbar .map-zoom-reset {
  min-width: 36px;
}

/* 紹介ツリー一覧。高さを固定した行だけを表示し、大量の配下もスクロールで閲覧する。 */
.intro-view-switch { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 8px; }
.intro-tree-pane { display: flex; flex: 1; min-height: 0; flex-direction: column; gap: 7px; }
.intro-tree-pane[hidden], .org-map-canvas[hidden] { display: none; }
.intro-tree-summary { padding: 0 5px; min-height: 20px; }
.intro-tree-scroll {
  flex: 1; min-height: 200px; overflow: auto; background: var(--surface, #fff);
  border: 1px solid var(--line); border-radius: 12px;
}
.intro-tree-scroll:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.intro-tree-table { width: 100%; min-width: 1120px; border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
.intro-tree-table th {
  position: sticky; top: 0; z-index: 1; height: 40px; padding: 8px 12px;
  background: var(--nav-bg, #f0f4fa); border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap;
}
.intro-tree-table td { height: 40px; padding: 0 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.intro-tree-table th:first-child { min-width: 320px; }
.intro-tree-table td.numeric, .intro-tree-table th.numeric { text-align: right; font-variant-numeric: tabular-nums; }
.intro-tree-table tbody tr:hover td { background: var(--accent-softer, #f4f8fd); }
.intro-tree-table .intro-tree-root td { background: var(--accent-softer, #f4f8fd); font-weight: 600; }
.intro-tree-name { display: flex; align-items: center; gap: 7px; height: 39px; }
.intro-tree-toggle, .intro-tree-leaf { width: 25px; flex: 0 0 25px; text-align: center; }
.intro-tree-toggle { height: 28px; border: 0; border-radius: 5px; background: transparent; cursor: pointer; color: var(--ink-3); font-size: 10px; }
.intro-tree-toggle:hover { background: var(--accent-soft); color: var(--accent); }
.intro-tree-toggle:disabled { cursor: wait; opacity: .5; }
.intro-tree-member { padding: 0; border: 0; background: transparent; color: var(--accent); font: inherit; cursor: pointer; text-align: left; }
.intro-tree-member:hover { text-decoration: underline; }
.intro-tree-empty { padding: 24px; }

/* キャンバス */
.org-map-canvas {
  position: relative;
  flex: 1;
  min-height: 480px;
  width: 100%;
  overflow: hidden;
  cursor: grab;
  user-select: none;
  background: var(--surface, #ffffff);
  border: 1px solid var(--line, #e3e7ee);
  border-radius: var(--radius-lg, 14px);
  box-shadow: var(--shadow-1, 0 1px 2px rgba(16, 24, 38, 0.05));
}

.org-map-canvas.is-dragging,
.org-map-canvas:active {
  cursor: grabbing;
}

.org-map-svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* ステータス色 (sample 準拠 + app トークン) */
.org-map-canvas {
  --node-bg-aqua: #e0f7fa;
  --node-border-aqua: #00acc1;
  --node-text-aqua: #006064;

  --node-bg-temp: var(--warn-bg, #fdf3dd);
  --node-border-temp: var(--warn, #b97700);
  --node-text-temp: #7a5200;

  --node-bg-confirm: var(--good-bg, #e9f7e9);
  --node-border-confirm: var(--good, #0ca30c);
  --node-text-confirm: var(--good-ink, #056d05);

  --node-bg-active: var(--accent-soft, #e8f1fc);
  --node-border-active: var(--accent, #2a78d6);
  --node-text-active: var(--accent-strong, #1c5cab);

  --connector-color: #90a4ae;
  --connector-width: 2px;
}

.connector {
  fill: none;
  stroke: var(--connector-color);
  stroke-width: var(--connector-width);
  stroke-linecap: round;
}

.connector.highlight {
  stroke: var(--accent, #2a78d6);
  stroke-width: 3px;
}

.node-group {
  cursor: pointer;
}

.node-card {
  rx: 8px;
  ry: 8px;
  stroke-width: 1.5px;
  transition: filter 0.2s, stroke-width 0.2s;
}

.node-group:hover .node-card {
  filter: drop-shadow(0 5px 8px rgba(0, 0, 0, 0.15));
  stroke-width: 2.5px;
}

.node-status-aqua {
  fill: var(--node-bg-aqua);
  stroke: var(--node-border-aqua);
}

.node-status-temp {
  fill: var(--node-bg-temp);
  stroke: var(--node-border-temp);
}

.node-status-confirm {
  fill: var(--node-bg-confirm);
  stroke: var(--node-border-confirm);
}

.node-status-active {
  fill: var(--node-bg-active);
  stroke: var(--node-border-active);
}

.node-text {
  font-size: 12px;
  fill: var(--ink-2, #4b5563);
  pointer-events: none;
}

.node-title {
  font-size: 14px;
  font-weight: bold;
}

.node-title-aqua { fill: var(--node-text-aqua); }
.node-title-temp { fill: var(--node-text-temp); }
.node-title-confirm { fill: var(--node-text-confirm); }
.node-title-active { fill: var(--node-text-active); }

.node-member-id {
  font-family: var(--mono, Consolas, monospace);
  font-size: 12px;
  fill: var(--ink, #1a2330);
}

.node-point-label {
  fill: var(--ink-3, #8a94a3);
  font-size: 10px;
}

.node-point-val {
  font-size: 12px;
  font-weight: bold;
  fill: var(--good-ink, #056d05);
}

.expand-button-group {
  cursor: pointer;
}

.expand-button-bg {
  fill: var(--accent, #2a78d6);
  stroke: #ffffff;
  stroke-width: 1.5px;
  transition: fill 0.2s;
}

.expand-button-group:hover .expand-button-bg {
  fill: var(--accent-strong, #1c5cab);
}

.expand-button-text {
  fill: #ffffff;
  font-size: 14px;
  font-weight: bold;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}

/* ツールチップ */
.org-map-tooltip {
  position: absolute;
  background: rgba(26, 35, 48, 0.95);
  color: #f2f5f9;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  pointer-events: none;
  z-index: 30;
  box-shadow: var(--shadow-2, 0 4px 16px rgba(16, 24, 38, 0.1));
  line-height: 1.5;
  max-width: 320px;
}

.org-map-tooltip[hidden] {
  display: none !important;
}

.org-map-tooltip h5 {
  margin: 0 0 6px;
  font-size: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  padding-bottom: 4px;
}

.org-map-tooltip-section {
  margin-top: 5px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 3px;
}

/* ローディング */
.org-map-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.72);
  z-index: 20;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2, #4b5563);
}

.org-map-loading[hidden] {
  display: none !important;
}

.org-map-loading.is-active::before {
  content: "";
  width: 28px;
  height: 28px;
  margin-right: 10px;
  border: 3px solid var(--line, #e3e7ee);
  border-top-color: var(--accent, #2a78d6);
  border-radius: 50%;
  animation: org-map-spin 0.9s linear infinite;
}

@keyframes org-map-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 860px) {
  .org-map-canvas {
    min-height: 360px;
  }
}
