.toc { --toc-accent: #167c72; color: #263b43; font: 14px/1.5 Inter, system-ui, sans-serif; min-width: 0; }
.toc *, .toc *::before, .toc *::after { box-sizing: border-box; }
.toc [hidden] { display: none !important; }
.toc h2, .toc h3, .toc h4, .toc p { margin: 0 0 12px; }
.toc h2 { font-size: 22px; }
.toc-dirty-badge { display: inline-block; vertical-align: middle; margin-left: 12px; padding: 4px 9px; border: 1px solid #e8cc91; border-radius: 12px; background: #fff7e5; color: #76521b; font-size: 12px; font-weight: 550; }
.toc-empty { position: absolute; left: 24px; top: 30px; max-width: 420px; color: #576b71; }
.toc-group-label { position: absolute; max-width: 90%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 14px; font-weight: 650; color: #36594e; pointer-events: none; }
.toc h3 { font-size: 17px; }
.toc h4 { overflow-wrap: anywhere; }
.toc-header, .toc-actions, .toc-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toc-header { justify-content: space-between; margin-bottom: 14px; align-items: flex-start; }
.toc-header > div:first-child { flex: 1 1 300px; }
.toc-header .toc-actions { flex: 0 1 auto; }
.toc button, .toc select, .toc input[type="number"] { font: inherit; color: inherit; border: 1px solid #d4e1df; background: #fff; border-radius: 12px; padding: 9px 12px; min-height: 42px; max-width: 100%; }
.toc button { cursor: pointer; }
.toc button:hover:not(:disabled) { background: #edf6f4; border-color: #84b9af; }
.toc button:disabled, .toc select:disabled, .toc input:disabled { opacity: .6; cursor: default; }
.toc .toc-primary { background: var(--toc-accent); color: white; border-color: var(--toc-accent); }
.toc .toc-primary:hover:not(:disabled) { background: #10675e; }
.toc :focus-visible { outline: 3px solid #146dc0; outline-offset: 3px; }
.toc-muted, .toc-legend { color: #576b71; }
.toc-notice { border: 1px solid #cfe3dd; background: #f0f8f5; padding: 12px 14px; border-radius: 12px; }
.toc-status { min-height: 22px; font-weight: 600; }
.toc-error { margin-bottom: 14px; padding: 14px; background: #fff1ef; border: 1px solid #e3aaa3; border-radius: 12px; color: #8b3028; }
.toc-error button { margin: 4px 8px 0 0; }
.toc-toolbar { margin-bottom: 12px; }
.toc-toolbar button[aria-pressed="true"] { background: #e4f3ef; border-color: var(--toc-accent); color: #105d54; }
.toc-zoom { min-width: 54px; text-align: center; font-variant-numeric: tabular-nums; }
.toc-help, .toc-legend { font-size: 12px; }
.toc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 285px; gap: 16px; align-items: start; }
.toc-viewport { height: clamp(380px, 64vh, 760px); min-width: 0; max-width: 100%; overflow: auto; overscroll-behavior: contain; border: 1px solid #dce6e3; border-radius: 12px; background: radial-gradient(#d6e3de 1px, transparent 1px) 0 0 / 18px 18px, #f8fbfa; position: relative; }
.toc-spacer { position: relative; min-width: 100%; min-height: 100%; }
.toc-canvas { position: absolute; top: 0; left: 0; transform-origin: 0 0; }
.toc-lines { position: absolute; top: 0; left: 0; pointer-events: none; overflow: visible; }
.toc-line { fill: none; stroke: #94aaa5; stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.toc-line-reporting { stroke: #476e9b; stroke-dasharray: 7 5; stroke-width: 2; }
.toc-line-lead { stroke: #8d66b9; stroke-width: 2.6; }
.toc-line-affiliation { stroke: #3c9980; stroke-width: 2; }
.toc .toc-node { position: absolute; width: 232px; height: 96px; min-height: 96px; padding: 10px 14px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; text-align: left; background: #fff; border: 1px solid #d1dfda; border-left: 4px solid var(--toc-node-color, #6b9a8e); box-shadow: 0 4px 12px #243d3510; touch-action: none; user-select: none; cursor: grab; }
.toc .toc-node-department { --toc-node-color: #7e8bbe; }
.toc .toc-node-employee { --toc-node-color: #b9c9c4; }
.toc .toc-node-inactive { background: #f2f4f4; border-left-color: #9da9a6; }
.toc .toc-node[aria-pressed="true"] { border-color: var(--toc-accent); box-shadow: 0 0 0 2px #167c7229; background: #f0faf7; }
.toc .toc-node.toc-link-target { outline: 4px solid #b587dc; }
.toc[data-mode="link"] .toc-node { cursor: crosshair; }
.toc-node-kind { font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: #576b71; }
.toc-node-title { display: block; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 650; }
.toc-node-detail { display: block; width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #576b71; font-size: 11px; }
.toc-sidebar { border: 1px solid #dce6e3; border-radius: 12px; padding: 16px; background: #fff; min-width: 0; max-height: 760px; overflow: auto; }
.toc-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; font-weight: 550; }
.toc-field select, .toc-field input { width: 100%; font-weight: 400; }
.toc-centers { border: 1px solid #dce6e3; border-radius: 12px; margin: 0 0 14px; padding: 10px; }
.toc-centers label { display: flex; align-items: center; gap: 8px; padding: 6px 0; overflow-wrap: anywhere; }
.toc-centers input { width: 18px; height: 18px; flex: 0 0 auto; accent-color: var(--toc-accent); }
.toc-review { width: min(640px, calc(100vw - 32px)); max-height: 85vh; overflow: auto; padding: 24px; border: 1px solid #d1dfda; border-radius: 12px; box-shadow: 0 20px 80px #152f3640; }
.toc-review::backdrop { background: #173c4466; }
.toc-review li { margin-bottom: 10px; overflow-wrap: anywhere; }
.toc-review .toc-actions { justify-content: flex-end; }
.toc-busy .toc-node { cursor: progress; }
@media (max-width: 850px) { .toc-layout { grid-template-columns: minmax(0, 1fr); } .toc-sidebar { max-height: none; } .toc-viewport { height: 420px; } }
@media (prefers-reduced-motion: reduce) { .toc * { scroll-behavior: auto; } }

/* Default view: containment expresses membership, with no crossing connectors. */
.toc-organized .toc-layout { grid-template-columns: minmax(0, 1fr); }
.toc-organized.toc-has-selection .toc-layout { grid-template-columns: minmax(0, 1fr) 285px; }
.toc-organized .toc-sidebar { position: sticky; top: 14px; }
.toc-view-toolbar { margin: 14px 0; }
.toc-view-toolbar > input[type="search"] { min-width: 180px; flex: 1 1 280px; width: auto; min-height: 42px; padding: 9px 12px; border: 1px solid #d4e1df; border-radius: 10px; font: inherit; }
.toc-view-toolbar button[aria-pressed="true"] { border-color: #167c72; background: #e4f3ef; color: #105d54; }
.toc-inactive-toggle { display: flex; align-items: center; gap: 7px; color: #576b71; font-size: 12px; }
.toc-inactive-toggle input { width: 17px; height: 17px; }
.toc-overview { min-width: 0; display: grid; gap: 18px; align-content: start; }
.toc-overview-center { min-width: 0; border: 1px solid #d7e4df; border-radius: 16px; background: #fff; }
.toc-overview-center > summary { padding: 18px 20px; cursor: pointer; background: #edf7f3; border-radius: 16px; overflow-wrap: anywhere; }
.toc-overview-center[open] > summary { border-radius: 16px 16px 0 0; border-bottom: 1px solid #d7e4df; }
.toc-overview-center > summary strong { margin: 0 12px 0 4px; font-size: 17px; color: #184e45; }
.toc-overview-center > summary span { font-size: 12px; white-space: nowrap; }
.toc-overview-center-tools { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; padding: 12px 18px; }
.toc .toc-detail-button { min-height: 34px; padding: 6px 9px; margin-left: auto; border-color: transparent; color: #167c72; font-size: 12px; }
.toc-lead { font-size: 12px; color: #4b615a; }
.toc-overview-department { margin: 0 18px 16px; padding: 14px; border: 1px solid #e2e8e6; border-radius: 12px; background: #f9fbfa; min-width: 0; }
.toc-overview-department-heading { margin-bottom: 12px; }
.toc .toc-overview-card { display: flex; flex-direction: column; align-items: stretch; gap: 5px; width: 100%; min-width: 0; text-align: left; overflow-wrap: anywhere; white-space: normal; }
.toc .toc-overview-department { width: auto; }
.toc .toc-overview-card.toc-overview-department { margin: 0; padding: 8px 10px; border-color: transparent; background: transparent; }
.toc .toc-overview-card strong { font-size: 13px; }
.toc .toc-overview-card small { font-size: 11px; line-height: 1.5; color: #576b71; }
.toc .toc-overview-card[aria-pressed="true"] { border-color: #167c72; box-shadow: 0 0 0 2px #167c721a; }
.toc-overview-staff { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 9px; }
.toc .toc-overview-employee { background: #fff; min-height: 64px; }
.toc .toc-overview-employee[draggable="true"] { cursor: grab; }
.toc-overview-empty { padding: 0 18px 18px; font-size: 12px; }
.toc-organized .toc-notice { margin-top: 18px; font-size: 12px; background: transparent; border: 0; padding: 0; }
@media (max-width: 850px) {
  .toc-organized.toc-has-selection .toc-layout { grid-template-columns: minmax(0,1fr); }
  .toc-organized.toc-has-selection .toc-sidebar { grid-row: 1; }
  .toc-organized .toc-sidebar { position: static; }
  .toc-overview-center > summary { padding: 14px; }
  .toc-overview-department { margin: 0 10px 12px; padding: 10px; }
}

/* True hierarchy: each subtree owns its width; orthogonal connectors join
   adjacent generations and cannot cross other subtrees. */
.toc-overview.toc-hierarchy { display: block; }
.toc-tree-controls select { flex: 1 1 220px; max-width: 290px; }
.toc-tree-viewport { width: 100%; height: clamp(520px,78vh,900px); overflow: auto; position: relative; border: 1px solid #d9e3e6; border-radius: 16px; background: #fafcfd; overscroll-behavior: contain; }
.toc-tree-brand { font-size: 13px; font-weight: 650; color: #517282; }
.toc-tree-space { position: relative; min-width: 100%; min-height: 100%; }
.toc-tree-canvas { position: absolute; left: 0; top: 0; width: max-content; max-width: none; padding: 28px; transform-origin: top left; }
.toc-tree-root, .toc-tree-children { display: flex; justify-content: center; width: max-content; padding: 0; margin: 0; list-style: none; }
.toc-tree-branch { position: relative; flex: 0 0 auto; padding: 0 12px; text-align: center; list-style: none; }
.toc-tree-node { display: flex; flex-direction: column; align-items: center; width: 100%; }
.toc-tree-children { position: relative; padding-top: 30px; margin: 0 auto; }
.toc-tree-children::before { content: ''; position: absolute; top: 0; left: 50%; width: 0; height: 30px; border-left: 2px solid #79a6be; }
.toc-tree-children > .toc-tree-branch { padding-top: 30px; }
.toc-tree-children > .toc-tree-branch::before,
.toc-tree-children > .toc-tree-branch::after { content: ''; position: absolute; top: 0; right: 50%; width: 50%; height: 30px; border-top: 2px solid #79a6be; }
.toc-tree-children > .toc-tree-branch::after { right: auto; left: 50%; border-left: 2px solid #79a6be; }
.toc-tree-children > .toc-tree-branch:first-child::before,
.toc-tree-children > .toc-tree-branch:last-child::after { border: 0; }
.toc-tree-children > .toc-tree-branch:last-child::before { border-right: 2px solid #79a6be; }
.toc-tree-children > .toc-tree-branch:only-child { padding-top: 0; }
.toc-tree-children > .toc-tree-branch:only-child::before,
.toc-tree-children > .toc-tree-branch:only-child::after { display: none; }
.toc .toc-tree-card, .toc .toc-tree-card.toc-overview-department,
.toc-tree-company, .toc-tree-placeholder { width: 184px; max-width: 184px; min-height: 108px; padding: 16px 12px; margin: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; border: 1px solid #d7e2e6; border-radius: 14px; background: white; box-shadow: 0 5px 15px #17334408; }
.toc .toc-tree-card.toc-overview-employee { min-height: 176px; cursor: pointer; }
.toc .toc-tree-card[draggable="true"] { cursor: grab; }
.toc .toc-tree-card strong { font-size: 13px; line-height: 1.35; white-space: normal; }
.toc .toc-tree-card small { max-width: 158px; font-size: 10px; line-height: 1.5; }
.toc .toc-tree-card.toc-overview-center { background: #e9f5f1; border-color: #add4c7; }
.toc .toc-tree-card.toc-overview-department { background: #edf2fa; border-color: #bdcfe6; }
.toc-tree-company { color: #174d45; background: #e7f4ef; font-size: 15px; }
.toc-tree-avatar { position: relative; width: 58px; height: 58px; flex: 0 0 58px; display: grid; place-items: center; overflow: hidden; border-radius: 50%; background: #e4efec; color: #176f62; font-size: 19px; font-weight: 750; }
.toc-tree-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.toc-tree-company .toc-tree-avatar { background: white; }
.toc-tree-company .toc-tree-avatar img { object-fit: contain; padding: 5px; }
.toc .toc-tree-toggle { min-height: 30px; margin-top: 8px; padding: 3px 10px; border-color: #c3d8e2; border-radius: 15px; color: #2e647d; font-size: 11px; background: #f1f6f9; }
.toc-tree-placeholder { font-size: 12px; color: #687d87; background: #f2f5f6; }
.toc .toc-tree-reference { border-style: dashed; border-color: #98b7c9; background: #f0f5fa; }
.toc .toc-tree-reference small { color: #4e7186; }
.toc-tree-locality { border-color: #b3c7de; background: #e4edf8; color: #2a5276; }
.toc-tree-locality strong { font-size: 15px; }
.toc-tree-locality small { font-size: 11px; color: #59718b; }
@media (max-width: 850px) { .toc-tree-viewport { height: 540px; } .toc-tree-controls { gap: 7px; } }

.toc-tree-viewport, .toc-viewport { cursor: grab; }
.toc-panning, .toc-panning * { cursor: grabbing !important; user-select: none; }

.toc .toc-drop-target { outline: 3px solid #168c82; outline-offset: 3px; background: #e8f5f1; }
