.spice-org-chart {
    --spice-org-text: #2f3539;
    --spice-org-muted: #737b81;
    --spice-org-line: #d9dee1;
    --spice-org-soft: #f5f6f6;
    --spice-org-card: #ffffff;
    --spice-org-strong: #3b4247;
    box-sizing: border-box;
    width: 100%;
    color: var(--spice-org-text);
    background: #fff;
    border: 1px solid #dfe3e6;
    border-radius: 22px;
    overflow: hidden;
    font-family: inherit;
}
.spice-org-chart *, .spice-org-chart *::before, .spice-org-chart *::after { box-sizing: border-box; }

.spice-org-chart__header {
    padding: clamp(28px, 4vw, 54px);
    background: linear-gradient(180deg, #f8f9f9 0%, #f2f3f3 100%);
    border-bottom: 1px solid #dfe3e6;
}
.spice-org-chart__eyebrow {
    display: block;
    margin: 0 0 12px;
    color: #788087;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .17em;
    text-transform: uppercase;
}
.spice-org-chart__title {
    max-width: 900px;
    margin: 0;
    color: #2e3438;
    font-size: clamp(30px, 4vw, 52px);
    line-height: 1.04;
    letter-spacing: -.035em;
    font-weight: 720;
}
.spice-org-chart__intro {
    max-width: 820px;
    margin-top: 18px;
    color: #5e666c;
    font-size: 16px;
    line-height: 1.7;
}
.spice-org-chart__intro:empty { display: none; }
.spice-org-chart__intro > :first-child,
.spice-org-chart__node-description > :first-child { margin-top: 0; }
.spice-org-chart__intro > :last-child,
.spice-org-chart__node-description > :last-child { margin-bottom: 0; }

.spice-org-chart__canvas {
    width: 100%;
    overflow-x: auto;
    padding: clamp(28px, 4vw, 54px);
    scrollbar-width: thin;
    scrollbar-color: #c9ced1 transparent;
}
.spice-org-chart__canvas::-webkit-scrollbar { height: 9px; }
.spice-org-chart__canvas::-webkit-scrollbar-thumb { background: #c9ced1; border-radius: 999px; }

.spice-org-chart__branch {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 0;
    min-width: max-content;
    margin: 0;
    padding: 34px 0 0;
    list-style: none;
}
.spice-org-chart__canvas > .spice-org-chart__branch { padding-top: 0; }
.spice-org-chart__item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 0;
    margin: 0;
    padding: 34px 10px 0;
    list-style: none;
}
.spice-org-chart__canvas > .spice-org-chart__branch > .spice-org-chart__item { padding-top: 0; }

.spice-org-chart[data-node-size="small"] .spice-org-chart__node { width: 205px; }
.spice-org-chart[data-node-size="medium"] .spice-org-chart__node { width: 260px; }
.spice-org-chart[data-node-size="large"] .spice-org-chart__node { width: 320px; }

.spice-org-chart__node {
    position: relative;
    z-index: 2;
    flex: 0 0 auto;
    padding: 18px 18px 17px;
    border: 1px solid #dfe3e6;
    border-radius: 16px;
    background: var(--spice-org-card);
    box-shadow: 0 8px 26px rgba(43,49,53,.055);
    text-align: left;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.spice-org-chart__node:hover {
    transform: translateY(-1px);
    border-color: #cdd3d6;
    box-shadow: 0 11px 30px rgba(43,49,53,.075);
}
.spice-org-chart__node.is-highlighted {
    border-color: #c9ced1;
    background: linear-gradient(180deg, #f5f6f6 0%, #eef0f1 100%);
    box-shadow: 0 9px 28px rgba(43,49,53,.075);
}
.spice-org-chart__node.is-highlighted::before {
    content: '';
    position: absolute;
    left: 18px;
    right: 18px;
    top: 0;
    height: 3px;
    border-radius: 0 0 999px 999px;
    background: #454c51;
}
.spice-org-chart__node-kicker {
    display: block;
    margin: 0 0 8px;
    color: #8a9196;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .15em;
    line-height: 1.35;
    text-transform: uppercase;
}
.spice-org-chart__node-title {
    margin: 0;
    color: #343a3f;
    font-size: 18px;
    line-height: 1.2;
    letter-spacing: -.018em;
    overflow-wrap: anywhere;
}
.spice-org-chart__node-subtitle {
    margin-top: 7px;
    color: #687178;
    font-size: 13px;
    font-weight: 650;
    line-height: 1.45;
    overflow-wrap: anywhere;
}
.spice-org-chart__node-description {
    margin-top: 12px;
    padding-top: 11px;
    border-top: 1px solid #e7eaec;
    color: #687178;
    font-size: 12.5px;
    line-height: 1.6;
    overflow-wrap: anywhere;
}
.spice-org-chart__node-description:empty { display: none; }
.spice-org-chart[data-show-descriptions="0"] .spice-org-chart__node-description { display: none; }

/* Classic tree connectors. */
.spice-org-chart[data-layout="tree"][data-show-lines="1"] .spice-org-chart__branch .spice-org-chart__item::before,
.spice-org-chart[data-layout="tree"][data-show-lines="1"] .spice-org-chart__branch .spice-org-chart__item::after {
    content: '';
    position: absolute;
    top: 0;
    right: 50%;
    width: 50%;
    height: 34px;
    border-top: 1px solid var(--spice-org-line);
}
.spice-org-chart[data-layout="tree"][data-show-lines="1"] .spice-org-chart__branch .spice-org-chart__item::after {
    right: auto;
    left: 50%;
    border-left: 1px solid var(--spice-org-line);
}
.spice-org-chart[data-layout="tree"][data-show-lines="1"] .spice-org-chart__branch .spice-org-chart__item:only-child::before,
.spice-org-chart[data-layout="tree"][data-show-lines="1"] .spice-org-chart__branch .spice-org-chart__item:only-child::after { display: none; }
.spice-org-chart[data-layout="tree"][data-show-lines="1"] .spice-org-chart__branch .spice-org-chart__item:first-child::before,
.spice-org-chart[data-layout="tree"][data-show-lines="1"] .spice-org-chart__branch .spice-org-chart__item:last-child::after { border: 0 none; }
.spice-org-chart[data-layout="tree"][data-show-lines="1"] .spice-org-chart__branch .spice-org-chart__item:last-child::before {
    border-right: 1px solid var(--spice-org-line);
    border-radius: 0 12px 0 0;
}
.spice-org-chart[data-layout="tree"][data-show-lines="1"] .spice-org-chart__branch .spice-org-chart__item:first-child::after {
    border-radius: 12px 0 0 0;
}
.spice-org-chart[data-layout="tree"][data-show-lines="1"] .spice-org-chart__item > .spice-org-chart__branch::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 0;
    height: 34px;
    border-left: 1px solid var(--spice-org-line);
}
.spice-org-chart[data-layout="tree"][data-show-lines="1"] .spice-org-chart__canvas > .spice-org-chart__branch > .spice-org-chart__item::before,
.spice-org-chart[data-layout="tree"][data-show-lines="1"] .spice-org-chart__canvas > .spice-org-chart__branch > .spice-org-chart__item::after { display: none; }

/* Compact hierarchy for very large or deep organizations. */
.spice-org-chart[data-layout="compact"] .spice-org-chart__canvas {
    overflow-x: visible;
}
.spice-org-chart[data-layout="compact"] .spice-org-chart__branch {
    display: grid;
    justify-content: stretch;
    gap: 12px;
    min-width: 0;
    padding: 0;
}
.spice-org-chart[data-layout="compact"] .spice-org-chart__item {
    display: block;
    padding: 0;
}
.spice-org-chart[data-layout="compact"] .spice-org-chart__node {
    width: 100%;
    max-width: none;
}
.spice-org-chart[data-layout="compact"] .spice-org-chart__item > .spice-org-chart__branch {
    margin-top: 12px;
    margin-left: 28px;
    padding-left: 22px;
}
.spice-org-chart[data-layout="compact"][data-show-lines="1"] .spice-org-chart__item > .spice-org-chart__branch {
    border-left: 1px solid var(--spice-org-line);
}
.spice-org-chart[data-layout="compact"][data-show-lines="1"] .spice-org-chart__item > .spice-org-chart__branch > .spice-org-chart__item::before {
    content: '';
    position: absolute;
    left: -22px;
    top: 30px;
    width: 22px;
    border-top: 1px solid var(--spice-org-line);
}
.spice-org-chart[data-layout="compact"] .spice-org-chart__node.is-highlighted {
    border-left: 4px solid #454c51;
}
.spice-org-chart[data-layout="compact"] .spice-org-chart__node.is-highlighted::before { display: none; }

.spice-org-chart__editor-footer {
    display: none;
}

@media (max-width: 780px) {
    .spice-org-chart__header { padding: 26px 22px; }
    .spice-org-chart__canvas { padding: 26px 18px; }
    .spice-org-chart[data-layout="tree"] .spice-org-chart__branch {
        display: grid;
        justify-content: stretch;
        min-width: 0;
        gap: 12px;
        padding: 0;
    }
    .spice-org-chart[data-layout="tree"] .spice-org-chart__item {
        display: block;
        padding: 0;
    }
    .spice-org-chart[data-layout="tree"] .spice-org-chart__node {
        width: 100%;
    }
    .spice-org-chart[data-layout="tree"] .spice-org-chart__item > .spice-org-chart__branch {
        margin-top: 12px;
        margin-left: 18px;
        padding-left: 18px;
    }
    .spice-org-chart[data-layout="tree"][data-show-lines="1"] .spice-org-chart__branch .spice-org-chart__item::before,
    .spice-org-chart[data-layout="tree"][data-show-lines="1"] .spice-org-chart__branch .spice-org-chart__item::after,
    .spice-org-chart[data-layout="tree"][data-show-lines="1"] .spice-org-chart__item > .spice-org-chart__branch::before { display: none; }
    .spice-org-chart[data-layout="tree"][data-show-lines="1"] .spice-org-chart__item > .spice-org-chart__branch {
        border-left: 1px solid var(--spice-org-line);
    }
    .spice-org-chart[data-layout="tree"][data-show-lines="1"] .spice-org-chart__item > .spice-org-chart__branch > .spice-org-chart__item::before {
        content: '';
        display: block;
        position: absolute;
        left: -18px;
        top: 30px;
        width: 18px;
        border-top: 1px solid var(--spice-org-line);
    }
}

/* Frontend actions + fullscreen lightbox (v0.28.2). */
.spice-org-chart__header {
    position: relative;
}
.spice-org-chart__fullscreen-wrap {
    display: flex;
    justify-content: flex-end;
    margin-top: 22px;
}
.spice-org-chart__fullscreen-trigger {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 42px;
    padding: 10px 15px;
    border: 1px solid #cfd4d7;
    border-radius: 999px;
    background: rgba(255,255,255,.86);
    color: #3d4449;
    font: inherit;
    font-size: 13px;
    font-weight: 750;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 5px 16px rgba(43,49,53,.055);
    transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
.spice-org-chart__fullscreen-trigger:hover {
    transform: translateY(-1px);
    border-color: #bfc6ca;
    background: #fff;
    box-shadow: 0 8px 22px rgba(43,49,53,.08);
}
.spice-org-chart__fullscreen-trigger:focus-visible {
    outline: 3px solid rgba(82,92,99,.18);
    outline-offset: 3px;
}
.spice-org-chart__fullscreen-icon {
    font-size: 16px;
    line-height: 1;
}

.spice-org-chart-lightbox[hidden] { display: none !important; }
.spice-org-chart-lightbox {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: grid;
    place-items: center;
    padding: clamp(12px, 2vw, 28px);
    background: rgba(28,32,35,.36);
    -webkit-backdrop-filter: blur(16px) saturate(.85) brightness(.88);
    backdrop-filter: blur(16px) saturate(.85) brightness(.88);
    opacity: 0;
    transition: opacity .18s ease;
}
.spice-org-chart-lightbox.is-open { opacity: 1; }
.spice-org-chart-lightbox__panel {
    width: min(96vw, 1680px);
    height: min(94vh, 1080px);
    display: grid;
    grid-template-rows: auto auto minmax(0,1fr);
    overflow: hidden;
    border: 1px solid rgba(216,221,224,.98);
    border-radius: 22px;
    background: #f7f8f8;
    box-shadow: 0 30px 90px rgba(20,24,27,.28);
    transform: translateY(10px) scale(.992);
    transition: transform .18s ease;
}
.spice-org-chart-lightbox.is-open .spice-org-chart-lightbox__panel {
    transform: translateY(0) scale(1);
}
.spice-org-chart-lightbox__toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 15px 18px 15px 22px;
    border-bottom: 1px solid #dfe3e6;
    background: rgba(255,255,255,.95);
}
.spice-org-chart-lightbox__heading {
    min-width: 0;
    display: grid;
    gap: 3px;
}
.spice-org-chart-lightbox__kicker {
    color: #8a9196;
    font-size: 9px;
    font-weight: 850;
    letter-spacing: .15em;
}
.spice-org-chart-lightbox__title {
    overflow: hidden;
    color: #353c41;
    font-size: 15px;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.spice-org-chart-lightbox__actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 8px;
}
.spice-org-chart-lightbox__button,
.spice-org-chart-lightbox__close {
    appearance: none;
    min-height: 39px;
    border: 1px solid #d3d8db;
    border-radius: 10px;
    background: #fff;
    color: #42494e;
    font: inherit;
    font-size: 12px;
    font-weight: 750;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
.spice-org-chart-lightbox__button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
}
.spice-org-chart-lightbox__button--primary {
    border-color: #40474c;
    background: #40474c;
    color: #fff;
}
.spice-org-chart-lightbox__button:hover,
.spice-org-chart-lightbox__close:hover {
    transform: translateY(-1px);
    border-color: #bfc5c9;
}
.spice-org-chart-lightbox__button--primary:hover {
    border-color: #2f3539;
    background: #2f3539;
}
.spice-org-chart-lightbox__close {
    width: 39px;
    padding: 0;
    font-size: 23px;
    font-weight: 400;
    line-height: 1;
}
.spice-org-chart-lightbox__button:focus-visible,
.spice-org-chart-lightbox__close:focus-visible {
    outline: 3px solid rgba(82,92,99,.18);
    outline-offset: 2px;
}
.spice-org-chart-lightbox__status {
    padding: 8px 22px;
    border-bottom: 1px solid #e3e6e8;
    background: #f0f2f3;
    color: #626a70;
    font-size: 12px;
    line-height: 1.45;
}
.spice-org-chart-lightbox__content {
    min-width: 0;
    min-height: 0;
    display: grid;
    place-items: center;
    overflow: hidden;
    padding: clamp(16px, 2.4vw, 34px);
    overscroll-behavior: contain;
}
.spice-org-chart-lightbox__fit-stage {
    position: relative;
    flex: 0 0 auto;
    min-width: 1px;
    min-height: 1px;
}
.spice-org-chart--lightbox-clone {
    width: 100%;
    min-width: 100%;
    margin: 0;
    box-shadow: 0 14px 45px rgba(43,49,53,.08);
    will-change: transform;
}
.spice-org-chart--lightbox-clone .spice-org-chart__canvas {
    max-height: none;
}

@media (max-width: 720px) {
    .spice-org-chart-lightbox { padding: 0; }
    .spice-org-chart-lightbox__panel {
        width: 100vw;
        height: 100dvh;
        border: 0;
        border-radius: 0;
    }
    .spice-org-chart-lightbox__toolbar {
        align-items: flex-start;
        padding: 12px;
    }
    .spice-org-chart-lightbox__heading { display: none; }
    .spice-org-chart-lightbox__actions {
        width: 100%;
    }
    .spice-org-chart-lightbox__button { flex: 1 1 auto; justify-content: center; }
    .spice-org-chart-lightbox__close { flex: 0 0 39px; }
   .spice-org-chart-lightbox__content { padding: 12px; }
}

/* Print/PDF output is intentionally limited to the currently opened chart. */
@media print {
    @page { size: A4 landscape; margin: 10mm; }
    body.spice-org-chart-printing {
        background: #fff !important;
        overflow: visible !important;
    }
    body.spice-org-chart-printing > *:not(.spice-org-chart-lightbox) {
        display: none !important;
    }
    body.spice-org-chart-printing .spice-org-chart-lightbox {
        position: static !important;
        inset: auto !important;
        display: block !important;
        padding: 0 !important;
        background: transparent !important;
        opacity: 1 !important;
        -webkit-backdrop-filter: none !important;
        backdrop-filter: none !important;
    }
    body.spice-org-chart-printing .spice-org-chart-lightbox__panel {
        width: auto !important;
        height: auto !important;
        display: block !important;
        overflow: visible !important;
        border: 0 !important;
        border-radius: 0 !important;
        background: #fff !important;
        box-shadow: none !important;
        transform: none !important;
    }
    body.spice-org-chart-printing .spice-org-chart-lightbox__toolbar,
    body.spice-org-chart-printing .spice-org-chart-lightbox__status {
        display: none !important;
    }
    body.spice-org-chart-printing .spice-org-chart-lightbox__content {
        overflow: visible !important;
        padding: 0 !important;
    }
    body.spice-org-chart-printing .spice-org-chart-lightbox__fit-stage {
        position: static !important;
        width: auto !important;
        height: auto !important;
        min-width: 0 !important;
        min-height: 0 !important;
    }
    body.spice-org-chart-printing .spice-org-chart--lightbox-clone {
        position: static !important;
        left: auto !important;
        top: auto !important;
        width: 100% !important;
        min-width: 0 !important;
        transform: none !important;
        border: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        break-inside: avoid;
    }
    body.spice-org-chart-printing .spice-org-chart__header {
        padding: 0 0 8mm !important;
        background: #fff !important;
    }
    body.spice-org-chart-printing .spice-org-chart__canvas {
        overflow: visible !important;
        padding: 0 !important;
    }
    body.spice-org-chart-printing .spice-org-chart__node {
        box-shadow: none !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* Inline fit + detail zoom (v0.29.1). */
.spice-org-chart__canvas[data-inline-fit="1"] {
    overflow: hidden !important;
    scrollbar-width: none;
}
.spice-org-chart__canvas[data-inline-fit="1"]::-webkit-scrollbar {
    display: none;
}

.spice-org-chart-lightbox__zoom-group {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px;
    border: 1px solid #d3d8db;
    border-radius: 11px;
    background: #f6f7f7;
}
.spice-org-chart-lightbox__zoom-button {
    appearance: none;
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #42494e;
    font: inherit;
    font-size: 19px;
    font-weight: 650;
    line-height: 1;
    cursor: pointer;
    transition: background .15s ease, color .15s ease, opacity .15s ease;
}
.spice-org-chart-lightbox__zoom-button:hover:not(:disabled) {
    background: #fff;
}
.spice-org-chart-lightbox__zoom-button:disabled,
.spice-org-chart-lightbox__button--fit:disabled {
    opacity: .38;
    cursor: default;
    transform: none;
}
.spice-org-chart-lightbox__zoom-button:focus-visible {
    outline: 3px solid rgba(82,92,99,.18);
    outline-offset: 1px;
}
.spice-org-chart-lightbox__zoom-label {
    min-width: 43px;
    color: #687178;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.spice-org-chart-lightbox__button--fit {
    min-height: 32px;
    margin-left: 2px;
    padding: 6px 9px;
    border: 0;
    background: transparent;
}
.spice-org-chart-lightbox__button--fit:hover:not(:disabled) {
    background: #fff;
}
.spice-org-chart-lightbox__content.is-zoomed {
    display: block;
    overflow: auto;
    cursor: grab;
    scrollbar-width: thin;
    scrollbar-color: #c3c9cd transparent;
}
.spice-org-chart-lightbox__content.is-zoomed.is-panning {
    cursor: grabbing;
    user-select: none;
}
.spice-org-chart-lightbox__content.is-zoomed .spice-org-chart-lightbox__fit-stage {
    margin: 0 auto;
}

@media (max-width: 900px) {
    .spice-org-chart-lightbox__actions {
        flex-wrap: wrap;
        justify-content: flex-end;
    }
    .spice-org-chart-lightbox__zoom-group {
        order: 2;
    }
}

@media (max-width: 720px) {
    .spice-org-chart-lightbox__actions {
        display: grid;
        grid-template-columns: minmax(0,1fr) minmax(0,1fr) 39px;
        gap: 6px;
    }
    .spice-org-chart-lightbox__zoom-group {
        grid-column: 1 / -1;
        order: 0;
        justify-content: center;
    }
    .spice-org-chart-lightbox__button--fit {
        flex: 0 0 auto;
    }
}
