.tnfd-orgchart {
    width: 100%;
}

.oc-wrap {
    background: linear-gradient(180deg, #fcfefc 0%, #ffffff 60%);
    border: 1px solid #e6ede6;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 10px 30px rgba(20, 83, 45, 0.07);
    /* The CMS content wrapper this mounts inside sets text-align: center
       on pasted content; without overriding it here every box centers
       on its own width instead of lining up with the connector lines. */
    text-align: left;
}

.oc-header h4 {
    margin: 0 0 4px;
    color: #14532d;
    font-weight: 800;
    font-size: 1.3rem;
    letter-spacing: -0.01em;
}

.oc-header p {
    margin: 0 0 20px;
    color: #6b7c6f;
    font-size: 1rem;
}

.oc-layout {
    display: flex;
    align-items: flex-start;
    gap: 20px;
}

/* Top layer: offices an admin has flagged to sit alongside PCCF (Head of
   Forest Force) instead of in the regular picker list below -- reuses the
   same .oc-menu-item/.oc-menu-btn/.oc-swatch-* look as the picker, just
   laid out as a horizontal row above it rather than a vertical list. */
.oc-top-layer {
    list-style: none;
    margin: 0 0 4px;
    padding: 0;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 10px;
}

.oc-top-layer .oc-menu-item {
    flex: 0 1 auto;
    width: auto;
}

.oc-top-layer .oc-menu-btn {
    width: auto;
}

.oc-menu-item {
    margin: 0;
}

.oc-menu-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
    background: #fff;
    border: 1px solid #ecf2ec;
    border-left: 4px solid var(--oc-color, #2d7a3a);
    border-radius: 10px;
    padding: 11px 12px;
    cursor: pointer;
    font: inherit;
    box-shadow: 0 1px 2px rgba(20, 83, 45, 0.03);
    transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.oc-menu-btn:hover {
    background: #f6faf6;
    box-shadow: 0 4px 10px rgba(20, 83, 45, 0.08);
    transform: translateX(1px);
}

.oc-menu-btn:focus-visible {
    outline: 2px solid #2d7a3a;
    outline-offset: 2px;
}

.oc-menu-item.oc-active .oc-menu-btn {
    background: linear-gradient(135deg, var(--oc-color, #2d7a3a), color-mix(in srgb, var(--oc-color, #2d7a3a) 75%, #000));
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.oc-menu-item.oc-active .oc-menu-btn .oc-menu-label,
.oc-menu-item.oc-active .oc-menu-btn .oc-menu-arrow {
    color: #fff;
}

.oc-menu-item.oc-active .oc-menu-btn .oc-icon {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

.oc-menu-btn .oc-icon {
    flex: 0 0 auto;
    width: 27px;
    height: 27px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--oc-color-soft, #e2f0e2);
    color: var(--oc-color, #2d7a3a);
    border-radius: 8px;
    font-size: 0.78rem;
}

.oc-menu-label {
    flex: 1 1 auto;
    font-weight: 600;
    font-size: 0.96rem;
    color: #223;
    line-height: 1.3;
}

.oc-menu-arrow {
    flex: 0 0 auto;
    color: #8aa38c;
    font-size: 0.75rem;
}

/* Colour palette for the eight rotating office swatches -- also drives
   the connector-line colour in the chart panel via --oc-line. */
.oc-swatch-c1 { --oc-color: #2d7a3a; --oc-color-soft: #e2f0e2; --oc-line: #9ecfaa; }
.oc-swatch-c2 { --oc-color: #1d6fa5; --oc-color-soft: #e1eef7; --oc-line: #94c0e0; }
.oc-swatch-c3 { --oc-color: #b3691d; --oc-color-soft: #f7ecdf; --oc-line: #e0b57d; }
.oc-swatch-c4 { --oc-color: #7a4fbf; --oc-color-soft: #ede6f9; --oc-line: #c7aeea; }
.oc-swatch-c5 { --oc-color: #c23d5c; --oc-color-soft: #f9e3e8; --oc-line: #eaa5b7; }
.oc-swatch-c6 { --oc-color: #0f8c8c; --oc-color-soft: #dff3f3; --oc-line: #8fd6d6; }
.oc-swatch-c7 { --oc-color: #a3852c; --oc-color-soft: #f5eed9; --oc-line: #ddc789; }
.oc-swatch-c8 { --oc-color: #4a5fbf; --oc-color-soft: #e4e7f9; --oc-line: #aab3e5; }

/* Right-hand chart panel */
.oc-panel {
    flex: 1 1 auto;
    min-width: 0;
    background: #fbfdfb;
    border: 1px solid #edf3ed;
    border-radius: 12px;
    padding: 20px;
}

.oc-empty {
    color: #8a988c;
    font-size: 0.9rem;
    margin: 0;
}

/* Standalone card for an office with no reporting units -- not part of
   the connector tree since there's nothing to connect it to. */
.oc-vroot-standalone {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, var(--oc-color, #2d7a3a), color-mix(in srgb, var(--oc-color, #2d7a3a) 70%, #000));
    color: #fff;
    border-radius: 12px;
    padding: 14px 18px;
    margin-bottom: 14px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.14);
}

.oc-vroot-standalone .oc-vroot-icon {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.22);
    border-radius: 9px;
    font-size: 0.95rem;
}

.oc-vroot-standalone .oc-vroot-label {
    flex: 1 1 auto;
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: -0.01em;
}

/* Connected-line tree: indents downward per generation with a real
   elbow connector (vertical guide + horizontal tick) per node, colour
   matched to the selected office. Indenting instead of fanning out
   sideways means it never needs horizontal scrolling. */
.oc-vtree,
.oc-vchildren {
    list-style: none;
    margin: 0;
    padding: 0;
}

.oc-vchildren {
    position: relative;
    margin-left: 17px;
    padding-left: 26px;
}

.oc-vnode {
    position: relative;
    padding: 7px 0;
}

.oc-vchildren > .oc-vnode::before {
    content: '';
    position: absolute;
    left: -26px;
    top: 27px;
    width: 26px;
    height: 0;
    border-top: 2px solid var(--oc-line, #cfe3cf);
}

.oc-vchildren > .oc-vnode::after {
    content: '';
    position: absolute;
    left: -26px;
    top: 0;
    width: 0;
    height: 100%;
    border-left: 2px solid var(--oc-line, #cfe3cf);
}

.oc-vchildren > .oc-vnode:last-child::after {
    height: 27px;
}

.oc-vbox {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    max-width: 100%;
    background: #fff;
    border: 1px solid #e9f1e9;
    border-radius: 10px;
    padding: 9px 13px;
    font-size: 0.94rem;
    font-weight: 600;
    color: #223;
    box-shadow: 0 1px 2px rgba(20, 83, 45, 0.04);
    transition: box-shadow 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.oc-vbox.oc-vexpandable {
    cursor: pointer;
}

.oc-vbox.oc-vexpandable:hover {
    border-color: var(--oc-color, #2d7a3a);
    box-shadow: 0 6px 16px rgba(20, 83, 45, 0.12);
    transform: translateX(2px);
}

.oc-vbox:focus-visible {
    outline: 2px solid var(--oc-color, #2d7a3a);
    outline-offset: 2px;
}

/* The tree's own root: the selected office, shown as a premium
   highlighted card that its reporting structure hangs directly off of. */
.oc-vnode-root {
    padding-top: 0;
    padding-bottom: 4px;
}

.oc-vbox-root {
    display: flex;
    width: 100%;
    background: linear-gradient(135deg, var(--oc-color, #2d7a3a), color-mix(in srgb, var(--oc-color, #2d7a3a) 70%, #000));
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 14px 18px;
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.14);
}

.oc-vbox-root .oc-vicon {
    width: 34px;
    height: 34px;
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
    font-size: 0.95rem;
}

.oc-vbox-root .oc-vcount {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
    font-size: 0.72rem;
    margin-left: auto;
}

.oc-vicon {
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--oc-color-soft, #e2f0e2);
    color: var(--oc-color, #2d7a3a);
    border-radius: 7px;
    font-size: 0.68rem;
}

.oc-vlabel {
    word-break: break-word;
}

.oc-vcount {
    flex: 0 0 auto;
    background: var(--oc-color-soft, #eef6ee);
    color: var(--oc-color, #2d7a3a);
    font-size: 0.66rem;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 9px;
    white-space: nowrap;
}

.oc-vchevron {
    flex: 0 0 auto;
    color: #9ab19c;
    font-size: 0.72rem;
    transition: transform 0.2s ease;
}

.oc-vnode:not(.oc-vcollapsed) > .oc-vbox > .oc-vchevron {
    transform: rotate(90deg);
    color: var(--oc-color, #2d7a3a);
}

.oc-vcollapsed > .oc-vchildren {
    display: none;
}

@media (max-width: 860px) {
    .oc-layout {
        flex-direction: column;
    }

    .oc-panel {
        width: 100%;
    }
}

@media (max-width: 576px) {
    .oc-wrap {
        padding: 16px 14px 20px;
    }

    .oc-vchildren {
        margin-left: 10px;
        padding-left: 18px;
    }

    .oc-vchildren > .oc-vnode::before {
        left: -18px;
        width: 18px;
    }

    .oc-vchildren > .oc-vnode::after {
        left: -18px;
    }

    .oc-vlabel {
        font-size: 0.84rem;
    }
}
