/* Structure chart shell — toolbar, legend, placeholder stage (prototype-aligned chrome) */

.orym-structure-shell {
    --r-shareholder: #1BA09B;
    --r-director: #F07A1F;
    --r-signatory: #FFC386;
    --r-auditor: #47C2FF;
    --r-bank: #A78BFA;
    --r-tenant: #FF6B4A;
    --r-lender: #E25B8B;
    --r-service-provider: #C98A3D;
}

[data-theme="light"] .orym-structure-shell {
    --r-shareholder: #148F8B;
    --r-director: #B34E00;
    --r-signatory: #E09A52;
    --r-auditor: #0A3FA8;
    --r-bank: #6B3FC9;
    --r-tenant: #C23A1D;
    --r-lender: #B23A67;
    --r-service-provider: #8F6210;
}

.orym-structure-shell__toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 18px;
}

.orym-structure-shell__tb-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.orym-structure-shell__tenant {
    font-size: var(--fs-data-sm, 12px);
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--fg);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 16rem;
    padding-right: 6px;
    border-right: 1px solid var(--hairline);
    margin-right: 2px;
}

.orym-structure-shell__tb-label {
    font-size: var(--fs-data-xs);
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--fg-faint);
}

/* Segmented control — mirrors the prototype `.seg` look */
.orym-structure-shell__seg.mud-toggle-group {
    font-size: var(--fs-data-xs) !important;
    border: 1px solid var(--hairline);
    border-radius: 2px;
    overflow: hidden;
    background: none;
    gap: 0;
    min-height: 0;
    --mud-palette-lines-inputs: transparent;
}

.orym-structure-shell__seg .mud-toggle-item {
    font-family: var(--font);
    font-size: inherit !important;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    padding: 6px 14px !important;
    min-height: 0 !important;
    min-width: auto !important;
    border: none;
    border-radius: 0 !important;
    background: none;
    color: var(--fg-faint);
    transition: all 0.18s;
}

.orym-structure-shell__seg .mud-toggle-item.mud-button-root {
    min-height: 0 !important;
    height: auto !important;
}

.orym-structure-shell__seg .mud-toggle-item > .mud-button-label {
    min-height: 0 !important;
    line-height: 1.2 !important;
    padding: 0 !important;
    margin: 0 !important;
    font-size: inherit !important;
    letter-spacing: inherit;
    text-transform: inherit;
    font-weight: inherit;
}

.orym-structure-shell__seg .mud-toggle-item:hover {
    color: var(--fg-muted);
    background: none;
}

.orym-structure-shell__seg .mud-toggle-item.mud-toggle-item-selected {
    background: rgba(27, 160, 155, 0.14);
    color: var(--teal-1);
}

[data-theme="light"] .orym-structure-shell__seg .mud-toggle-item.mud-toggle-item-selected {
    background: rgba(20, 143, 139, 0.10);
}

.orym-structure-shell__seg .mud-toggle-item-divider {
    background: var(--hairline);
}

/* Show-persons toggle — mirrors the prototype `.toggle-persons` */
.orym-structure-shell__toggle-persons {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font);
    font-size: var(--fs-data-xs);
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    background: none;
    border: none;
    color: var(--fg-faint);
    cursor: pointer;
    padding: 0;
}

.orym-structure-shell__toggle-persons:hover {
    color: var(--fg-muted);
}

.orym-structure-shell__toggle-persons-track {
    width: 30px;
    height: 16px;
    border-radius: 9px;
    border: 1px solid var(--hairline);
    background: var(--bg-panel);
    position: relative;
    flex-shrink: 0;
}

.orym-structure-shell__toggle-persons-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--fg-faint);
    transition: left 0.2s, background 0.2s;
}

.orym-structure-shell__toggle-persons--on .orym-structure-shell__toggle-persons-thumb {
    left: 16px;
    background: var(--teal-1);
}

.orym-structure-shell__legend {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
}

.orym-structure-shell__legend-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: var(--fs-data-xs);
    font-weight: 400;
    letter-spacing: 0.08em;
    color: var(--fg-faint);
}

.orym-structure-shell__legend-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.orym-structure-shell__legend-dot--verified {
    background: var(--s-verified);
}

.orym-structure-shell__legend-dot--partial {
    background: var(--s-partial);
}

.orym-structure-shell__legend-dot--missing {
    background: var(--s-missing);
}

.orym-structure-shell__legend-sep {
    width: 1px;
    height: 14px;
    background: var(--hairline);
}

.orym-structure-shell__legend-hint {
    font-size: var(--fs-data-xs);
    font-weight: 400;
    letter-spacing: 0.04em;
    color: var(--fg-faint);
}

.orym-structure-shell__stage {
    position: relative;
    border: 1px solid var(--hairline);
    border-radius: 3px;
    background: var(--bg-2);
    overflow: hidden;
    min-height: 580px;
}

.orym-structure-shell__stage-progress {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1;
}

.orym-structure-shell__stage-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 580px;
    padding: 24px;
    text-align: center;
}

/* ══════════ GROUP VIEW CANVAS ══════════ */
.orym-structure-shell__canvas-wrap {
    width: 100%;
    overflow: auto;
    padding: 16px;
    text-align: center;
}

.orym-structure-shell__canvas {
    display: block;
    margin-inline: auto;
    max-width: 100%;
    height: auto;
}

/* ── Edges (shareholder / capital tree) ── */
.orym-structure-shell__edge {
    fill: none;
    stroke: var(--r-shareholder);
    stroke-width: 1.4;
    stroke-opacity: 0.65;
}

/* ── Nodes ── */
.orym-structure-shell__node {
    cursor: pointer;
}

.orym-structure-shell__node-rect {
    stroke-width: 1.1;
    transition: fill-opacity 0.2s ease, stroke-opacity 0.2s ease, stroke-width 0.2s ease;
}

.orym-structure-shell__node--verified .orym-structure-shell__node-rect {
    fill: var(--s-verified);
    stroke: var(--s-verified);
    fill-opacity: 0.20;
    stroke-opacity: 0.85;
}

.orym-structure-shell__node--partial .orym-structure-shell__node-rect {
    fill: var(--s-partial);
    stroke: var(--s-partial);
    fill-opacity: 0.20;
    stroke-opacity: 0.90;
}

.orym-structure-shell__node--missing .orym-structure-shell__node-rect {
    fill: var(--s-missing);
    stroke: var(--s-missing);
    fill-opacity: 0.18;
    stroke-opacity: 0.85;
}

.orym-structure-shell__node:hover .orym-structure-shell__node-rect {
    fill-opacity: 0.32;
    stroke-opacity: 1;
    stroke-width: 1.5;
}

.orym-structure-shell__node-name {
    font-family: var(--font);
    font-weight: 600;
    font-size: 10.5px;
    fill: var(--fg);
    letter-spacing: 0.05em;
}

.orym-structure-shell__node--person .orym-structure-shell__node-name {
    font-size: 9.5px;
}

.orym-structure-shell__node-sub {
    font-family: var(--font);
    font-weight: 400;
    font-size: 8.5px;
    fill: var(--fg-faint);
    letter-spacing: 0.03em;
}

.orym-structure-shell__node--missing .orym-structure-shell__node-sub {
    font-style: italic;
}

/* ── Role-count badges ── */
.orym-structure-shell__badge rect {
    fill: var(--bg-panel);
    stroke-width: 1;
    transition: stroke-width 0.15s;
}

.orym-structure-shell__badge:hover rect {
    stroke-width: 1.8;
}

.orym-structure-shell__badge text {
    font-family: var(--font);
    font-size: 7.5px;
    font-weight: 600;
    letter-spacing: 0.06em;
    pointer-events: none;
}

/* ── Role filter chips (governance view) ── */
.orym-structure-shell__role-chips {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.orym-structure-shell__role-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font);
    font-size: var(--fs-data-xs);
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 5px 11px;
    border: 1px solid var(--hairline);
    border-radius: 2px;
    background: none;
    color: var(--fg-faint);
    cursor: pointer;
    transition: all 0.18s;
}

.orym-structure-shell__role-chip-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.orym-structure-shell__role-chip--active {
    color: var(--fg);
    border-color: currentColor;
    background: color-mix(in srgb, var(--bg-lift) 70%, transparent);
}

/* ══════════ GOVERNANCE VIEW CANVAS ══════════ */
.orym-structure-shell__canvas-wrap--gov {
    position: relative;
}

.orym-structure-shell__headers {
    pointer-events: none;
}

.orym-structure-shell__col-head {
    font-family: var(--font);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.24em;
    fill: var(--fg-faint);
    text-transform: uppercase;
}

.orym-structure-shell__col-sub {
    font-family: var(--font);
    font-size: 8px;
    font-weight: 600;
    letter-spacing: 0.26em;
    fill: var(--fg-faint);
    opacity: 0.75;
    text-transform: uppercase;
}

.orym-structure-shell__gov-edge {
    fill: none;
    stroke-width: 3;
    opacity: 0.95;
    transition: opacity 0.2s;
    pointer-events: none;
}

.orym-structure-shell__gov-edge-rail {
    fill: none;
    stroke-width: 6.2;
    opacity: 1;
    pointer-events: none;
}

.orym-structure-shell__gov-edge-hit {
    fill: none;
    stroke: transparent;
    stroke-width: 16;
    cursor: pointer;
}

.orym-structure-shell__edge-tip {
    position: absolute;
    z-index: 26;
    pointer-events: none;
    background: var(--bg-panel);
    border: 1px solid var(--hairline);
    border-radius: 3px;
    padding: 8px 11px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
    max-width: 260px;
}

.orym-structure-shell__edge-tip b {
    display: block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: var(--fg);
}

.orym-structure-shell__edge-tip span {
    display: block;
    margin-top: 2px;
    font-size: 9.5px;
    font-weight: 300;
    color: var(--fg-faint);
    letter-spacing: 0.04em;
}
