/* Design-transformer skin (scoped to plugin only) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

#vtu-container {
    /* shadcn/tailwind tokens */
    --background: 210 40% 98%;
    --foreground: 220 25% 15%;
    --card: 0 0% 100%;
    --card-foreground: 220 25% 15%;
    --popover: 0 0% 100%;
    --popover-foreground: 220 25% 15%;
    --primary: 175 75% 38%;
    --primary-foreground: 0 0% 100%;
    --secondary: 210 30% 94%;
    --secondary-foreground: 220 20% 25%;
    --muted: 210 25% 92%;
    --muted-foreground: 220 15% 45%;
    --accent: 175 70% 42%;
    --accent-foreground: 0 0% 100%;
    --destructive: 0 80% 55%;
    --destructive-foreground: 0 0% 100%;
    --border: 210 20% 88%;
    --input: 210 25% 94%;
    --ring: 175 75% 45%;
    --radius: 0.75rem;

    --gradient-primary: linear-gradient(135deg, hsl(175 75% 40%) 0%, hsl(190 75% 45%) 100%);
    --gradient-secondary: linear-gradient(135deg, hsl(210 30% 96%) 0%, hsl(210 35% 92%) 100%);
    --gradient-accent: linear-gradient(135deg, hsl(175 75% 42%) 0%, hsl(200 70% 50%) 100%);
    --gradient-danger: linear-gradient(135deg, hsl(0 75% 55%) 0%, hsl(350 70% 50%) 100%);
    --shadow-glow: 0 0 50px hsl(175 80% 50% / 0.25);
    --shadow-card: 0 4px 24px hsl(220 30% 20% / 0.08);
    --shadow-elevated: 0 12px 40px hsl(220 30% 20% / 0.12);

    /* Back-compat variables used by the existing plugin UI */
    --vtu-bg: hsl(var(--background));
    --vtu-surface: hsl(var(--secondary));
    --vtu-text: hsl(var(--foreground));
    --vtu-muted: hsl(var(--muted-foreground));
    --vtu-border: hsl(var(--border));
    --vtu-primary: hsl(175 75% 38%);
    --vtu-primary-2: hsl(190 75% 45%);
    --vtu-success: hsl(175 75% 38%);

    width: min(980px, 100%);
    margin: 28px auto;
    padding: 24px;
    background: hsl(var(--background));
    border: 1px solid hsl(var(--border));
    border-radius: calc(var(--radius) + 0.25rem);
    box-shadow: var(--shadow-elevated);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.55;
    color: hsl(var(--foreground));
}

.vtu-header h2 {
    font-weight: 900;
}

.vtu-help,
.vtu-subtitle,
.vtu-meta {
    line-height: 1.5;
}

/* Strong scoped reset: override WP theme defaults INSIDE the plugin only */
#vtu-container,
#vtu-container * {
    box-sizing: border-box;
}

#vtu-container :where(h1,h2,h3,h4,h5,h6,p,ul,ol,li,figure) {
    margin: 0;
    padding: 0;
}

#vtu-container :where(button,input,select,textarea) {
    font: inherit;
    color: inherit;
}

#vtu-container a {
    color: inherit;
}

#vtu-container :where(label) {
    font-weight: 800;
}

#vtu-container :where(input,select,textarea) {
    border-radius: calc(var(--radius) - 0.25rem);
    border: 1px solid hsl(var(--border));
    background: #fff;
    padding: 10px 12px;
    outline: none;
}

#vtu-container :where(input,select,textarea):focus {
    box-shadow: 0 0 0 4px hsl(var(--ring) / 0.20);
    border-color: hsl(var(--ring) / 0.55);
}

#vtu-container :where(details summary) {
    list-style: none;
}

#vtu-container :where(details summary::-webkit-details-marker) {
    display: none;
}

.vtu-header h2 {
    margin: 0;
    font-size: 1.7rem;
    letter-spacing: -0.02em;
}

.vtu-subtitle {
    margin: 8px 0 0 0;
    color: hsl(var(--muted-foreground));
    font-size: 0.98rem;
    line-height: 1.4;
}

.vtu-meta {
    margin-top: 10px;
    padding: 10px 12px;
    border: 1px solid hsl(var(--border));
    border-radius: 12px;
    background: hsl(var(--secondary) / 0.50);
    color: hsl(var(--muted-foreground));
    font-size: 0.95rem;
}

/* Core design utility classes (match design-transformer) */
#vtu-container .glass-card {
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: calc(var(--radius) + 0.25rem);
    box-shadow: var(--shadow-card);
}

#vtu-container .glass-card-elevated {
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: calc(var(--radius) + 0.25rem);
    box-shadow: var(--shadow-elevated);
}

#vtu-container .glow-effect {
    position: relative;
}

#vtu-container .glow-effect::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: calc(var(--radius) + 0.25rem);
    opacity: 0;
    transition: opacity 200ms ease;
    background: var(--gradient-primary);
    filter: blur(22px);
    z-index: -1;
}

#vtu-container .glow-effect:hover::before {
    opacity: 0.12;
}

#vtu-container .section-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: hsl(var(--foreground));
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

#vtu-container .label-text {
    font-size: 0.875rem;
    font-weight: 500;
    color: hsl(var(--muted-foreground));
    margin-bottom: 8px;
    display: block;
}

/* Watermark section: separate image vs text settings */
.vtu-subsection-title {
    margin: 10px 0 10px 0;
    font-size: 0.9rem;
    font-weight: 700;
    color: hsl(var(--foreground));
}

.vtu-subsection-divider {
    margin: 16px 0;
    height: 1px;
    background: hsl(var(--border));
}

#vtu-container .btn-gradient {
    background: var(--gradient-primary);
    color: hsl(var(--primary-foreground));
    font-weight: 600;
    transition: transform 200ms ease, box-shadow 200ms ease, filter 200ms ease;
}

#vtu-container .btn-gradient:hover {
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}

#vtu-container .input-light {
    background: hsl(var(--input));
    border: 1px solid hsl(var(--border));
    border-radius: calc(var(--radius) - 0.25rem);
    padding: 10px 12px;
    color: hsl(var(--foreground));
    transition: box-shadow 180ms ease, border-color 180ms ease;
}

#vtu-container .input-light::placeholder {
    color: hsl(var(--muted-foreground));
}

/* Minimal spacing utilities used in markup */
#vtu-container .p-6 { padding: 24px; }
#vtu-container .p-8 { padding: 32px; }

.vtu-file-upload {
    margin-top: 16px;
}

.vtu-file-upload input[type="file"] {
    width: 100%;
}

.vtu-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

.vtu-dropzone {
    position: relative;
    border-radius: calc(var(--radius) + 0.25rem);
    border: 2px dashed hsl(var(--border));
    background: hsl(var(--secondary) / 0.50);
    padding: 42px 18px;
    outline: none;
}

.vtu-dropzone:focus {
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.18);
}

.vtu-dropzone.vtu-dragover {
    border-color: hsl(var(--ring) / 0.65);
    background: hsl(var(--secondary) / 0.75);
}

.vtu-dropzone-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
}

/* (upload icon tile removed from markup) */

.vtu-dropzone-btn {
    appearance: none;
    border: 0;
    border-radius: 12px;
    padding: 12px 18px;
    font-weight: 600;
    background: var(--gradient-primary);
    color: hsl(var(--primary-foreground));
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Ensure themes can't override the blue button text color */
#vtu-container .vtu-dropzone-btn,
#vtu-container .vtu-dropzone-btn:visited,
#vtu-container .vtu-dropzone-btn:hover,
#vtu-container .vtu-dropzone-btn:active {
    color: #fff;
}

.vtu-dropzone-hint {
    font-weight: 600;
    color: hsl(var(--muted-foreground));
}

.vtu-dropzone-subhint {
    color: hsl(var(--muted-foreground) / 0.65);
    font-size: 0.92rem;
}

.vtu-video-preview {
    margin: 16px 0;
}

/* New card headers + mini actions (design-transformer style) */
.vtu-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.vtu-clear-link {
    background: transparent;
    border: 0;
    padding: 0;
    font-size: 0.8rem;
    font-weight: 800;
    color: hsl(var(--destructive));
    cursor: pointer;
}

.vtu-clear-link:hover {
    color: hsl(var(--destructive) / 0.8);
}

.vtu-mini-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.vtu-mini-muted {
    font-size: 0.8rem;
    color: hsl(var(--muted-foreground));
}

.vtu-mini-link {
    font-size: 0.8rem;
    font-weight: 600;
    color: hsl(var(--primary));
    text-decoration: none;
    border: 0;
    background: transparent;
    padding: 0;
    cursor: pointer;
}

.vtu-mini-link:hover {
    color: hsl(var(--primary) / 0.8);
}

/* Thumbnail layout matching design */
.vtu-thumb-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    align-items: start;
    margin-top: 12px;
}

.vtu-thumb-ready {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: calc(var(--radius) - 0.25rem);
    background: hsl(142 76% 92% / 0.9);
    border: 1px solid hsl(142 76% 38% / 0.35);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.vtu-thumb-ready-left {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: hsl(142 72% 24%);
    font-weight: 700;
}

.vtu-thumb-check {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: hsl(142 76% 38% / 0.18);
    color: hsl(142 76% 26%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.vtu-thumb-download {
    text-decoration: none;
    white-space: nowrap;
}

@media (max-width: 560px) {
    .vtu-thumb-ready {
        flex-direction: column;
        align-items: stretch;
    }
    .vtu-thumb-download {
        width: 100%;
        justify-content: center;
    }
}

.vtu-thumb-controls {
    display: flex;
    gap: 12px;
    align-items: center;
}

@media (max-width: 560px) {
    .vtu-thumb-controls {
        flex-direction: column;
        align-items: stretch;
    }
    .vtu-thumb-btn {
        width: 100%;
    }
}

.vtu-thumb-btn {
    border-radius: calc(var(--radius) - 0.15rem);
    padding: 10px 14px;
}

.vtu-thumb-preview-box {
    aspect-ratio: 16 / 9;
    background: hsl(var(--secondary));
    border-radius: calc(var(--radius) - 0.15rem);
    overflow: hidden;
    border: 1px solid hsl(var(--border));
    display: grid;
    place-items: center;
    position: relative;
}

.vtu-thumb-placeholder {
    text-align: center;
    color: hsl(var(--muted-foreground) / 0.75);
    display: grid;
    gap: 8px;
    place-items: center;
}

.vtu-thumb-preview {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: transparent;
    border: 0;
    border-radius: 0;
    max-height: none;
}

@media (max-width: 860px) {
    .vtu-thumb-layout {
        grid-template-columns: 1fr;
    }
}

/* Parts table matching design */
.vtu-table-wrap {
    overflow-x: auto;
}

.vtu-table {
    width: 100%;
    border-collapse: collapse;
}

.vtu-table thead th {
    text-align: left;
    font-size: 0.78rem;
    font-weight: 600;
    color: hsl(var(--muted-foreground));
    border-bottom: 1px solid hsl(var(--border) / 0.5);
    padding: 10px 0;
}

.vtu-table tbody td {
    font-size: 0.92rem;
    border-bottom: 1px solid hsl(var(--border) / 0.3);
    padding: 12px 0;
    vertical-align: middle;
}

.vtu-table tbody tr:last-child td {
    border-bottom: 0;
}

.vtu-td-muted { color: hsl(var(--muted-foreground)); }
.vtu-td-primary { color: hsl(var(--primary)); font-weight: 600; }

.vtu-table-btn {
    padding: 6px 10px;
    border-radius: calc(var(--radius) - 0.35rem);
    font-size: 0.78rem;
    min-height: 30px;
    gap: 6px;
}

/* Make table action icons more legible */
.vtu-table-btn .vtu-icon svg {
    width: 18px;
    height: 18px;
}

@media (max-width: 560px) {
    /* Icon-only buttons on mobile */
    .vtu-table-btn {
        width: 40px;
        height: 36px;
        padding: 0;
        justify-content: center;
    }
    .vtu-table-btn .vtu-icon {
        margin-right: 0;
    }
    .vtu-btn-text {
        display: none;
    }
}

.vtu-btn-danger-lite {
    background: hsl(var(--destructive) / 0.20);
    border: 1px solid transparent;
    color: hsl(var(--destructive));
}

.vtu-btn-danger-lite:hover {
    background: hsl(var(--destructive) / 0.28);
    transform: none;
    filter: none;
}

#video-preview {
    width: 100%;
    max-height: 520px;
    border: 1px solid var(--vtu-border);
    border-radius: 14px;
    background: #000;
    position: relative;
    z-index: 1;
}

.vtu-video-stage {
    position: relative;
}

.vtu-live-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2;
}

.vtu-live-watermark {
    position: absolute;
    max-width: 35%;
    max-height: 35%;
    opacity: 0.7;
    filter: drop-shadow(0 2px 10px rgba(0,0,0,0.35));
    pointer-events: auto;
    cursor: grab;
}

.vtu-live-watermark:active {
    cursor: grabbing;
}

.vtu-live-text {
    position: absolute;
    font-weight: 900;
    text-shadow: 0 2px 10px rgba(0,0,0,0.55);
    color: #fff;
    white-space: pre-wrap;
}

#slider {
    margin: 16px 0 14px 0;
}

.vtu-slider-wrap {
    position: relative;
    overflow: visible;
}

/* Timeline */
.vtu-timeline {
    margin: 10px 0 6px 0;
    padding: 12px;
    border: 1px solid hsl(var(--border));
    border-radius: calc(var(--radius) + 0.25rem);
    background: hsl(var(--card));
}

.vtu-timeline-top {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.vtu-time {
    font-weight: 900;
    color: var(--vtu-muted);
    font-size: 0.95rem;
}

.vtu-timeline-track {
    border: 1px solid hsl(var(--border));
    border-radius: 14px;
    background: #fff;
    padding: 10px 10px 16px 10px;
}

.vtu-frames {
    position: absolute;
    left: 10px;
    right: 10px;
    top: 10px;
    height: 52px;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 4px;
    overflow: hidden;
    border-radius: 10px;
    border: 1px solid var(--vtu-border);
    background: hsl(var(--muted));
}

.vtu-frame {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    filter: contrast(1.02) saturate(1.02);
}

.vtu-overlay {
    position: absolute;
    left: 10px;
    right: 10px;
    top: 10px;
    height: 52px;
    border-radius: 10px;
    pointer-events: none;
}

.vtu-selection-overlay {
    background: hsl(var(--primary) / 0.20);
    border: 1px solid hsl(var(--primary) / 0.35);
}

.vtu-keep-block {
    position: absolute;
    top: 0;
    bottom: 0;
    background: hsl(var(--primary) / 0.18);
    border: 1px solid hsl(var(--primary) / 0.30);
    border-radius: 10px;
}

.vtu-cut-block {
    position: absolute;
    top: 0;
    bottom: 0;
    background: hsl(var(--destructive) / 0.18);
    border: 1px solid hsl(var(--destructive) / 0.30);
    border-radius: 10px;
    display: flex;
    justify-content: flex-end;
    align-items: start;
    padding: 6px;
    pointer-events: auto;
}

.vtu-cut-block.vtu-cut-block-disabled {
    pointer-events: none;
    justify-content: flex-end;
}

.vtu-cut-x {
    width: 26px;
    height: 26px;
    border-radius: 999px;
    border: 1px solid rgba(15, 23, 42, 0.15);
    background: #fff;
    font-weight: 900;
    cursor: pointer;
}

.vtu-seg-actions {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
}

.vtu-icon-btn-blue {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid rgba(37, 99, 235, 0.35);
    background: rgba(37, 99, 235, 0.12);
    color: #1e3a8a;
    cursor: pointer;
    font-weight: 900;
}

.vtu-playhead {
    position: absolute;
    top: 10px;
    height: 52px;
    width: 2px;
    background: hsl(var(--primary) / 0.9);
    left: 10px;
    transform: translateX(0);
    border-radius: 999px;
    pointer-events: none;
}

.vtu-timeline-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 10px;
    flex-wrap: wrap;
}

/* Mobile: make action buttons equal width */
@media (max-width: 560px) {
    .vtu-timeline-controls {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .vtu-timeline-controls .vtu-btn {
        width: 100%;
    }
}

.vtu-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
}

.vtu-icon svg {
    display: block;
}

.vtu-btn-success {
    background: var(--gradient-primary);
    color: hsl(var(--primary-foreground));
    box-shadow: var(--shadow-glow);
}

.vtu-btn-danger {
    background: hsl(var(--destructive) / 0.18);
    color: hsl(var(--destructive));
    border: 1px solid hsl(var(--destructive) / 0.25);
    box-shadow: none;
}

.vtu-btn-danger:hover {
    background: hsl(var(--destructive) / 0.24);
    filter: none;
    transform: none;
}

/* Place noUiSlider inside timeline track */
.vtu-timeline-track #slider {
    margin: 76px 0 0 0;
}

.vtu-scrub-preview {
    position: fixed;
    transform: translate(-50%, -110%);
    width: 220px;
    padding: 8px;
    border-radius: 14px;
    border: 1px solid var(--vtu-border);
    background: #fff;
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.18);
    z-index: 999999;
    pointer-events: none;
}

.vtu-scrub-preview img {
    width: 100%;
    height: 110px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--vtu-border);
    background: #000;
    display: block;
}

.vtu-scrub-time {
    margin-top: 6px;
    font-weight: 900;
    font-size: 0.9rem;
    color: var(--vtu-text);
    text-align: center;
}

.vtu-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    align-items: end;
}

.vtu-grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.vtu-grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.vtu-input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
}

.vtu-input-group label {
    font-weight: 700;
    font-size: 0.92rem;
}

.vtu-input-group input[type="number"],
.vtu-input-group input[type="text"],
.vtu-input-group input[type="file"],
.vtu-input-group input[type="color"],
.vtu-input-group select {
    width: 100%;
    padding: 10px 11px;
    border: 1px solid var(--vtu-border);
    border-radius: 12px;
    font-size: 1rem;
    background: #fff;
    color: var(--vtu-text);
    outline: none;
}

.vtu-input-group input[type="range"] {
    width: 100%;
}

.vtu-help {
    color: var(--vtu-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

.vtu-checkbox {
    display: grid;
    grid-template-columns: 20px 1fr;
    gap: 10px;
    align-items: start;
    margin: 12px 0;
    padding: 10px 12px;
    border: 1px solid var(--vtu-border);
    border-radius: 14px;
    background: var(--vtu-surface);
}

.vtu-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
}

.vtu-advanced {
    margin-top: 14px;
    border: 1px solid var(--vtu-border);
    border-radius: 16px;
    background: #fff;
    overflow: hidden;
}

.vtu-advanced summary {
    cursor: pointer;
    padding: 14px 14px;
    font-weight: 800;
    user-select: none;
    background: var(--vtu-surface);
}

.vtu-advanced-body {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Advanced layout: left settings + right preview + flip box */
.vtu-adv-two-col {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 420px);
    gap: 16px;
    align-items: start;
}

.vtu-adv-left {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.vtu-adv-right .vtu-fitfill-preview {
    width: 100%;
    max-width: 100%;
}

.vtu-adv-preview {
    background: hsl(var(--secondary));
    border: 1px solid hsl(var(--border));
    border-radius: calc(var(--radius) + 0.25rem);
    padding: 12px;
}

.vtu-adv-flip {
    margin-top: 6px;
}

@media (max-width: 980px) {
    .vtu-adv-two-col {
        grid-template-columns: 1fr;
    }
}

/* (Watermark inner collapses removed — panel opens fully now) */

.vtu-advanced-note {
    padding: 10px 12px;
    border: 1px solid rgba(37, 99, 235, 0.25);
    background: rgba(37, 99, 235, 0.08);
    border-radius: 12px;
    color: #1e3a8a;
    font-weight: 600;
}

.vtu-seg {
    display: flex;
    gap: 8px;
    justify-content: flex-start;
    align-items: center;
}

.vtu-radio {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 10px;
    border: 1px solid var(--vtu-border);
    border-radius: 999px;
    background: #fff;
    font-weight: 700;
    user-select: none;
}

.vtu-inline {
    display: flex;
    align-items: center;
    gap: 10px;
}

.vtu-inline-actions {
    margin: 10px 0 4px 0;
}

.vtu-divider {
    height: 1px;
    background: var(--vtu-border);
}

.vtu-card {
    border: 1px solid var(--vtu-border);
    border-radius: 16px;
    background: var(--vtu-surface);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.vtu-card-title {
    font-weight: 900;
    letter-spacing: -0.01em;
}

.vtu-card .vtu-grid {
    margin-top: 4px;
}

.vtu-top-tools {
    margin-top: 14px;
}

.vtu-stack {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Space between section blocks (Advanced / Merge etc) */
.vtu-advanced,
#vtu-merge-collapse {
    margin-top: 14px;
}

.vtu-thumb-preview {
    width: 100%;
    max-height: 260px;
    object-fit: contain;
    border-radius: 14px;
    border: 1px solid var(--vtu-border);
    background: #fff;
}

.vtu-collapse {
    border: 1px solid var(--vtu-border);
    border-radius: 16px;
    background: var(--vtu-surface);
    overflow: hidden;
}

/* Ensure collapsible sections never touch each other */
#vtu-container > .vtu-collapse,
#vtu-container > .vtu-advanced {
    margin-top: 14px;
}

.vtu-collapse-summary {
    cursor: pointer;
    padding: 14px 14px;
    font-weight: 900;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    user-select: none;
}

.vtu-collapse-body {
    border-top: 1px solid var(--vtu-border);
}

/* Generic inner panel used in Merge (and can be reused elsewhere) */
.vtu-inner-panel {
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: calc(var(--radius) + 0.15rem);
    padding: 14px;
}

/* Merge: remove the old nested-card look */
#vtu-container #vtu-merge-collapse .vtu-collapse-body {
    background: transparent;
}

.vtu-status {
    margin-top: 12px;
    min-height: 22px;
    font-size: 0.95rem;
    color: var(--vtu-muted);
}

.vtu-success-banner {
    margin-top: 12px;
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(22, 163, 74, 0.25);
    background: rgba(22, 163, 74, 0.10);
    color: #065f2a;
}

.vtu-success-icon {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: rgba(22, 163, 74, 0.18);
    flex: 0 0 auto;
}

.vtu-success-title {
    font-weight: 900;
}

.vtu-success-sub {
    font-size: 0.92rem;
    color: rgba(6, 95, 42, 0.85);
}

.vtu-progress-wrap {
    width: 100%;
    height: 18px;
    background: rgba(15, 23, 42, 0.10);
    border-radius: 999px;
    overflow: hidden;
    margin-top: 10px;
    position: relative;
}

.vtu-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--vtu-primary), var(--vtu-primary-2));
    width: 0%;
    transition: width 120ms linear;
    border-radius: 999px;
}

.vtu-progress-text {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: 0.82rem;
    font-weight: 900;
    color: rgba(255,255,255,0.92);
    text-shadow: 0 1px 2px rgba(0,0,0,0.35);
    pointer-events: none;
}

/* Small attention pulse when we auto-scroll to progress */
.vtu-progress-pulse {
    animation: vtuPulse 0.9s ease-out 1;
}

@keyframes vtuPulse {
    0% { box-shadow: 0 0 0 0 rgba(59,130,246,0.0); }
    25% { box-shadow: 0 0 0 6px rgba(59,130,246,0.18); }
    55% { box-shadow: 0 0 0 10px rgba(59,130,246,0.10); }
    100% { box-shadow: 0 0 0 0 rgba(59,130,246,0.0); }
}

.vtu-progress-step {
    margin-top: 8px;
    font-size: 0.92rem;
    font-weight: 800;
    color: var(--vtu-muted);
}

.vtu-actions {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.vtu-btn {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 14px;
    padding: 12px 14px;
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    min-height: 44px;
}

/* Ensure colors are stable even with theme overrides */
#vtu-container .vtu-btn-secondary,
#vtu-container .vtu-btn-blue,
#vtu-container .vtu-btn-success {
    color: #fff;
}

#vtu-container .vtu-btn:disabled,
#vtu-container .vtu-btn[disabled] {
    background: #e2e8f0;
    border-color: #e2e8f0;
    color: #64748b;
    box-shadow: none;
    filter: none;
    transform: none;
    cursor: not-allowed;
    opacity: 1;
}

.vtu-input-group input[type="number"],
.vtu-input-group input[type="text"],
.vtu-input-group select {
    min-height: 44px;
}

/* Thumbnail row: keep things aligned (scoped class) */
.vtu-thumb-grid {
    align-items: end;
    grid-template-columns: 160px 240px 1fr;
}

.vtu-thumb-grid #vtu-thumb-btn {
    width: 100%;
}

.vtu-thumb-grid .vtu-input-group label {
    min-height: 20px;
}

.vtu-btn-primary {
    background: hsl(var(--primary) / 0.14);
    color: hsl(var(--primary));
    border: 1px solid hsl(var(--primary) / 0.18);
    box-shadow: none;
}

.vtu-btn-primary:hover {
    background: hsl(var(--primary) / 0.18);
    filter: none;
    transform: none;
}

#vtu-add-seg.vtu-btn-primary {
    padding: 12px 16px;
    border-radius: 999px;
}

.vtu-btn-primary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* "Secondary" should still look like a nice primary action (no black buttons) */
#vtu-container .vtu-btn-secondary {
    background: linear-gradient(180deg, var(--vtu-primary-2), var(--vtu-primary));
    color: #fff;
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.20);
}

/* Strengthen button/link styles against theme overrides */
#vtu-container .vtu-btn,
#vtu-container .vtu-link {
    text-decoration: none;
}

#vtu-container .vtu-btn:hover {
    filter: brightness(1.02);
}

#vtu-container .vtu-btn:active {
    transform: translateY(0.5px);
}

.vtu-mini-ico {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: rgba(30, 58, 138, 0.9);
}

.vtu-check-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.vtu-wm-preview-wrap {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.vtu-wm-preview {
    border: 1px dashed var(--vtu-border);
    border-radius: 14px;
    background:
      linear-gradient(45deg, rgba(15,23,42,0.06) 25%, transparent 25%),
      linear-gradient(-45deg, rgba(15,23,42,0.06) 25%, transparent 25%),
      linear-gradient(45deg, transparent 75%, rgba(15,23,42,0.06) 75%),
      linear-gradient(-45deg, transparent 75%, rgba(15,23,42,0.06) 75%);
    background-size: 18px 18px;
    background-position: 0 0, 0 9px, 9px -9px, -9px 0px;
    min-height: 140px;
    display: grid;
    place-items: center;
    overflow: hidden;
}

.vtu-wm-preview img {
    display: block;
    max-width: 100%;
    max-height: 220px;
    object-fit: contain;
}

.vtu-fitfill-preview {
    margin-top: 0;
    min-width: 0;
    max-width: 100%;
}

.vtu-fitfill-row {
    display: grid;
    grid-template-columns: 170px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
    max-width: 100%;
}

.vtu-fitfill-left {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    align-items: flex-start;
}

.vtu-fitfill-card {
    border: 1px solid hsl(var(--border));
    border-radius: 14px;
    padding: 10px;
    background: #fff;
    width: 100%;
    max-width: 100%;
}

.vtu-fitfill-preview {
    justify-self: start;
    width: min(420px, 100%);
}

.vtu-fitfill-frame {
    border: 1px solid hsl(var(--border));
    border-radius: calc(var(--radius) - 0.15rem);
    background: hsl(var(--secondary));
    aspect-ratio: var(--vtu-ar, 16 / 9);
    display: grid;
    place-items: center;
    overflow: hidden;
    position: relative;
}

.vtu-fitfill-media {
    position: absolute;
    inset: 14px;
    border-radius: calc(var(--radius) - 0.15rem);
    background: linear-gradient(135deg, hsl(var(--primary) / 0.16), hsl(var(--accent) / 0.10));
    box-shadow: inset 0 1px 0 hsl(0 0% 100% / 0.6);
}

.vtu-fitfill-dims {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    padding: 6px 12px;
    border-radius: 999px;
    background: hsl(var(--card));
    color: hsl(var(--primary));
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: 0 2px 10px hsl(220 30% 20% / 0.12);
}

@media (max-width: 860px) {
    .vtu-fitfill-row {
        grid-template-columns: 1fr;
    }
}

/* Fit vs Fill illustration:
   - Fit: inset rectangle (shows "bars")
   - Fill: oversized rectangle that overflows (implies crop) */
.vtu-fitfill-preview[data-mode="fit"] .vtu-fitfill-media {
    inset: 18px;
}

.vtu-fitfill-preview[data-mode="fill"] .vtu-fitfill-media {
    inset: -10px;
}

.vtu-fitfill-cap {
    margin-top: 8px;
    color: hsl(var(--muted-foreground));
    font-size: 0.9rem;
    font-weight: 800;
}

.vtu-btn-ghost {
    background: rgba(37, 99, 235, 0.08);
    border-color: rgba(37, 99, 235, 0.25);
    color: #1e3a8a;
}

/* Clear button: subtle pink “danger” but still classy */
.vtu-btn-clear {
    background: rgba(244, 63, 94, 0.08);
    border-color: rgba(244, 63, 94, 0.25);
    color: #9f1239;
}

.vtu-btn-clear:hover {
    background: rgba(244, 63, 94, 0.12);
    border-color: rgba(244, 63, 94, 0.35);
    filter: none;
}

.vtu-btn-clear .vtu-icon {
    margin-right: 8px;
    color: #e11d48;
}

.vtu-link {
    display: inline-block;
    text-align: center;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--vtu-border);
    background: #fff;
    color: var(--vtu-primary);
    text-decoration: none;
    font-weight: 800;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.vtu-link-success {
    border-color: rgba(22, 163, 74, 0.35);
    color: #ffffff;
    background: linear-gradient(180deg, #22c55e, #16a34a);
    box-shadow: 0 10px 20px rgba(22, 163, 74, 0.22);
}

.vtu-link-success:hover {
    filter: brightness(1.02);
}

.vtu-link:hover {
    text-decoration: underline;
}

.vtu-seg-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

/* Parts table-like list */
.vtu-parts-head,
.vtu-parts-row {
    display: grid;
    grid-template-columns: 70px 1fr 1fr 1fr 120px 110px;
    gap: 10px;
    align-items: center;
}

.vtu-parts-head {
    padding: 10px 10px;
    border: 1px solid var(--vtu-border);
    border-radius: 12px;
    background: #fff;
    font-weight: 900;
    color: var(--vtu-muted);
}

.vtu-parts-row {
    padding: 10px 10px;
    border: 1px solid var(--vtu-border);
    border-radius: 12px;
    background: #fff;
}

.vtu-parts-row .vtu-cell-strong {
    font-weight: 900;
}

.vtu-btn-blue {
    background: linear-gradient(180deg, var(--vtu-primary-2), var(--vtu-primary));
    color: #fff;
}

@media (max-width: 820px) {
    .vtu-parts-head {
        display: none;
    }
    .vtu-parts-row {
        grid-template-columns: 1fr 1fr;
        grid-auto-rows: auto;
        gap: 10px;
    }
    .vtu-parts-row .vtu-cell-actions {
        grid-column: 1 / -1;
        display: flex;
        gap: 10px;
        justify-content: stretch;
    }
    .vtu-parts-row .vtu-cell-actions .vtu-btn {
        flex: 1;
    }
}

.vtu-seg-row {
    display: grid;
    grid-template-columns: 52px 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 10px 10px;
    border: 1px solid var(--vtu-border);
    border-radius: 12px;
    background: #fff;
}

.vtu-seg-idx {
    font-weight: 900;
    color: var(--vtu-muted);
}

.vtu-seg-times {
    font-weight: 800;
    display: inline-flex;
    gap: 8px;
    align-items: center;
}

.vtu-seg-arrow {
    color: var(--vtu-muted);
}

.vtu-seg-empty {
    padding: 10px 10px;
    border: 1px dashed var(--vtu-border);
    border-radius: 12px;
    color: var(--vtu-muted);
    background: #fff;
}

@media (max-width: 820px) {
    #vtu-container {
        padding: 16px;
        border-radius: 14px;
    }
    .vtu-grid,
    .vtu-grid-2,
    .vtu-grid-3 {
        grid-template-columns: 1fr;
    }
    .vtu-seg-row {
        grid-template-columns: 44px 1fr;
    }
    .vtu-seg-row .vtu-seg-del {
        grid-column: 1 / -1;
        justify-self: stretch;
    }
}

/* Merge list actions */
.vtu-merge-actions {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
}

.vtu-icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid var(--vtu-border);
    background: #fff;
    cursor: pointer;
    font-weight: 900;
    color: var(--vtu-text);
}

.vtu-icon-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
