/* Tripo H3.1 / P1 generation controls and post-process pipeline. */

#composerPanel.is-tripo-mode {
    container-name: tripo-composer;
    container-type: inline-size;
}

.tripo-mode-panel.tripo-workflow {
    display: grid;
    width: 100%;
    max-width: none;
    gap: 8px;
    padding: 0;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.tripo-mode-panel.tripo-workflow.hidden {
    display: none;
}

.tripo-workflow__topbar {
    display: flex;
    min-width: 0;
    align-items: stretch;
    gap: 8px;
    padding-right: 40px;
    border-bottom: 1px solid var(--ui-border);
}

.tripo-workflow__brand {
    display: inline-flex;
    min-width: 78px;
    flex: 0 0 auto;
    align-items: center;
    gap: 6px;
    color: var(--ui-text-1);
    font-size: 10px;
    font-weight: 780;
    white-space: nowrap;
}

.tripo-workflow__brand svg {
    color: var(--ui-text-2);
    stroke: currentColor;
}

.tripo-workflow__context {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    flex: 0 0 auto;
    min-width: 194px;
    gap: 2px;
    padding: 3px;
    border-radius: 12px;
    background: var(--ui-surface-3);
}

.tripo-workflow__context-button,
.tripo-workflow__tab,
.tripo-workflow-choice,
.tripo-workflow-toggle,
.tripo-workflow__advanced,
.tripo-workflow__ready-action {
    font: inherit;
    cursor: pointer;
}

.tripo-workflow__context-button {
    display: inline-flex;
    min-width: 0;
    min-height: 36px;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 9px;
    border: 1px solid transparent;
    border-radius: 9px;
    background: transparent;
    color: var(--ui-text-2);
    font-size: 10.5px;
    font-weight: 750;
    white-space: nowrap;
    transition: background-color .16s ease, border-color .16s ease, color .16s ease;
}

.tripo-workflow__context-button:hover {
    background: var(--ui-hover);
    color: var(--ui-text-1);
}

.tripo-workflow__context-button.is-selected {
    border-color: var(--accent-border-strong);
    background: var(--ui-active);
    color: var(--accent);
    box-shadow: inset 0 -2px 0 var(--accent);
}

.tripo-workflow__context-button svg,
.tripo-workflow__tab svg,
.tripo-workflow-choice svg,
.tripo-workflow__advanced svg,
.tripo-workflow__ready svg {
    color: currentColor;
    stroke: currentColor;
}

.tripo-workflow__tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    flex: 1 1 auto;
    min-width: 0;
    gap: 0;
    padding: 0;
    border-radius: 0;
    background: transparent;
}

.tripo-workflow__tabs:has(.tripo-workflow__tab:nth-child(5)) {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.tripo-workflow__tab {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr);
    min-width: 0;
    min-height: 42px;
    align-items: center;
    gap: 6px;
    padding: 5px 7px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--ui-text-2);
    text-align: left;
    transition: background-color .16s ease, border-color .16s ease, color .16s ease;
}

.tripo-workflow__tab:hover {
    background: color-mix(in srgb, var(--ui-hover) 72%, transparent);
    color: var(--ui-text-1);
}

.tripo-workflow__tab.is-selected {
    background: transparent;
    color: var(--ui-text-1);
    box-shadow: inset 0 -2px 0 var(--accent);
}

.tripo-workflow__tab-icon {
    display: inline-flex;
    width: 22px;
    height: 22px;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    background: var(--ui-surface-2);
    color: var(--ui-text-3);
}

.tripo-workflow__tab.is-selected .tripo-workflow__tab-icon {
    background: var(--accent-subtle-2);
    color: var(--accent);
}

.tripo-workflow__tab-copy {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.tripo-workflow__tab-copy strong,
.tripo-workflow__tab-copy small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tripo-workflow__tab-copy strong {
    color: currentColor;
    font-size: 10.5px;
    font-weight: 760;
}

.tripo-workflow__tab-copy small {
    color: var(--ui-text-3);
    font-size: 8.5px;
    font-weight: 650;
}

.tripo-workflow__source-stage {
    display: flex;
    min-width: 0;
    min-height: 42px;
    align-items: center;
    gap: 12px;
    padding: 3px 5px 2px;
}

.tripo-workflow__source-stage.hidden {
    display: none;
}

.tripo-workflow .tripo-mode-panel__source {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 8px;
    padding: 0;
    border-left: 0;
}

.tripo-workflow__source-meta {
    min-width: 0;
    margin: 0;
    overflow: hidden;
    color: var(--ui-text-3);
    font-size: 9px;
    font-weight: 600;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tripo-workflow__panel {
    min-width: 0;
    min-height: 124px;
    max-height: 190px;
    overflow: auto;
    padding: 8px 9px 6px;
    border-radius: 13px;
    background: color-mix(in srgb, var(--ui-surface-1) 72%, transparent);
    scrollbar-width: thin;
}

.tripo-workflow__panel.hidden {
    display: none;
}

.tripo-workflow__stage-grid {
    display: grid;
    grid-template-columns: minmax(230px, 1.05fr) minmax(190px, .82fr) minmax(270px, 1.13fr);
    min-width: 0;
    gap: 10px;
}

.tripo-workflow__stage-grid--material {
    grid-template-columns: minmax(350px, 1fr) minmax(350px, 1fr);
}

.tripo-workflow__stage-grid--output {
    grid-template-columns: minmax(210px, .85fr) minmax(270px, 1.05fr) minmax(230px, 1fr);
}

.tripo-workflow__group {
    display: grid;
    min-width: 0;
    align-content: start;
    gap: 6px;
}

.tripo-workflow__group--actions {
    grid-template-columns: minmax(0, 1fr);
}

.tripo-workflow__group--actions > .tripo-workflow__group-label,
.tripo-workflow__group--actions > .tripo-workflow__toggle-row {
    grid-column: 1;
}

.tripo-workflow__group--actions > .tripo-workflow__advanced {
    grid-column: 1;
    grid-row: auto;
    justify-self: end;
}

.tripo-workflow__group-label {
    color: var(--ui-text-3);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .08em;
    line-height: 1;
    text-transform: uppercase;
}

.tripo-workflow__choice-row,
.tripo-workflow__toggle-row {
    display: flex;
    min-width: 0;
    gap: 5px;
}

.tripo-workflow-choice {
    position: relative;
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr);
    min-width: 0;
    min-height: 48px;
    flex: 1 1 0;
    align-items: center;
    gap: 6px;
    padding: 6px 20px 6px 7px;
    border: 1px solid var(--ui-border);
    border-radius: 10px;
    background: var(--ui-surface-2);
    color: var(--ui-text-2);
    text-align: left;
    transition: background-color .16s ease, border-color .16s ease, color .16s ease;
}

.tripo-workflow-choice:hover:not(:disabled) {
    border-color: var(--ui-border-strong);
    background: var(--ui-hover);
    color: var(--ui-text-1);
}

.tripo-workflow-choice.is-selected {
    border-color: var(--accent-border-strong);
    background: var(--ui-active);
    color: var(--ui-text-1);
}

.tripo-workflow-choice:disabled {
    cursor: not-allowed;
    opacity: .42;
}

.tripo-workflow-choice__icon {
    display: inline-flex;
    width: 24px;
    height: 24px;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    background: var(--ui-surface-3);
    color: var(--ui-text-3);
}

.tripo-workflow-choice.is-selected .tripo-workflow-choice__icon,
.tripo-workflow-choice.is-selected .tripo-workflow-choice__check {
    color: var(--accent);
}

.tripo-workflow-choice__check {
    position: absolute;
    top: 6px;
    right: 5px;
}

.tripo-workflow-choice:not(.is-selected) .tripo-workflow-choice__check {
    visibility: hidden;
}

.tripo-workflow-choice__copy {
    display: grid;
    min-width: 0;
    gap: 1px;
}

.tripo-workflow-choice__copy strong,
.tripo-workflow-choice__copy small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tripo-workflow-choice__copy strong {
    font-size: 10px;
    font-weight: 760;
}

.tripo-workflow-choice__copy small {
    color: var(--ui-text-3);
    font-size: 8.5px;
}

.tripo-workflow__group--quality .tripo-workflow-choice,
.tripo-workflow__choice-row--four .tripo-workflow-choice {
    grid-template-columns: minmax(0, 1fr);
    padding-left: 9px;
}

.tripo-workflow__group--quality .tripo-workflow-choice__icon,
.tripo-workflow__choice-row--four .tripo-workflow-choice__icon {
    display: none;
}

.tripo-workflow-toggle {
    display: inline-flex;
    min-width: 0;
    min-height: 32px;
    flex: 1 1 0;
    align-items: center;
    justify-content: space-between;
    gap: 7px;
    padding: 5px 7px;
    border: 1px solid var(--ui-border);
    border-radius: 9px;
    background: var(--ui-surface-2);
    color: var(--ui-text-2);
    font-size: 9px;
    font-weight: 700;
    white-space: nowrap;
}

.tripo-workflow-toggle:hover:not(:disabled) {
    background: var(--ui-hover);
    color: var(--ui-text-1);
}

.tripo-workflow-toggle > i {
    position: relative;
    width: 24px;
    height: 14px;
    flex: 0 0 auto;
    border-radius: 999px;
    background: var(--ui-border-strong);
}

.tripo-workflow-toggle > i::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ui-panel-elevated-bg);
    transition: transform .16s ease;
}

.tripo-workflow-toggle.is-active {
    border-color: var(--accent-border-strong);
    background: var(--ui-active);
    color: var(--accent);
}

.tripo-workflow-toggle.is-active > i {
    background: var(--accent);
}

.tripo-workflow-toggle.is-active > i::after {
    transform: translateX(10px);
    background: var(--accent-contrast);
}

.tripo-workflow-toggle:disabled {
    cursor: not-allowed;
    opacity: .42;
}

.tripo-workflow__advanced {
    display: inline-flex;
    min-height: 32px;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 9px;
    border: 1px solid var(--ui-border);
    border-radius: 9px;
    background: transparent;
    color: var(--ui-text-2);
    font-size: 9px;
    font-weight: 750;
    white-space: nowrap;
}

.tripo-workflow__advanced:hover {
    border-color: var(--accent-border-strong);
    background: var(--ui-active);
    color: var(--accent);
}

.tripo-workflow__constraint {
    margin: 7px 0 0;
    color: var(--ui-text-3);
    font-size: 8.5px;
    line-height: 1.3;
}

.tripo-workflow__ready {
    display: grid;
    grid-template-columns: 38px minmax(180px, 1fr) minmax(180px, auto) auto;
    min-height: 92px;
    align-items: center;
    gap: 12px;
}

.tripo-workflow__ready-icon {
    display: inline-flex;
    width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    background: var(--ui-active);
    color: var(--accent);
}

.tripo-workflow__ready-copy {
    display: grid;
    min-width: 0;
    gap: 3px;
}

.tripo-workflow__ready-copy strong {
    color: var(--ui-text-1);
    font-size: 11px;
    font-weight: 760;
}

.tripo-workflow__ready-copy small {
    color: var(--ui-text-3);
    font-size: 9px;
    line-height: 1.45;
}

.tripo-workflow__ready-chips {
    display: flex;
    min-width: 0;
    flex-wrap: wrap;
    gap: 5px;
}

.tripo-workflow__ready-chips em {
    padding: 5px 7px;
    border-radius: 999px;
    background: var(--ui-surface-3);
    color: var(--ui-text-2);
    font-size: 8px;
    font-style: normal;
    font-weight: 700;
    white-space: nowrap;
}

.tripo-workflow__ready-action {
    display: inline-flex;
    min-height: 36px;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 10px;
    border: 1px solid var(--accent-border-strong);
    border-radius: 10px;
    background: var(--accent);
    color: var(--accent-contrast);
    font-size: 9px;
    font-weight: 780;
    white-space: nowrap;
}

.tripo-workflow__context-button:focus-visible,
.tripo-workflow__tab:focus-visible,
.tripo-workflow-choice:focus-visible,
.tripo-workflow-toggle:focus-visible,
.tripo-workflow__advanced:focus-visible,
.tripo-workflow__ready-action:focus-visible {
    outline: 2px solid var(--ui-focus-ring);
    outline-offset: 2px;
}

#composerPanel.is-tripo-mode #modelWrap,
#composerPanel.is-tripo-mode #tripoGeometryModeWrap,
#composerPanel.is-tripo-mode #tripoTextureModeWrap,
#composerPanel.is-tripo-mode #tripoPartsWrap {
    display: none !important;
}

#composerPanel.is-tripo-mode #composerFooter {
    min-width: 0;
    gap: 8px;
}

#composerPanel.is-tripo-mode #composerFooter > div:first-child {
    min-width: 0;
    flex: 1 1 auto;
    gap: 6px;
}

#composerPanel.is-tripo-mode #composerFooter > div:first-child > * {
    margin-left: 0 !important;
}

#composerPanel.is-tripo-mode #composerFooter > div:last-child {
    flex: 0 0 auto;
}

#composerPanel.is-tripo-ready-mode #composerFooter {
    display: none !important;
}

#composerPanel.is-tripo-ready-mode .tripo-workflow__topbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
}

#composerPanel.is-tripo-ready-mode .tripo-workflow__context {
    min-width: 194px;
    justify-self: start;
}

#composerPanel.is-tripo-ready-mode .tripo-workflow__tabs {
    grid-column: 1 / -1;
}

#composerPanel.is-tripo-ready-mode .tripo-workflow__tab {
    grid-template-columns: 19px minmax(0, 1fr);
    gap: 4px;
    padding-inline: 5px;
}

#composerPanel.is-tripo-ready-mode .tripo-workflow__tab-icon {
    width: 19px;
    height: 19px;
}

#composerPanel.is-tripo-ready-mode .tripo-workflow__tab-copy small {
    display: none;
}

#composerPanel.is-tripo-ready-mode .tripo-workflow__tab-copy strong {
    font-size: 10px;
}

#composerPanel.is-tripo-mode .tripo-settings-popover {
    position: fixed;
    right: auto;
    bottom: 104px;
    left: 50%;
    width: min(680px, calc(100vw - 32px));
    max-height: min(76vh, calc(100vh - 128px));
    transform: translateX(-50%);
}

body.is-tripo-ready-picking #gallery-grid [data-card-id] {
    animation: tripo-ready-pick 1.4s ease both;
}

@keyframes tripo-ready-pick {
    0%, 100% { box-shadow: none; }
    35% { box-shadow: 0 0 0 2px var(--accent-border-strong); }
}

html.no-borders .tripo-mode-panel.tripo-workflow,
html.no-borders .tripo-workflow-choice:not(.is-selected),
html.no-borders .tripo-workflow-toggle:not(.is-active),
html.no-borders .tripo-workflow__advanced {
    border-color: transparent;
}

html.no-borders .tripo-workflow__context-button.is-selected,
html.no-borders .tripo-workflow__tab.is-selected,
html.no-borders .tripo-workflow-choice.is-selected,
html.no-borders .tripo-workflow-toggle.is-active {
    border-color: var(--accent-border-strong);
}

@container tripo-composer (max-width: 760px) {
    .tripo-workflow__topbar {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
    }

    .tripo-workflow__context {
        width: 100%;
        min-width: 0;
    }

    .tripo-workflow__tabs {
        grid-column: 1 / -1;
    }

    .tripo-workflow__stage-grid,
    .tripo-workflow__stage-grid--material {
        grid-template-columns: repeat(2, minmax(240px, 1fr));
    }

    .tripo-workflow__group--actions {
        grid-column: 1 / -1;
    }

    .tripo-workflow__panel {
        max-height: 180px;
    }

    .tripo-workflow__ready {
        grid-template-columns: 38px minmax(0, 1fr) auto;
    }

    .tripo-workflow__ready-chips {
        grid-column: 2 / -1;
    }
}

@container tripo-composer (max-width: 520px) {
    .tripo-workflow__tabs {
        display: flex;
        overflow-x: auto;
        overscroll-behavior-inline: contain;
        scroll-snap-type: x proximity;
        scrollbar-width: thin;
    }

    .tripo-workflow__tab {
        flex: 0 0 126px;
        scroll-snap-align: start;
    }

    .tripo-workflow__source-stage {
        display: grid;
        gap: 6px;
    }

    .tripo-workflow .tripo-mode-panel__source {
        overflow-x: auto;
    }

    .tripo-workflow__source-meta {
        white-space: normal;
    }

    .tripo-workflow__stage-grid,
    .tripo-workflow__stage-grid--material {
        grid-template-columns: minmax(280px, 1fr);
    }

    .tripo-workflow__group--actions {
        grid-column: auto;
    }

    .tripo-workflow__ready {
        grid-template-columns: 34px minmax(0, 1fr);
    }

    .tripo-workflow__ready-chips,
    .tripo-workflow__ready-action {
        grid-column: 1 / -1;
    }

    .tripo-workflow__ready-action {
        justify-self: start;
    }
}

@container tripo-composer (max-width: 420px) {
    .tripo-settings-trigger__summary,
    .tripo-settings-trigger__divider {
        display: none;
    }

    #composerPanel.is-tripo-mode #genBtn {
        padding-inline: 13px;
    }
}

@media (pointer: coarse) {
    .tripo-workflow__context-button,
    .tripo-workflow__tab,
    .tripo-workflow-choice,
    .tripo-workflow__ready-action,
    #composerPanel.is-tripo-mode #genBtn {
        min-height: 44px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tripo-workflow__context-button,
    .tripo-workflow__tab,
    .tripo-workflow-choice,
    .tripo-workflow-toggle,
    .tripo-workflow-toggle > i::after {
        transition: none;
    }

    body.is-tripo-ready-picking #gallery-grid [data-card-id] {
        animation: none;
    }
}

.tripo-settings-popover {
    width: min(680px, calc(100vw - 32px));
    max-height: min(76vh, 720px);
    overflow: auto;
    background: var(--ui-panel-elevated-bg);
    color: var(--ui-text-1);
    border-color: var(--ui-border);
    box-shadow: var(--ui-shadow);
}

.tripo-settings-popover__header {
    position: sticky;
    top: 0;
    z-index: 2;
    background: color-mix(in srgb, var(--ui-panel-elevated-bg) 94%, transparent);
    color: var(--ui-text-1);
    backdrop-filter: blur(16px);
    border-color: var(--ui-border);
}

.tripo-settings-popover__eyebrow,
.tripo-gen-section__heading span,
.tripo-gen-field > span,
.tripo-gen-field small {
    color: var(--ui-text-3);
}

.tripo-settings-popover__close {
    color: var(--ui-text-2);
}

.tripo-settings-popover__close:hover {
    background: var(--ui-hover);
    color: var(--ui-text-1);
}

.tripo-gen-form {
    display: grid;
    gap: 0;
}

.tripo-gen-section {
    padding: 18px 20px;
    border-bottom: 1px solid var(--ui-border);
}

.tripo-gen-section__heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.tripo-gen-section__heading strong {
    color: var(--ui-text-1);
    font-size: 13px;
    font-weight: 700;
}

.tripo-gen-section__heading span {
    font-size: 10px;
    font-variant-numeric: tabular-nums;
}

.tripo-gen-grid {
    display: grid;
    gap: 10px;
}

.tripo-gen-grid--two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.tripo-gen-grid--three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 12px;
}

.tripo-gen-field {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.tripo-gen-field--wide {
    margin-bottom: 10px;
}

.tripo-gen-field > span {
    font-size: 10px;
    font-weight: 650;
    letter-spacing: .02em;
}

.tripo-gen-field input,
.tripo-gen-field select,
.tripo-gen-field textarea {
    width: 100%;
    min-height: 36px;
    border: 1px solid var(--ui-border);
    border-radius: 10px;
    background: var(--ui-input-bg);
    color: var(--ui-text-1);
    padding: 8px 10px;
    font: inherit;
    font-size: 12px;
    outline: none;
}

.tripo-gen-field textarea {
    min-height: 58px;
    resize: vertical;
}

.tripo-gen-field input:focus,
.tripo-gen-field select:focus,
.tripo-gen-field textarea:focus {
    border-color: var(--ui-focus-ring);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ui-focus-ring) 30%, transparent);
}

.tripo-gen-field input:disabled,
.tripo-gen-field select:disabled,
.tripo-gen-field textarea:disabled {
    cursor: not-allowed;
    opacity: .48;
}

.tripo-gen-toggle-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin-top: 12px;
}

.tripo-gen-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 36px;
    padding: 7px 9px;
    border: 1px solid var(--ui-border);
    border-radius: 10px;
    background: var(--ui-surface-2);
    color: var(--ui-text-2);
    font-size: 10px;
    font-weight: 650;
    text-align: left;
    transition: background-color .16s ease, color .16s ease, border-color .16s ease;
}

.tripo-gen-toggle:hover:not(:disabled) {
    background: var(--ui-hover);
    color: var(--ui-text-1);
}

.tripo-gen-toggle > i {
    position: relative;
    flex: 0 0 auto;
    width: 26px;
    height: 15px;
    border-radius: 999px;
    background: var(--ui-border-strong);
}

.tripo-gen-toggle > i::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--ui-panel-elevated-bg);
    transition: transform .16s ease;
}

.tripo-gen-toggle.is-active {
    border-color: var(--accent-border-strong);
    background: var(--ui-active);
    color: var(--accent);
}

.tripo-gen-toggle.is-active > i {
    background: var(--accent);
}

.tripo-gen-toggle.is-active > i::after {
    transform: translateX(11px);
    background: var(--accent-contrast);
}

.tripo-gen-toggle:disabled {
    cursor: not-allowed;
    opacity: .45;
}

.tripo-gen-constraint {
    margin: 0;
    padding: 11px 20px 14px;
    color: var(--ui-text-3);
    font-size: 10px;
    line-height: 1.5;
}

.tripo-ops-modal svg {
    stroke: currentColor;
}

html.tripo-ops-open,
html.tripo-ops-open body {
    overflow: hidden;
}

.tripo-ops-modal {
    --tripo-status-success: var(--status-success, var(--accent));
    --tripo-status-error: var(--status-error, var(--ui-danger, var(--accent)));
    position: fixed;
    inset: 0;
    z-index: 460;
    display: grid;
    place-items: center;
    padding: 22px;
    color: var(--ui-text-1);
}

.tripo-ops-modal.hidden {
    display: none;
}

.tripo-ops-modal.is-inline {
    position: relative;
    inset: auto;
    z-index: auto;
    display: block;
    width: 100%;
    padding: 0;
}

.tripo-ops-modal.is-inline .tripo-ops-modal__backdrop,
.tripo-ops-modal.is-inline .tripo-ops-panel__header,
.tripo-ops-modal.is-inline .tripo-ops-source,
.tripo-ops-modal.is-inline .tripo-ops-list {
    display: none;
}

.tripo-ops-modal.is-inline .tripo-ops-panel {
    width: 100%;
    max-height: none;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.tripo-ops-modal.is-inline .tripo-ops-panel__body {
    overflow: visible;
    padding: 0;
}

.tripo-ops-modal.is-inline .tripo-ops-layout {
    display: block;
    margin-top: 0;
}

.tripo-ops-modal.is-inline .tripo-ops-workspace {
    padding: 14px 0 0;
    border: 0;
    border-top: 1px solid var(--ui-border);
    border-radius: 0;
    background: transparent;
}

.tripo-ops-modal.is-inline .tripo-ops-workspace__heading {
    margin-bottom: 11px;
}

.tripo-ops-modal.is-inline .tripo-ops-submit {
    min-width: 132px;
}

html.no-borders .tripo-ops-modal.is-inline .tripo-ops-workspace {
    border-top-color: transparent;
}

.tripo-ops-modal__backdrop {
    position: absolute;
    inset: 0;
    background: color-mix(in srgb, var(--ui-bg) 72%, transparent);
    backdrop-filter: blur(12px);
}

.tripo-ops-panel {
    position: relative;
    width: min(1020px, calc(100vw - 44px));
    max-height: min(820px, calc(100vh - 44px));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--ui-border-strong);
    border-radius: 20px;
    background: var(--ui-panel-elevated-bg);
    box-shadow: var(--ui-shadow);
}

.tripo-ops-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex: 0 0 auto;
    padding: 15px 18px;
    border-bottom: 1px solid var(--ui-border);
    background: var(--ui-surface-2);
}

.tripo-ops-panel__title {
    display: flex;
    align-items: center;
    gap: 11px;
}

.tripo-ops-panel__title small,
.tripo-ops-workspace__heading small,
.tripo-ops-source__copy small {
    display: block;
    color: var(--ui-text-3);
    font-size: 9px;
    font-weight: 750;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.tripo-ops-panel__title h2,
.tripo-ops-workspace__heading h3 {
    margin: 2px 0 0;
    color: var(--ui-text-1);
    font-size: 17px;
    font-weight: 760;
}

.tripo-ops-panel__logo,
.tripo-ops-source__icon,
.tripo-ops-result__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
    border-radius: 11px;
    background: var(--ui-active);
    color: var(--accent);
}

.tripo-ops-panel__logo svg,
.tripo-ops-source__icon svg,
.tripo-ops-result__icon svg {
    width: 18px;
    height: 18px;
}

.tripo-ops-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--ui-border);
    border-radius: 10px;
    background: var(--ui-surface-3);
    color: var(--ui-text-2);
}

.tripo-ops-icon-btn:hover {
    background: var(--ui-hover);
    color: var(--ui-text-1);
}

.tripo-ops-icon-btn svg {
    width: 16px;
    height: 16px;
}

.tripo-ops-panel__body {
    min-height: 0;
    overflow: auto;
    padding: 16px;
}

.tripo-ops-source {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
    padding: 11px 12px;
    border: 1px solid var(--ui-border);
    border-radius: 14px;
    background: var(--ui-surface-1);
}

.tripo-ops-source__copy {
    display: grid;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.tripo-ops-source__copy strong {
    overflow: hidden;
    color: var(--ui-text-1);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tripo-ops-source__copy span {
    color: var(--ui-text-3);
    font-size: 10px;
}

.tripo-ops-source__open {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    color: var(--ui-text-2);
}

.tripo-ops-source__open:hover {
    background: var(--ui-hover);
    color: var(--accent);
}

.tripo-ops-source__open svg {
    width: 14px;
    height: 14px;
}

.tripo-ops-layout {
    display: grid;
    grid-template-columns: 210px minmax(0, 1fr);
    gap: 14px;
    margin-top: 14px;
}

.tripo-ops-list {
    display: grid;
    align-content: start;
    gap: 5px;
}

.tripo-ops-operation {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    min-height: 38px;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: var(--ui-text-2);
    font-size: 11px;
    font-weight: 650;
    text-align: left;
}

.tripo-ops-operation:hover {
    background: var(--ui-hover);
    color: var(--ui-text-1);
}

.tripo-ops-operation.is-active {
    border-color: var(--accent-border-strong);
    background: var(--ui-active);
    color: var(--accent);
}

.tripo-ops-operation svg {
    width: 15px;
    height: 15px;
    flex: 0 0 auto;
}

.tripo-ops-workspace {
    min-width: 0;
    padding: 16px;
    border: 1px solid var(--ui-border);
    border-radius: 14px;
    background: var(--ui-surface-1);
}

.tripo-ops-workspace__heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 13px;
}

.tripo-ops-capability {
    padding: 4px 7px;
    border-radius: 999px;
    background: var(--ui-active);
    color: var(--accent);
    font-size: 9px;
    font-weight: 750;
}

.tripo-ops-form {
    display: grid;
    gap: 12px;
}

.tripo-ops-description,
.tripo-ops-form__note {
    margin: 0 0 14px;
    color: var(--ui-text-2);
    font-size: 11px;
    line-height: 1.55;
}

.tripo-ops-fields-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.tripo-ops-field {
    display: grid;
    gap: 6px;
}

.tripo-ops-field > span {
    color: var(--ui-text-3);
    font-size: 10px;
    font-weight: 650;
}

.tripo-ops-field input,
.tripo-ops-field select,
.tripo-ops-field textarea {
    width: 100%;
    height: 38px;
    border: 1px solid var(--ui-border);
    border-radius: 10px;
    outline: 0;
    background: var(--ui-input-bg);
    color: var(--ui-text-1);
    padding: 0 10px;
    font: inherit;
    font-size: 11px;
}

.tripo-ops-field textarea {
    height: auto;
    min-height: 70px;
    padding-block: 9px;
    resize: vertical;
}

.tripo-ops-field select[multiple] {
    height: auto;
    min-height: 128px;
    padding-block: 5px;
}

.tripo-ops-field input[type="file"] {
    height: auto;
    min-height: 42px;
    padding: 7px;
    color: var(--ui-text-2);
}

.tripo-ops-field input[type="file"]::file-selector-button {
    margin-right: 9px;
    padding: 6px 9px;
    border: 1px solid var(--ui-border-strong);
    border-radius: 7px;
    background: var(--ui-surface-3);
    color: var(--ui-text-1);
    font: inherit;
    font-weight: 700;
}

.tripo-ops-field input:focus,
.tripo-ops-field select:focus,
.tripo-ops-field textarea:focus {
    border-color: var(--ui-focus-ring);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ui-focus-ring) 28%, transparent);
}

.tripo-ops-field small {
    color: var(--ui-text-3);
    font-size: 9px;
}

.tripo-ops-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--ui-text-2);
    font-size: 11px;
}

.tripo-ops-check input {
    accent-color: var(--accent);
}

.tripo-ops-submit-row {
    display: flex;
    justify-content: flex-end;
    padding-top: 4px;
}

.tripo-ops-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 38px;
    padding: 8px 15px;
    border: 1px solid var(--accent-border-strong);
    border-radius: 11px;
    background: var(--accent);
    color: var(--accent-contrast);
    font-size: 11px;
    font-weight: 780;
}

.tripo-ops-submit:hover:not(:disabled) {
    filter: brightness(1.06);
}

.tripo-ops-submit:disabled {
    cursor: wait;
    opacity: .5;
}

.tripo-ops-submit svg,
.tripo-ops-result__actions svg {
    width: 14px;
    height: 14px;
}

.tripo-ops-status,
.tripo-ops-result {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: 13px;
    padding: 11px 12px;
    border: 1px solid var(--ui-border);
    border-radius: 11px;
    background: var(--ui-surface-2);
    color: var(--ui-text-2);
    font-size: 11px;
}

.tripo-ops-status.hidden,
.tripo-ops-result.hidden {
    display: none;
}

.tripo-ops-status.is-loading {
    border-color: var(--accent-border-strong);
    color: var(--accent);
}

.tripo-ops-status.is-success {
    border-color: color-mix(in srgb, var(--tripo-status-success) 60%, var(--ui-border));
    color: color-mix(in srgb, var(--tripo-status-success) 80%, var(--ui-text-1));
}

.tripo-ops-status.is-error {
    border-color: color-mix(in srgb, var(--tripo-status-error) 62%, var(--ui-border));
    color: color-mix(in srgb, var(--tripo-status-error) 82%, var(--ui-text-1));
}

.tripo-ops-status svg {
    width: 15px;
    height: 15px;
    flex: 0 0 auto;
}

.tripo-ops-status .is-spinning {
    animation: tripo-spin .9s linear infinite;
}

.tripo-ops-result__copy {
    display: grid;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.tripo-ops-result__copy strong {
    color: var(--ui-text-1);
    font-size: 11px;
}

.tripo-ops-result__copy span {
    color: var(--ui-text-3);
    font-size: 9px;
}

.tripo-ops-result__metadata {
    display: grid;
    gap: 4px;
    margin: 6px 0 0;
}

.tripo-ops-result__metadata div {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.tripo-ops-result__metadata dt {
    color: var(--ui-text-3);
}

.tripo-ops-result__metadata dd {
    margin: 0;
    color: var(--ui-text-1);
    font-weight: 700;
}

.tripo-ops-result__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

.tripo-ops-result__actions a,
.tripo-ops-result__actions button {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 30px;
    padding: 5px 8px;
    border: 1px solid var(--ui-border);
    border-radius: 8px;
    background: var(--ui-surface-3);
    color: var(--ui-text-2);
    font-size: 9px;
    font-weight: 700;
}

.tripo-ops-result__actions a:hover,
.tripo-ops-result__actions button:hover {
    background: var(--ui-hover);
    color: var(--accent);
}

.tripo-ops-empty {
    margin: 0;
    padding: 12px;
    color: var(--ui-text-3);
    font-size: 10px;
}

html.no-borders .tripo-gen-section,
html.no-borders .tripo-gen-field input,
html.no-borders .tripo-gen-field select,
html.no-borders .tripo-gen-field textarea,
html.no-borders .tripo-gen-toggle:not(.is-active),
html.no-borders .tripo-ops-panel,
html.no-borders .tripo-ops-panel__header,
html.no-borders .tripo-ops-icon-btn,
html.no-borders .tripo-ops-source,
html.no-borders .tripo-ops-workspace,
html.no-borders .tripo-ops-field input,
html.no-borders .tripo-ops-field select,
html.no-borders .tripo-ops-field textarea,
html.no-borders .tripo-ops-field input[type="file"]::file-selector-button,
html.no-borders .tripo-ops-status,
html.no-borders .tripo-ops-result,
html.no-borders .tripo-ops-result__actions a,
html.no-borders .tripo-ops-result__actions button {
    border-color: transparent;
}

html.no-borders .tripo-gen-toggle.is-active,
html.no-borders .tripo-ops-operation.is-active,
html.no-borders .tripo-ops-submit,
html.no-borders .tripo-ops-status.is-loading {
    box-shadow: inset 0 0 0 1px var(--accent-border-strong);
}

.tripo-gen-toggle:focus-visible,
.tripo-ops-modal button:focus-visible,
.tripo-ops-modal a:focus-visible {
    outline: 2px solid var(--ui-focus-ring);
    outline-offset: 2px;
}

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

@media (max-width: 820px) {
    .tripo-gen-toggle-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .tripo-gen-grid--three {
        grid-template-columns: 1fr;
    }

    .tripo-ops-modal {
        padding: 8px;
    }

    .tripo-ops-panel {
        width: calc(100vw - 16px);
        max-height: calc(100vh - 16px);
    }

    .tripo-ops-layout {
        grid-template-columns: 1fr;
    }

    .tripo-ops-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 540px) {
    .tripo-gen-grid--two,
    .tripo-ops-fields-grid {
        grid-template-columns: 1fr;
    }

    .tripo-ops-list {
        grid-template-columns: 1fr;
    }

    .tripo-ops-result {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .tripo-ops-result__actions {
        width: 100%;
    }
}
