.template-inspector-action {
    grid-template-columns: minmax(0, 1fr);
    margin-top: 18px;
}

.template-inspector-action .btn-demo-action {
    margin-top: 12px;
}

.template-inspector-modal {
    --inspector-pink: #e81683;
    --inspector-ink: #142033;
    --inspector-muted: #687386;
    --inspector-line: #dfe4ea;
}

.template-inspector-modal .modal-dialog {
    max-width: min(1240px, calc(100vw - 32px));
}

.template-inspector-modal .modal-content {
    overflow: hidden;
    border: 0;
    border-top: 4px solid var(--inspector-pink);
    border-radius: 8px;
    box-shadow: 0 28px 80px rgba(20, 32, 51, .24);
}

.template-inspector-modal .modal-header {
    align-items: flex-start;
    padding: 22px 26px 18px;
    border-bottom-color: var(--inspector-line);
}

.template-inspector-modal .modal-header h2 {
    margin: 3px 0 4px;
    color: var(--inspector-ink);
    font-size: 24px;
    font-weight: 650;
}

.template-inspector-modal .modal-header p {
    margin: 0;
    color: var(--inspector-muted);
    font-size: 14px;
}

.template-inspector-modal .modal-body {
    padding: 0;
    background: #f6f7f9;
}

.template-inspector-modal .modal-footer {
    min-height: 72px;
    gap: 10px;
    padding: 14px 26px;
    border-top-color: var(--inspector-line);
}

.template-inspector-loading {
    display: grid;
    min-height: 100%;
    place-content: center;
    justify-items: center;
    gap: 8px;
    color: var(--inspector-muted);
    text-align: center;
}

.template-inspector-loading[hidden],
.template-inspector-grid[hidden] {
    display: none;
}

.template-inspector-loading strong {
    margin-top: 8px;
    color: var(--inspector-ink);
    font-size: 16px;
}

.template-inspector-loading span:last-child {
    font-size: 12px;
}

.template-inspector-spinner {
    width: 34px;
    height: 34px;
    border: 3px solid #ead8e2;
    border-top-color: var(--inspector-pink);
    border-radius: 50%;
    animation: template-inspector-spin .75s linear infinite;
}

@keyframes template-inspector-spin {
    to { transform: rotate(360deg); }
}

.template-inspector-grid {
    display: grid;
    grid-template-columns: minmax(240px, .78fr) minmax(390px, 1.35fr) minmax(280px, .9fr);
    min-height: 100%;
}

.template-inspector-pane {
    min-width: 0;
    padding: 24px;
    background: #fff;
}

@media (min-width: 992px) {
    .template-inspector-modal .modal-body {
        height: min(640px, calc(100vh - 220px));
        min-height: 420px;
        overflow: hidden;
    }

    .template-inspector-grid {
        height: 100%;
        min-height: 0;
    }

    .template-inspector-pane {
        height: 100%;
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
        scrollbar-gutter: stable;
    }
}

.template-inspector-pane + .template-inspector-pane {
    border-left: 1px solid var(--inspector-line);
}

.template-inspector-pane h3 {
    display: inline;
    margin: 0 0 18px 8px;
    color: var(--inspector-ink);
    font-size: 15px;
    font-weight: 700;
}

.template-inspector-modal .nested-designer-step {
    display: inline-grid;
    width: 24px;
    height: 24px;
    place-items: center;
    color: #fff;
    background: var(--inspector-pink);
    border-radius: 50%;
    font-size: 11px;
    font-weight: 750;
}

.template-inspector-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin: 20px 0 18px;
}

.template-inspector-stats > div {
    padding: 10px 7px;
    background: #f5f7f9;
    border: 1px solid var(--inspector-line);
    border-radius: 6px;
    text-align: center;
}

.template-inspector-stats strong,
.template-inspector-stats span {
    display: block;
}

.template-inspector-stats strong {
    color: var(--inspector-ink);
    font-size: 17px;
}

.template-inspector-stats span {
    margin-top: 2px;
    color: #8a93a1;
    font-size: 9px;
    font-weight: 650;
    text-transform: uppercase;
}

.template-inspector-tree {
    display: grid;
    gap: 4px;
}

.template-tree-node__row {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr);
    gap: 4px;
    align-items: center;
    min-width: 0;
    padding-left: calc(var(--element-depth) * 12px);
}

.template-tree-children {
    display: grid;
    gap: 4px;
}

.template-tree-children[hidden] {
    display: none;
}

.template-tree-toggle,
.template-tree-toggle-spacer {
    width: 20px;
    height: 32px;
}

.template-tree-toggle {
    display: grid;
    padding: 0;
    place-items: center;
    color: #7d8999;
    background: transparent;
    border: 0;
    border-radius: 4px;
}

.template-tree-toggle:hover {
    color: var(--inspector-pink);
    background: #fff1f8;
}

.template-tree-toggle:focus-visible {
    outline: 3px solid rgba(232, 22, 131, .18);
    outline-offset: 1px;
}

.template-tree-toggle span {
    width: 7px;
    height: 7px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(-45deg);
    transition: transform .15s ease;
}

.template-tree-toggle[aria-expanded="true"] span {
    transform: rotate(45deg);
}

.template-tree-item,
.template-tree-group {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    gap: 9px;
    align-items: center;
    width: 100%;
    min-width: 0;
    min-height: 42px;
    padding: 7px 8px;
    color: var(--inspector-ink);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    text-align: left;
}

.template-tree-item:hover,
.template-tree-group:hover {
    background: #f7f8fa;
    border-color: var(--inspector-line);
}

.template-tree-item.is-selected {
    background: #fff2f8;
    border-color: #e49ac2;
}

.template-tree-item:focus-visible,
.template-tree-group:focus-visible {
    outline: 3px solid rgba(232, 22, 131, .18);
    outline-offset: 1px;
}

.template-tree-item strong,
.template-tree-item > span:last-child > span,
.template-tree-group strong,
.template-tree-group > span:last-child > span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.template-tree-item strong,
.template-tree-group strong {
    font-size: 11px;
}

.template-tree-item > span:last-child > span,
.template-tree-group > span:last-child > span {
    margin-top: 2px;
    color: #8a93a1;
    font-size: 9px;
}

.template-tree-group {
    color: #425169;
    background: #f7f9fb;
    border-color: var(--inspector-line);
}

.template-element-marker {
    display: block;
    width: 14px;
    height: 14px;
    border: 2px solid #7d8999;
}

.template-element-marker[data-kind="document"] {
    border-radius: 2px;
    box-shadow: inset 0 -4px #e9edf2;
}

.template-element-marker[data-kind="block"] {
    border-color: var(--inspector-pink);
    border-radius: 3px;
    background: #fff1f8;
}

.template-element-marker[data-kind="field"] {
    width: 11px;
    height: 11px;
    margin-left: 2px;
    border-color: #467caf;
    background: #edf5fc;
    transform: rotate(45deg);
}

.template-inspector-map-pane {
    background: #f9fafb;
}

.template-inspector-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.template-inspector-heading > span {
    color: #8a93a1;
    font-size: 10px;
    font-weight: 650;
}

.template-structure-map {
    margin-top: 20px;
}

.template-map-document {
    overflow: hidden;
    background: #fff;
    border: 1px solid #cbd3de;
    border-radius: 7px;
    box-shadow: 0 10px 28px rgba(24, 37, 57, .08);
}

.template-map-document.is-selected {
    border-color: #8b98a9;
    box-shadow: 0 0 0 3px rgba(93, 108, 127, .11), 0 10px 28px rgba(24, 37, 57, .08);
}

.template-map-document__header,
.template-map-block__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    border: 0;
    text-align: left;
}

.template-map-document__header {
    padding: 10px 12px;
    color: #fff;
    background: #263449;
    font-size: 11px;
    font-weight: 700;
}

.template-map-document__header span {
    opacity: .65;
    font-size: 9px;
    font-weight: 500;
}

.template-map-blocks {
    padding: 12px;
    background: repeating-linear-gradient(135deg, #fafbfd, #fafbfd 8px, #f6f8fa 8px, #f6f8fa 16px);
}

.template-map-block {
    overflow: hidden;
    margin-bottom: 10px;
    background: #fff;
    border: 1px solid #e49ac2;
    border-radius: 6px;
}

.template-map-block:last-child {
    margin-bottom: 0;
}

.template-map-block.is-selected {
    border-color: var(--inspector-pink);
    box-shadow: 0 0 0 3px rgba(232, 22, 131, .13);
}

.template-map-block__header {
    padding: 8px 10px;
    color: #fff;
    background: #b51470;
}

.template-map-block__header strong {
    font-size: 10px;
}

.template-map-block__header code {
    overflow: hidden;
    color: rgba(255, 255, 255, .72);
    font-size: 8px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.template-map-block .template-map-block > .template-map-block__header {
    background: #356f9f;
}

.template-map-block .template-map-block .template-map-block {
    border-color: #8fadd0;
}

.template-map-block .template-map-block .template-map-block > .template-map-block__header {
    background: #4f6179;
}

.template-map-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px;
}

.template-map-root-fields {
    border-bottom: 1px solid var(--inspector-line);
    background: #f7f9fb;
}

.template-map-field {
    max-width: 100%;
    overflow: hidden;
    padding: 5px 7px;
    color: #2f6798;
    background: #edf5fc;
    border: 1px solid #b9d2e8;
    border-radius: 4px;
    font-family: "Cascadia Code", Consolas, monospace;
    font-size: 8px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.template-map-field:hover,
.template-map-field.is-selected {
    color: #fff;
    background: #356f9f;
    border-color: #356f9f;
}

.template-map-no-fields {
    color: #9aa2ae;
    font-size: 9px;
    font-style: italic;
}

.template-map-children {
    padding: 0 10px 10px;
}

.template-inspector-details {
    background: #fff;
}

.template-inspector-details > div {
    margin-top: 22px;
}

.template-detail-kind {
    display: block;
    color: var(--inspector-pink);
    font-size: 9px;
    font-weight: 750;
    text-transform: uppercase;
}

.template-inspector-details h4 {
    margin: 7px 0 9px;
    color: var(--inspector-ink);
    font-size: 20px;
    overflow-wrap: anywhere;
}

.template-inspector-details p {
    margin: 0;
    color: var(--inspector-muted);
    font-size: 12px;
    line-height: 1.65;
}

.template-detail-properties {
    display: grid;
    grid-template-columns: minmax(90px, auto) minmax(0, 1fr);
    gap: 8px 12px;
    margin: 22px 0 0;
    padding-top: 16px;
    border-top: 1px solid var(--inspector-line);
}

.template-detail-properties dt,
.template-detail-properties dd {
    margin: 0;
    font-size: 10px;
}

.template-detail-properties dt {
    color: #8a93a1;
    font-weight: 600;
}

.template-detail-properties dd {
    color: var(--inspector-ink);
    overflow-wrap: anywhere;
}

.template-detail-properties code {
    color: #a70f62;
    font-size: 9px;
}

.template-detail-preview {
    margin-top: 20px;
    padding: 12px;
    background: #f7f8fa;
    border: 1px solid var(--inspector-line);
    border-radius: 6px;
}

.template-detail-preview strong {
    display: block;
    margin-bottom: 6px;
    color: var(--inspector-ink);
    font-size: 10px;
}

.template-detail-preview p {
    font-size: 10px;
}

.template-inspector-summary {
    margin-right: auto;
    color: var(--inspector-muted);
    font-size: 11px;
}

.template-inspector-empty {
    margin: 14px 4px;
    color: var(--inspector-muted);
    font-size: 11px;
    line-height: 1.5;
}

@media (max-width: 991.98px) {
    .template-inspector-grid {
        grid-template-columns: 1fr;
    }

    .template-inspector-pane + .template-inspector-pane {
        border-top: 1px solid var(--inspector-line);
        border-left: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .template-inspector-spinner { animation: none; }
}
