/* ============================================================================
   BARBAROS — studio.css (premium batch 2, STUDIO owner)
   Theme gallery (#panel-themes) + Studio (#panel-design): sidebar, live preview, device frames.
   Tokens only; the few !important fight legacy panel/card wildcards (collision list in premium.css).
   ============================================================================ */

/* ---------------------------------------------------------------- gallery */
html[data-buld-theme] .st-gal-head { align-items: flex-start; }
html[data-buld-theme] .st-gal-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 18px; }
html[data-buld-theme] .st-gal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
html[data-buld-theme] .st-theme { padding: 0; overflow: hidden; display: flex; flex-direction: column; transition: transform var(--bx-dur-hover) var(--bx-ease), box-shadow var(--bx-dur-hover) var(--bx-ease), border-color var(--bx-dur-hover) var(--bx-ease); cursor: pointer; }
html[data-buld-theme] .st-theme:hover { transform: translateY(-2px); box-shadow: var(--bx-shadow-2); }
html[data-buld-theme] .st-theme.is-active { border-color: var(--buld-cta); box-shadow: 0 0 0 3px var(--buld-cta-soft); }
html[data-buld-theme] .st-theme__shot { position: relative; aspect-ratio: 16 / 10; background: var(--buld-elevated); overflow: hidden; }
html[data-buld-theme] .st-theme__shot img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; transition: transform 600ms var(--bx-ease); }
html[data-buld-theme] .st-theme:hover .st-theme__shot img { transform: scale(1.03); }
html[data-buld-theme] .st-theme__overlay {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 8px;
    background: var(--bx-scrim); opacity: 0; transition: opacity var(--bx-dur-overlay) var(--bx-ease);
}
html[data-buld-theme] .st-theme:hover .st-theme__overlay, html[data-buld-theme] .st-theme:focus-within .st-theme__overlay { opacity: 1; }
html[data-buld-theme] .st-theme__badge, html[data-buld-theme] .st-theme__price {
    position: absolute; top: 12px; display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px; border-radius: 999px;
    font-size: 11.5px; font-weight: 600; background: var(--p-card-bg); color: var(--buld-ink-1); box-shadow: var(--bx-shadow-1);
}
html[data-buld-theme] .st-theme__badge { inset-inline-start: 12px; color: var(--buld-success); }
html[data-buld-theme] .st-theme__badge svg { width: 12px; height: 12px; }
html[data-buld-theme] .st-theme__price { inset-inline-end: 12px; color: var(--buld-ink-2); }
html[data-buld-theme] .st-theme__meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; }
html[data-buld-theme] .st-theme__meta div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
html[data-buld-theme] .st-theme__meta strong { font-size: 14px; font-weight: 600; color: var(--buld-ink-1); }
html[data-buld-theme] .st-theme__meta span { font-size: 12px; color: var(--buld-ink-3); }
html[data-buld-theme] .st-theme__state { font-size: 12px; font-weight: 600; color: var(--buld-success); }

/* ---------------------------------------------------------------- preview modal / picker */
html[data-buld-theme] .st-preview-modal { height: min(78vh, 820px); }
html[data-buld-theme] .st-preview-modal .st-device { height: 100%; }
html[data-buld-theme] .st-picker__grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
html[data-buld-theme] .st-picker__item {
    position: relative; display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: 12px; border: 1px solid var(--buld-hairline);
    background: var(--p-card-bg); font-family: inherit; text-align: start; cursor: pointer; transition: border-color var(--bx-dur-hover) var(--bx-ease), transform var(--bx-dur-hover) var(--bx-ease);
}
html[data-buld-theme] .st-picker__item:hover { transform: translateY(-1px); border-color: var(--buld-divider); }
html[data-buld-theme] .st-picker__item.is-active { border-color: var(--buld-cta); box-shadow: 0 0 0 3px var(--buld-cta-soft); }
html[data-buld-theme] .st-picker__item img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; border-radius: 8px; background: var(--buld-elevated); }
html[data-buld-theme] .st-picker__item strong { font-size: 13px; color: var(--buld-ink-1); }
html[data-buld-theme] .st-picker__item span { font-size: 11.5px; color: var(--buld-ink-3); }
html[data-buld-theme] .st-picker__item em { position: absolute; top: 14px; inset-inline-start: 14px; font-style: normal; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--p-card-bg); color: var(--buld-success); }

/* ---------------------------------------------------------------- studio shell */
html[data-buld-theme] #panel-design { padding-bottom: 0; }
html[data-buld-theme] .st { display: flex; flex-direction: column; height: calc(100vh - 64px - 36px); min-height: 640px; margin: -8px 0 0; }
html[data-buld-theme] .st-bar {
    display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
    height: 52px; padding: 0 4px 0 0; border-bottom: 1px solid var(--buld-hairline); margin-bottom: 14px;
}
html[data-buld-theme] .st-bar__left, html[data-buld-theme] .st-bar__right { display: flex; align-items: center; gap: 10px; min-width: 0; }
html[data-buld-theme] .st-bar__right { justify-content: flex-end; }
html[data-buld-theme] .st-bar__store { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--buld-ink-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html[data-buld-theme] .st-bar__store svg { width: 15px; height: 15px; color: var(--buld-ink-3); }
html[data-buld-theme] .st-bar__theme {
    display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 8px 0 10px; border-radius: 999px; border: 1px solid var(--buld-hairline);
    background: var(--p-card-bg); color: var(--buld-ink-1); font-family: inherit; font-size: 12.5px; font-weight: 500; cursor: pointer;
}
html[data-buld-theme] .st-bar__theme:hover { border-color: var(--buld-divider); }
html[data-buld-theme] .st-bar__theme svg { width: 13px; height: 13px; color: var(--buld-ink-3); }
html[data-buld-theme] .st-bar__state { font-size: 12px; color: var(--buld-ink-3); white-space: nowrap; }
html[data-buld-theme] .st-seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--buld-elevated); }
html[data-buld-theme] .st-seg button { width: 36px; height: 28px; border-radius: 999px; border: 0; background: transparent; color: var(--buld-ink-3); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: background var(--bx-dur-hover) var(--bx-ease), color var(--bx-dur-hover) var(--bx-ease); }
html[data-buld-theme] .st-seg button svg { width: 15px; height: 15px; }
html[data-buld-theme] .st-seg button[aria-checked="true"] { background: var(--p-card-bg); color: var(--buld-ink-1); box-shadow: var(--bx-shadow-1); }
html[data-buld-theme] .st-body { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 16px; flex: 1; min-height: 0; }
html[data-buld-theme] .st-side { display: flex; flex-direction: column; min-height: 0; border-radius: var(--p-card-radius); border: 1px solid var(--p-card-border); background: var(--p-card-bg); overflow: hidden; }
html[data-buld-theme] .st-tabs { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--buld-hairline); }
html[data-buld-theme] .st-tabs button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px 8px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--buld-ink-3); font-family: inherit; font-size: 11.5px; font-weight: 500; cursor: pointer; transition: color var(--bx-dur-hover) var(--bx-ease), border-color var(--bx-dur-hover) var(--bx-ease); }
html[data-buld-theme] .st-tabs button svg { width: 16px; height: 16px; }
html[data-buld-theme] .st-tabs button:hover { color: var(--buld-ink-1); }
html[data-buld-theme] .st-tabs button[aria-selected="true"] { color: var(--buld-cta); border-bottom-color: var(--buld-cta); }
html[data-buld-theme] .st-pane { flex: 1; overflow: auto; padding: 14px 16px 24px; }
html[data-buld-theme] .st-sec { padding: 10px 0 16px; border-bottom: 1px solid var(--buld-hairline); }
html[data-buld-theme] .st-sec:last-child { border-bottom: 0; }
html[data-buld-theme] .st-h { margin: 0 0 10px; font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--buld-ink-3); }
html[data-buld-theme] .st-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
html[data-buld-theme] .st-field__label { font-size: 12.5px; font-weight: 600; color: var(--buld-ink-2); }
html[data-buld-theme] .st-field__hint { font-size: 11.5px; color: var(--buld-ink-3); }
html[data-buld-theme] .st-input, html[data-buld-theme] body .st-pane input.st-input, html[data-buld-theme] body .st-pane textarea.st-input {
    width: 100%; height: 36px; padding: 0 12px; border-radius: 10px !important; border: 1px solid var(--buld-divider) !important;
    background: var(--p-card-bg) !important; color: var(--buld-ink-1) !important; font-family: inherit; font-size: 13.5px !important; box-shadow: none !important;
}
html[data-buld-theme] body .st-pane textarea.st-input { height: auto; min-height: 76px; padding: 9px 12px; resize: vertical; }
html[data-buld-theme] .st-input:focus { outline: none; border-color: var(--buld-cta) !important; box-shadow: 0 0 0 3px var(--buld-cta-soft) !important; }
/* logo */
html[data-buld-theme] .st-logo { display: flex; flex-direction: column; gap: 8px; }
html[data-buld-theme] .st-logo__drop {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 96px; padding: 12px; border-radius: 12px;
    border: 1.5px dashed var(--buld-divider); background: var(--buld-elevated); color: var(--buld-ink-3); font-size: 12px; text-align: center; cursor: pointer;
    transition: border-color var(--bx-dur-hover) var(--bx-ease), background var(--bx-dur-hover) var(--bx-ease);
}
html[data-buld-theme="light"] .st-logo__drop { background: var(--buld-page); }
html[data-buld-theme] .st-logo__drop:hover, html[data-buld-theme] .st-logo__drop.is-over { border-color: var(--buld-cta); background: var(--buld-cta-soft); }
html[data-buld-theme] .st-logo__drop svg { width: 20px; height: 20px; }
html[data-buld-theme] .st-logo__drop img { max-height: 64px; max-width: 100%; object-fit: contain; }
/* colours */
html[data-buld-theme] .st-presets { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
html[data-buld-theme] .st-preset { display: inline-flex; gap: 0; padding: 0; border: 2px solid transparent; border-radius: 999px; background: transparent; cursor: pointer; overflow: hidden; transition: border-color var(--bx-dur-hover) var(--bx-ease), transform var(--bx-dur-hover) var(--bx-ease); }
html[data-buld-theme] .st-preset span { width: 18px; height: 28px; background: var(--c); display: block; }
html[data-buld-theme] .st-preset:hover { transform: scale(1.06); }
html[data-buld-theme] .st-preset.is-active { border-color: var(--buld-cta); }
html[data-buld-theme] .st-colors { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
html[data-buld-theme] .st-color { display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 999px; border: 1px solid var(--buld-hairline); font-size: 12.5px; color: var(--buld-ink-2); cursor: pointer; }
html[data-buld-theme] .st-color input[type="color"] { width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%; background: transparent; cursor: pointer; }
html[data-buld-theme] .st-color input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
html[data-buld-theme] .st-color input[type="color"]::-webkit-color-swatch { border: 1px solid var(--buld-hairline); border-radius: 50%; }
html[data-buld-theme] .st-color code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11px; color: var(--buld-ink-3); }
/* fonts */
html[data-buld-theme] .st-fonts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
html[data-buld-theme] .st-font { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--buld-hairline); background: var(--p-card-bg); font-family: inherit; text-align: start; cursor: pointer; transition: border-color var(--bx-dur-hover) var(--bx-ease); }
html[data-buld-theme] .st-font:hover { border-color: var(--buld-divider); }
html[data-buld-theme] .st-font.is-active { border-color: var(--buld-cta); box-shadow: 0 0 0 3px var(--buld-cta-soft); }
html[data-buld-theme] .st-font strong { font-size: 22px; line-height: 1; color: var(--buld-ink-1); }
html[data-buld-theme] .st-font span { font-size: 12.5px; font-weight: 600; color: var(--buld-ink-1); margin-top: 4px; }
html[data-buld-theme] .st-font small { font-size: 11px; color: var(--buld-ink-3); }
/* radius */
html[data-buld-theme] .st-range { display: flex; align-items: center; gap: 10px; }
html[data-buld-theme] .st-range input[type="range"] { flex: 1; accent-color: var(--buld-cta); }
html[data-buld-theme] .st-range output { min-width: 44px; font-size: 12.5px; font-weight: 600; color: var(--buld-ink-1); font-variant-numeric: tabular-nums; }
/* sections */
html[data-buld-theme] .st-sections { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
html[data-buld-theme] .st-section { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--buld-hairline); background: var(--p-card-bg); font-size: 13px; color: var(--buld-ink-1); transition: opacity var(--bx-dur-hover) var(--bx-ease); }
html[data-buld-theme] .st-section.is-off { opacity: .55; }
html[data-buld-theme] .st-section__grip { color: var(--buld-ink-4); display: inline-flex; }
html[data-buld-theme] .st-section__grip svg { width: 14px; height: 14px; }
html[data-buld-theme] .st-section__label { flex: 1; min-width: 0; }
html[data-buld-theme] .st-section__fixed { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--buld-ink-4); }
html[data-buld-theme] .st-section__move { display: inline-flex; gap: 2px; }
html[data-buld-theme] .st-section__move button { width: 24px; height: 24px; border-radius: 6px; border: 0; background: transparent; color: var(--buld-ink-3); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
html[data-buld-theme] .st-section__move button:hover:not(:disabled) { background: var(--buld-hover); color: var(--buld-ink-1); }
html[data-buld-theme] .st-section__move button:disabled { opacity: .3; cursor: default; }
html[data-buld-theme] .st-section__move svg { width: 14px; height: 14px; }
html[data-buld-theme] .p-switch { position: relative; display: inline-block; width: 34px; height: 20px; flex-shrink: 0; }
html[data-buld-theme] .p-switch input { position: absolute; width: 1px; height: 1px; opacity: 0; margin: 0; }
html[data-buld-theme] .p-switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--buld-divider); transition: background var(--bx-dur-hover) var(--bx-ease); cursor: pointer; }
html[data-buld-theme] .p-switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--bx-shadow-1); transition: transform var(--bx-dur-hover) var(--bx-ease); }
html[data-buld-theme] .p-switch input:checked + span { background: var(--buld-cta); }
html[data-buld-theme] .p-switch input:checked + span::after { transform: translateX(14px); }
html[data-buld-theme] .p-switch input:focus-visible + span { box-shadow: 0 0 0 3px var(--buld-cta-soft); }

/* ---------------------------------------------------------------- stage + device frames */
html[data-buld-theme] .st-stage { position: relative; min-height: 0; border-radius: var(--p-card-radius); background: var(--buld-elevated); border: 1px solid var(--p-card-border); display: flex; align-items: flex-start; justify-content: center; padding: 16px; overflow: auto; }
html[data-buld-theme="light"] .st-stage { background: var(--buld-page); }
html[data-buld-theme] .st-device { position: relative; width: 100%; height: 100%; min-height: 560px; border-radius: 12px; overflow: hidden; background: #fff; box-shadow: var(--bx-shadow-2); transition: width var(--bx-dur-layout) var(--bx-ease); }
html[data-buld-theme] .st-device iframe { width: 100%; height: 100%; border: 0; display: block; background: #fff; }
html[data-buld-theme] .st-device--tablet { width: 820px; max-width: 100%; border-radius: 22px; border: 10px solid var(--buld-ink-1); }
html[data-buld-theme] .st-device--mobile { width: 400px; max-width: 100%; border-radius: 34px; border: 12px solid var(--buld-ink-1); }
html[data-buld-theme] .st-frame-loading { position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center; gap: 10px; background: var(--p-card-bg); color: var(--buld-ink-3); font-size: 13px; }
html[data-buld-theme] .st-frame-loading[hidden] { display: none; }
html[data-buld-theme] .st-empty { padding: 48px 24px; }

@media (max-width: 1100px) {
    html[data-buld-theme] .st-body { grid-template-columns: 1fr; }
    html[data-buld-theme] .st-side { max-height: 46vh; }
    html[data-buld-theme] .st { height: auto; }
    html[data-buld-theme] .st-stage { min-height: 560px; }
}
/* legacy wildcard rules box every span inside a *-section element — the row label is plain text */
html[data-buld-theme] body .st-section__label, html[data-buld-theme] body .st-section__fixed { background: transparent !important; border: 0 !important; padding: 0 !important; box-shadow: none !important; border-radius: 0 !important; }
html[data-buld-theme] body .st-section { background: var(--p-card-bg) !important; }
