/* ============================================================================
   BARBAROS — apps-premium.css (premium batch 3): the Applications panel + its sheet.
   Tokens only; !important only against the legacy .apps-* / .pix-* hex rules in orders.css.
   ============================================================================ */

/* ---------------------------------------------------------------- toolbar */
html[data-buld-theme] #panel-applications .apps-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 22px; padding: 0; background: transparent; border: 0; box-shadow: none; }
html[data-buld-theme] #panel-applications .apps-search.p-search { width: 300px; margin: 0; }
html[data-buld-theme] #panel-applications .apps-search.p-search input { border: 0 !important; background: transparent !important; box-shadow: none !important; height: 100% !important; padding: 0 !important; font-size: 13px !important; color: var(--buld-ink-1) !important; }
html[data-buld-theme] #panel-applications .apps-tabs { display: flex; gap: 8px; margin: 0; padding: 0; background: transparent; border: 0; }
html[data-buld-theme] #panel-applications .apps-tab { height: 28px; padding: 0 12px; border-radius: 999px !important; border: 1px solid var(--buld-hairline) !important; background: transparent !important; color: var(--buld-ink-2) !important; font-family: inherit; font-size: 12.5px; font-weight: 500; cursor: pointer; box-shadow: none !important; }
html[data-buld-theme] #panel-applications .apps-tab.active, html[data-buld-theme] #panel-applications .apps-tab.is-active { background: var(--buld-cta-soft) !important; border-color: var(--buld-cta) !important; color: var(--buld-ink-1) !important; }
html[data-buld-theme] #panel-applications #appsLogoStudio, html[data-buld-theme] #panel-applications #appsLogoStudioBtn { display: none !important; }

/* ---------------------------------------------------------------- groups + cards */
html[data-buld-theme] #appsGrid { display: block; }
html[data-buld-theme] .apx-group { margin: 0 0 30px; }
html[data-buld-theme] .apx-group__head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 0 0 12px; }
html[data-buld-theme] .apx-group__head h2 { margin: 0; font-size: 15px; font-weight: 600; color: var(--buld-ink-1); display: inline-flex; align-items: center; gap: 8px; }
html[data-buld-theme] .apx-group__head h2 span { font-size: 11px; font-weight: 600; color: var(--buld-ink-3); background: var(--buld-elevated); padding: 2px 7px; border-radius: 999px; }
html[data-buld-theme] .apx-group__head p { margin: 0; font-size: 13px; color: var(--buld-ink-3); }
html[data-buld-theme] .apx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
html[data-buld-theme] .apx-app { display: flex; flex-direction: column; gap: 14px; padding: 16px; cursor: pointer; 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); }
html[data-buld-theme] .apx-app:hover { transform: translateY(-2px); box-shadow: var(--bx-shadow-2); border-color: var(--buld-divider); }
html[data-buld-theme] .apx-app.is-installed { border-color: color-mix(in srgb, var(--buld-success) 45%, var(--p-card-border)); }
html[data-buld-theme] .apx-app__top { display: flex; align-items: flex-start; gap: 14px; }
html[data-buld-theme] .apx-tile { width: 52px; height: 52px; flex-shrink: 0; border-radius: 14px; display: flex; align-items: center; justify-content: center; padding: 9px; background: var(--tile, var(--buld-elevated)); border: 1px solid var(--buld-hairline); overflow: hidden; }
html[data-buld-theme] .apx-tile svg, html[data-buld-theme] .apx-tile img { width: 100%; height: 100%; object-fit: contain; display: block; }
html[data-buld-theme] .apx-tile--meta { --tile: #ffffff; }
html[data-buld-theme] .apx-tile--google, html[data-buld-theme] .apx-tile--shopify, html[data-buld-theme] .apx-tile--woocommerce, html[data-buld-theme] .apx-tile--wix { --tile: #ffffff; }
html[data-buld-theme] .apx-app__text { min-width: 0; flex: 1; }
html[data-buld-theme] .apx-app__name { font-size: 14.5px; font-weight: 600; color: var(--buld-ink-1); display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
html[data-buld-theme] .apx-app__vendor { font-size: 11.5px; font-weight: 500; color: var(--buld-ink-4); }
html[data-buld-theme] .apx-app__tag { margin: 4px 0 0; font-size: 12.5px; line-height: 1.45; color: var(--buld-ink-3); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
html[data-buld-theme] .apx-app__foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 12px; border-top: 1px solid var(--buld-hairline); }
html[data-buld-theme] .apx-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; color: var(--buld-ink-3); white-space: nowrap; }
html[data-buld-theme] .apx-status__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--buld-ink-4); }
html[data-buld-theme] .apx-status.is-on { color: var(--buld-success); }
html[data-buld-theme] .apx-status.is-on .apx-status__dot { background: var(--buld-success); box-shadow: 0 0 0 3px var(--bx-success-soft); }
html[data-buld-theme] .apx-app__actions { display: flex; gap: 6px; }
html[data-buld-theme] .apx-app__actions .bx-btn svg { width: 14px; height: 14px; }
html[data-buld-theme] .apx-empty { margin: 20px 0; }

/* ---------------------------------------------------------------- the sheet (legacy drawer re-skinned) */
html[data-buld-theme] .apps-drawer-overlay { background: var(--bx-scrim) !important; z-index: 10005 !important; animation: apxFade var(--bx-dur-overlay) var(--bx-ease) both; }
@keyframes apxFade { from { opacity: 0; } to { opacity: 1; } }
html[data-buld-theme] .apps-drawer { width: min(560px, 100vw) !important; background: var(--p-card-bg) !important; border-inline-start: 1px solid var(--p-card-border); box-shadow: var(--bx-shadow-3) !important; animation: apxSlide var(--bx-dur-layout) var(--bx-ease) both !important; color: var(--buld-ink-1); }
@keyframes apxSlide { from { transform: translateX(32px); opacity: 0; } to { transform: none; opacity: 1; } }
html[data-buld-theme] .apps-drawer-header { padding: 18px 20px 14px !important; border-bottom: 1px solid var(--buld-hairline) !important; background: transparent !important; }
html[data-buld-theme] .apps-drawer-brand .apps-drawer-icon { width: 48px !important; height: 48px !important; border-radius: 14px !important; padding: 9px !important; border: 1px solid var(--buld-hairline); }
html[data-buld-theme] .apps-drawer-title { font-size: 16px !important; font-weight: 600 !important; color: var(--buld-ink-1) !important; font-family: inherit !important; }
html[data-buld-theme] .apps-drawer-sub { font-size: 12.5px !important; color: var(--buld-ink-3) !important; font-family: inherit !important; }
html[data-buld-theme] .apps-drawer-close { width: 32px; height: 32px; border-radius: 10px !important; font-size: 22px !important; color: var(--buld-ink-3) !important; display: inline-flex; align-items: center; justify-content: center; padding: 0 !important; background: transparent !important; }
html[data-buld-theme] .apps-drawer-close:hover { background: var(--buld-hover) !important; color: var(--buld-ink-1) !important; }
html[data-buld-theme] .apps-drawer-body { padding: 18px 20px 24px !important; background: transparent !important; }
html[data-buld-theme] .apps-drawer-footer { padding: 14px 20px !important; border-top: 1px solid var(--buld-hairline) !important; background: var(--p-card-bg) !important; }
html[data-buld-theme] .apps-drawer-footer .bx-btn, html[data-buld-theme] .apps-drawer-body .bx-btn { font-family: inherit; }

html[data-buld-theme] .apx-sec { margin: 0 0 22px !important; padding: 0; }
html[data-buld-theme] .apx-sec > h4 { display: flex; align-items: center; gap: 7px; margin: 0 0 10px !important; font-family: inherit !important; font-size: 11px !important; font-weight: 600 !important; letter-spacing: .05em; text-transform: uppercase; color: var(--buld-ink-3) !important; }
html[data-buld-theme] .apx-sec > h4 svg { width: 13px; height: 13px; }
html[data-buld-theme] .apx-lead { font-family: inherit !important; font-size: 13.5px !important; line-height: 1.5; color: var(--buld-ink-2) !important; margin: 0 0 10px !important; }
html[data-buld-theme] .apps-caps { margin: 0 0 10px !important; padding: 0 !important; list-style: none; display: flex; flex-direction: column; gap: 5px; font-family: inherit !important; font-size: 13px !important; color: var(--buld-ink-2) !important; }
html[data-buld-theme] .apps-caps li { position: relative; padding-inline-start: 20px; }
html[data-buld-theme] .apps-caps li::before { content: ""; position: absolute; inset-inline-start: 0; top: 6px; width: 10px; height: 5px; border: solid var(--buld-success); border-width: 0 0 2px 2px; transform: rotate(-45deg); }
html[data-buld-theme] .apps-link { display: inline-flex; align-items: center; gap: 5px; font-family: inherit !important; font-size: 13px !important; font-weight: 500 !important; color: var(--buld-cta) !important; }
html[data-buld-theme] .apps-link svg { width: 13px; height: 13px; }

/* fields */
html[data-buld-theme] .apps-field { margin: 0 0 14px !important; }
html[data-buld-theme] .apps-field label, html[data-buld-theme] .pix-field label { display: block; margin: 0 0 6px !important; font-family: inherit !important; font-size: 12.5px !important; font-weight: 600 !important; color: var(--buld-ink-2) !important; }
html[data-buld-theme] .apx-req { color: var(--buld-danger); margin-inline-start: 2px; }
html[data-buld-theme] .apps-drawer-body input[type="text"], html[data-buld-theme] .apps-drawer-body input[type="password"], html[data-buld-theme] .apps-drawer-body input[type="url"] {
    width: 100%; height: 38px; padding: 0 12px !important; 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 !important; font-size: 13.5px !important; box-shadow: none !important; box-sizing: border-box;
    transition: border-color var(--bx-dur-hover) var(--bx-ease), box-shadow var(--bx-dur-hover) var(--bx-ease);
}
html[data-buld-theme] .apps-drawer-body input:focus { outline: none !important; border-color: var(--buld-cta) !important; box-shadow: 0 0 0 3px var(--buld-cta-soft) !important; }
html[data-buld-theme] .apps-drawer-body input.pix-mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace !important; letter-spacing: .02em; }
html[data-buld-theme] .apps-drawer-body input.is-valid { border-color: var(--buld-success) !important; }
html[data-buld-theme] .apps-drawer-body input.is-invalid { border-color: var(--buld-danger) !important; }
html[data-buld-theme] .apx-validate { font-size: 11.5px; color: var(--buld-success); margin-top: 5px; min-height: 14px; }
html[data-buld-theme] .apx-validate.is-bad { color: var(--buld-danger); }
html[data-buld-theme] .apps-help { font-family: inherit !important; font-size: 12px !important; color: var(--buld-ink-3) !important; margin-top: 5px !important; }
html[data-buld-theme] .apps-help code { background: var(--buld-elevated); color: var(--buld-ink-2); padding: 1px 5px; border-radius: 5px; font-size: 11px; }

/* pixel manager */
html[data-buld-theme] .pix-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
html[data-buld-theme] .pix-head h4 { margin: 0 !important; display: inline-flex; align-items: center; gap: 8px; }
html[data-buld-theme] .pix-count { font-size: 11px; font-weight: 600; color: var(--buld-ink-3); background: var(--buld-elevated); padding: 2px 7px; border-radius: 999px; }
html[data-buld-theme] .pix-list { display: flex; flex-direction: column; gap: 12px; }
html[data-buld-theme] .apx-pix { background: var(--p-card-bg) !important; border: 1px solid var(--p-card-border) !important; border-radius: 12px !important; box-shadow: none !important; overflow: hidden; transition: border-color var(--bx-dur-hover) var(--bx-ease); animation: apxCardIn var(--bx-dur-layout) var(--bx-ease) both; }
@keyframes apxCardIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
html[data-buld-theme] .apx-pix.is-off { opacity: .72; }
html[data-buld-theme] .apx-pix-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px !important; border-bottom: 1px solid var(--buld-hairline) !important; background: var(--buld-elevated) !important; }
html[data-buld-theme="light"] .apx-pix-head { background: var(--buld-page) !important; }
html[data-buld-theme] .apx-pix-name { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
html[data-buld-theme] .apps-drawer-body .pix-name-input { height: 30px; border: 1px solid transparent !important; background: transparent !important; font-weight: 600 !important; padding: 0 8px !important; border-radius: 8px !important; max-width: 220px; }
html[data-buld-theme] .apps-drawer-body .pix-name-input:hover { border-color: var(--buld-divider) !important; }
html[data-buld-theme] .pix-status-pill { height: 22px; padding: 0 8px; font-size: 11px !important; font-weight: 600 !important; border-radius: 999px !important; background: var(--buld-elevated) !important; color: var(--buld-ink-3) !important; border: 0 !important; display: inline-flex; align-items: center; }
html[data-buld-theme] .pix-status-pill.on { background: var(--bx-success-soft) !important; color: var(--buld-success) !important; }
html[data-buld-theme] .apx-pix-actions { display: flex; align-items: center; gap: 8px; }
html[data-buld-theme] .pix-created-mini { font-size: 11px !important; color: var(--buld-ink-4) !important; white-space: nowrap; }
html[data-buld-theme] .pix-toggle { position: relative; width: 34px; height: 20px; display: inline-block; }
html[data-buld-theme] .pix-toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
html[data-buld-theme] .pix-toggle-track { position: absolute; inset: 0; border-radius: 999px; background: var(--buld-divider) !important; transition: background var(--bx-dur-hover) var(--bx-ease); cursor: pointer; }
html[data-buld-theme] .pix-toggle-thumb { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff !important; box-shadow: var(--bx-shadow-1); transition: transform var(--bx-dur-hover) var(--bx-ease); }
html[data-buld-theme] .pix-toggle input:checked + .pix-toggle-track { background: var(--buld-cta) !important; }
html[data-buld-theme] .pix-toggle input:checked + .pix-toggle-track .pix-toggle-thumb { transform: translateX(14px); }
html[data-buld-theme] .pix-del { width: 28px; height: 28px; border-radius: 8px !important; border: 0 !important; background: transparent !important; color: var(--buld-ink-3) !important; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
html[data-buld-theme] .pix-del:hover { background: var(--bx-danger-soft) !important; color: var(--buld-danger) !important; }
html[data-buld-theme] .apx-pix-body { padding: 12px !important; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
html[data-buld-theme] .pix-field { margin: 0 !important; }
html[data-buld-theme] .apx-pix-body .pix-field:only-child, html[data-buld-theme] .apx-pix-body .pix-field:first-child:nth-last-child(3) { grid-column: 1 / -1; }
html[data-buld-theme] .pix-empty-state { padding: 26px 14px; border: 1px dashed var(--buld-divider); border-radius: 12px; text-align: center; color: var(--buld-ink-3); font-size: 13px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
html[data-buld-theme] .pix-empty-state p { margin: 0; }
html[data-buld-theme] .pix-empty-state svg { color: var(--buld-ink-4) !important; }

/* store connect */
html[data-buld-theme] .apps-store-mode-badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; background: var(--buld-cta-soft) !important; color: var(--buld-cta) !important; font-size: 11.5px !important; font-weight: 600; margin: 0 0 12px; border: 0 !important; }
html[data-buld-theme] .apps-store-steps { list-style: none; margin: 0 0 14px !important; padding: 0 !important; display: flex; flex-direction: column; gap: 8px; counter-reset: none; }
html[data-buld-theme] .apps-store-steps li { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; line-height: 1.45; color: var(--buld-ink-2) !important; font-family: inherit !important; }
html[data-buld-theme] .apps-store-step-num { width: 22px; height: 22px; flex-shrink: 0; border-radius: 50%; background: var(--buld-elevated) !important; color: var(--buld-ink-2) !important; font-size: 11px !important; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; border: 0 !important; }
html[data-buld-theme] .apps-store-scopes { font-size: 12px !important; color: var(--buld-ink-3) !important; margin: 10px 0 0; line-height: 1.8; }
html[data-buld-theme] .apps-store-scopes code { background: var(--buld-elevated); color: var(--buld-ink-2); padding: 1px 6px; border-radius: 5px; font-size: 11px; }
html[data-buld-theme] .apps-store-list { display: flex; flex-direction: column; gap: 8px; }
html[data-buld-theme] .apps-store-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--p-card-border) !important; background: var(--p-card-bg) !important; }
html[data-buld-theme] .apps-store-item-name { font-size: 13.5px !important; font-weight: 600; color: var(--buld-ink-1) !important; }
html[data-buld-theme] .apps-store-item-url { font-size: 12px !important; color: var(--buld-ink-3) !important; }
html[data-buld-theme] .apps-store-item-meta { font-size: 11.5px !important; color: var(--buld-ink-4) !important; display: inline-flex; align-items: center; gap: 4px; margin-top: 2px; }
html[data-buld-theme] .apps-store-item-actions { display: flex; gap: 6px; }
html[data-buld-theme] .apps-store-item-actions .bx-btn { width: 32px; padding: 0; justify-content: center; }
html[data-buld-theme] .apps-store-count { font-size: 11px; font-weight: 600; color: var(--buld-ink-3); background: var(--buld-elevated); padding: 2px 7px; border-radius: 999px; }
html[data-buld-theme] .apps-store-progress-list { display: flex; flex-direction: column; gap: 0; border: 1px solid var(--p-card-border); border-radius: 12px; overflow: hidden; }
html[data-buld-theme] .apps-store-progress-step { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--buld-hairline); background: var(--p-card-bg) !important; }
html[data-buld-theme] .apps-store-progress-step:last-child { border-bottom: 0; }
html[data-buld-theme] .apps-store-progress-icon { width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; background: var(--buld-elevated) !important; color: var(--buld-ink-3) !important; }
html[data-buld-theme] .apps-store-progress-step.success .apps-store-progress-icon { background: var(--buld-success) !important; color: #fff !important; }
html[data-buld-theme] .apps-store-progress-step.error .apps-store-progress-icon { background: var(--buld-danger) !important; color: #fff !important; }
html[data-buld-theme] .apps-store-progress-step.loading .apps-store-progress-icon { background: var(--buld-cta-soft) !important; color: var(--buld-cta) !important; }
html[data-buld-theme] .apps-store-progress-icon svg { width: 13px; height: 13px; }
html[data-buld-theme] .apps-store-spinner { width: 14px; height: 14px; border: 2px solid var(--buld-cta-soft); border-top-color: var(--buld-cta); border-radius: 50%; animation: apxSpin .8s linear infinite; }
@keyframes apxSpin { to { transform: rotate(360deg); } }
html[data-buld-theme] .apps-store-progress-title { font-size: 13px !important; font-weight: 600; color: var(--buld-ink-1) !important; }
html[data-buld-theme] .apps-store-progress-detail { font-size: 12px !important; color: var(--buld-ink-3) !important; }
html[data-buld-theme] .apps-store-result { margin-top: 12px; padding: 10px 12px; border-radius: 10px; font-size: 13px; display: flex; align-items: flex-start; gap: 8px; line-height: 1.45; }
html[data-buld-theme] .apps-store-result.success { background: var(--bx-success-soft) !important; color: var(--buld-success) !important; border: 0 !important; }
html[data-buld-theme] .apps-store-result.error { background: var(--bx-danger-soft) !important; color: var(--buld-danger) !important; border: 0 !important; }
html[data-buld-theme] .apps-store-result svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 1px; }
html[data-buld-theme] .apps-test-ok { background: var(--bx-success-soft) !important; color: var(--buld-success) !important; border: 0 !important; border-radius: 10px !important; font-family: inherit !important; }
html[data-buld-theme] .apps-test-err { background: var(--bx-danger-soft) !important; color: var(--buld-danger) !important; border: 0 !important; border-radius: 10px !important; font-family: inherit !important; }
html[data-buld-theme] .connect-migration { margin-top: 12px; }

@media (prefers-reduced-motion: reduce) { html[data-buld-theme] .apps-drawer, html[data-buld-theme] .apps-drawer-overlay, html[data-buld-theme] .apx-pix { animation: none !important; } }
/* search field: the legacy absolute icon sits inside the pill now */
html[data-buld-theme] #panel-applications .apps-search.p-search { position: static; }
html[data-buld-theme] #panel-applications .apps-search.p-search > i, html[data-buld-theme] #panel-applications .apps-search.p-search > svg { position: static !important; transform: none !important; left: auto !important; top: auto !important; margin: 0; }
html[data-buld-theme] #panel-applications .apps-search.p-search input { padding-inline-start: 0 !important; }
