/* Import assets dialog (js/import-assets.js) — Projects → Import.
   Built on the shared components (.sl-modal, .sl-seg, .sl-check, .sl-switch,
   .sl-tag-thumb, .sl-progress); only layout and the tile live here.
   Above the home screen (9999), level with the notification tray. */
.pw-ia-scrim { z-index: 10000; padding: 16px; box-sizing: border-box; }
.pw-ia {
    width: min(980px, 100%); height: min(86vh, 780px); box-sizing: border-box;
    display: flex; flex-direction: column;
    font-family: var(--sl-font-ui); color: var(--sl-text-1);
    animation: pwIaIn 0.16s ease-out;
}
@keyframes pwIaIn { from { opacity: 0; transform: translateY(6px) scale(0.99); } to { opacity: 1; transform: none; } }
.pw-ia:focus { outline: none; }
.pw-ia button:focus-visible, .pw-ia select:focus-visible { outline: 2px solid var(--sl-focus); outline-offset: 2px; }
.pw-ia-flex { flex: 1; }
.pw-ia [hidden] { display: none; }

/* head */
.pw-ia-head {
    flex: none; display: flex; align-items: flex-start; gap: 12px;
    padding: 14px 12px 12px 18px; border-bottom: 1px solid var(--sl-hairline);
}
.pw-ia-titles { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.pw-ia-title { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.pw-ia-source { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 6px; min-width: 0; font-size: 12px; color: var(--sl-text-2); }
.pw-ia-source svg { flex: none; color: var(--sl-text-3); }
.pw-ia-file {
    font-family: var(--sl-font-mono); font-size: 11.5px; color: var(--sl-text-1);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46%;
}
.pw-ia-dot { color: var(--sl-text-3); }
.pw-ia-close { width: 28px; height: 28px; }

/* filters */
.pw-ia-toolbar {
    flex: none; display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
    padding: 12px 18px 10px;
}
.pw-ia-toolbar .sl-seg.is-disabled { pointer-events: none; opacity: 0.55; }
.pw-ia-toolbar .sl-seg-btn:disabled { opacity: 0.4; cursor: default; }
.pw-ia-toolbar .sl-seg-btn:disabled:hover { color: oklch(0.62 0.005 250); }
.pw-ia-sent {
    display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none;
    font-size: 12px; font-weight: 600; color: var(--sl-text-2);
}
.pw-ia-sent:hover { color: var(--sl-text-1); }

/* select-all row */
.pw-ia-selbar {
    flex: none; display: flex; align-items: center; gap: 10px; min-height: 34px;
    padding: 0 18px 8px; border-bottom: 1px solid var(--sl-hairline);
}
.pw-ia-seltext { font-size: 12px; color: var(--sl-text-2); font-variant-numeric: tabular-nums; }
.pw-ia-clear { height: 24px; font-size: 12px; }

/* checkbox: the shared one, plus a "some" state for groups */
.pw-ia .sl-check { padding: 0; }
.pw-ia .sl-check svg { width: 11px; height: 11px; }
.pw-ia .sl-check.is-mixed { background: var(--sl-accent); border-color: var(--sl-accent); }
.pw-ia .sl-check.is-mixed svg { display: none; }
.pw-ia .sl-check.is-mixed::after { content: ""; width: 8px; height: 2px; border-radius: 1px; background: var(--sl-on-accent); }
.pw-ia .sl-check:disabled { opacity: 0.45; cursor: default; }
.pw-ia .sl-check:not(.is-checked):not(.is-mixed):hover { border-color: oklch(1 0 0 / 0.32); }

/* body: workflows → nodes → tiles */
.pw-ia-body { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 18px 18px; overscroll-behavior: contain; }
.pw-ia-wf { padding-top: 14px; }
.pw-ia-wf-name { padding: 0 2px 8px; }
.pw-ia-node {
    background: var(--sl-card); border: 1px solid var(--sl-hairline); border-radius: var(--sl-r-12);
    padding: 0 12px 12px; margin-bottom: 10px;
}
.pw-ia-node-head {
    position: sticky; top: -4px; z-index: 2;
    display: flex; align-items: center; gap: 9px; min-height: 40px; margin: 0 -12px 2px; padding: 0 12px;
    background: var(--sl-card); border-radius: var(--sl-r-12) var(--sl-r-12) 0 0;
}
.pw-ia-node-title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.pw-ia-kind {
    flex: none; display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 7px;
    border-radius: var(--sl-r-6); background: oklch(1 0 0 / 0.07);
    font-size: 11px; font-weight: 600; color: var(--sl-text-2);
}
.pw-ia-kind svg { width: 12px; height: 12px; color: var(--sl-text-3); }
.pw-ia-node-sub { flex: none; font-size: 11.5px; color: var(--sl-text-3); }
.pw-ia-node-count { flex: none; font-family: var(--sl-font-mono); font-size: 10.5px; color: var(--sl-text-3); }

.pw-ia-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.pw-ia-tile {
    position: relative; display: block; width: 100%; aspect-ratio: 1; padding: 0; overflow: hidden;
    border: 1px solid var(--sl-hairline); border-radius: var(--sl-r-8); background: var(--sl-panel);
    cursor: pointer; box-sizing: border-box;
    transition: box-shadow 0.12s ease, opacity 0.12s ease;
}
.pw-ia-media, .pw-ia-media img, .pw-ia-media video { position: absolute; inset: 0; width: 100%; height: 100%; }
.pw-ia-media img, .pw-ia-media video { object-fit: cover; display: block; }
.pw-ia-media.is-audio {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
    padding: 10px; box-sizing: border-box; color: var(--sl-link);
}
.pw-ia-audio-name {
    max-width: 100%; font-size: 11px; color: var(--sl-text-2); text-align: center;
    overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
/* Selected reads from the tick and full brightness; unselected dims. No ring on
   every tile — with all selected (the default) that would be a wall of blue. */
.pw-ia-tile:not(.is-selected) .pw-ia-media { opacity: 0.4; }
.pw-ia-tile:hover { border-color: var(--sl-border-strong); }
.pw-ia-tile:hover .pw-ia-media { opacity: 1; }
.pw-ia-tile.is-selected { border-color: var(--sl-accent-line); }
.pw-ia-tile-check {
    position: absolute; top: 6px; left: 6px; z-index: 1;
    background: oklch(0 0 0 / 0.45); border-color: oklch(1 0 0 / 0.55);
}
.pw-ia-tile:not(.is-selected) .pw-ia-tile-check { opacity: 0.8; }
.pw-ia-tile-check.is-checked { background: var(--sl-accent); border-color: var(--sl-accent); }
.pw-ia-tile-tag { position: absolute; top: 6px; right: 6px; z-index: 1; height: 18px; font-size: 10px; }
.pw-ia-tile-meta {
    position: absolute; left: 6px; bottom: 6px; z-index: 1;
    display: inline-flex; align-items: center; gap: 4px; height: 18px; padding: 0 6px;
    border-radius: var(--sl-r-6); background: oklch(0 0 0 / 0.55);
    font-family: var(--sl-font-mono); font-size: 10px; color: #fff;
}
.pw-ia-tile-meta svg { width: 10px; height: 10px; }
.pw-ia-tile-pos { color: oklch(0.88 0.002 250); }
.pw-ia-tile-pos + svg { margin-left: 2px; }

/* Editor nodes: what they become, and the sequence strip. A sequence must not look
   like a pile of single clips: its clips sit edge to edge on track rows, in order. */
.pw-ia-result {
    flex: none; display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px;
    border-radius: var(--sl-r-6); font-size: 11.5px; font-weight: 600; white-space: nowrap;
    background: oklch(1 0 0 / 0.07); color: var(--sl-text-2);
}
.pw-ia-result svg { width: 12px; height: 12px; }
.pw-ia-result.is-sequence { background: var(--sl-accent-tint); box-shadow: inset 0 0 0 1px var(--sl-accent-line); color: var(--sl-accent-text); }
.pw-ia-result.is-none { background: none; color: var(--sl-text-3); font-weight: 500; }
.pw-ia-seq {
    display: flex; flex-direction: column; gap: 6px; padding: 10px; margin-bottom: 8px;
    border-radius: var(--sl-r-10); background: var(--sl-panel); border: 1px solid var(--sl-hairline);
    overflow-x: auto;
}
.pw-ia-seq.is-sequence { border-color: var(--sl-accent-line); }
.pw-ia-seq-track { display: flex; align-items: center; gap: 8px; }
.pw-ia-seq-label { flex: none; width: 20px; font-family: var(--sl-font-mono); font-size: 10px; color: var(--sl-text-3); }
.pw-ia-seq-strip { display: flex; gap: 2px; }
.pw-ia-tile.pw-ia-frame { flex: none; width: 128px; aspect-ratio: 16 / 10; border-radius: 0; }
.pw-ia-seq-strip .pw-ia-frame:first-child { border-top-left-radius: var(--sl-r-8); border-bottom-left-radius: var(--sl-r-8); }
.pw-ia-seq-strip .pw-ia-frame:last-child { border-top-right-radius: var(--sl-r-8); border-bottom-right-radius: var(--sl-r-8); }
.pw-ia-frame .pw-ia-media.is-audio { flex-direction: row; gap: 6px; }
.pw-ia-frame .pw-ia-audio-name { -webkit-line-clamp: 1; text-align: left; }
.pw-ia-node .pw-ia-seq + .pw-ia-grid { margin-top: 2px; }

/* states: loading, empty, nothing matches, unreadable */
.pw-ia-state { height: 100%; justify-content: center; box-sizing: border-box; }
.pw-ia-state p { margin: 0; }
.pw-ia-state-title { font-size: 13.5px; font-weight: 600; color: var(--sl-text-1); }
.pw-ia-state-hint { font-size: 12px; color: var(--sl-text-3); max-width: 360px; }
.pw-ia-state.is-error svg { color: var(--sl-error); }
.pw-ia-spin {
    width: 16px; height: 16px; border-radius: 50%; box-sizing: border-box;
    border: 2px solid var(--sl-ring-track); border-top-color: var(--sl-accent);
    animation: pwIaSpin 0.8s linear infinite;
}
@keyframes pwIaSpin { to { transform: rotate(360deg); } }

/* foot: destination, progress, actions */
.pw-ia-foot {
    flex: none; display: flex; align-items: center; gap: 8px;
    padding: 10px 14px 10px 18px; border-top: 1px solid var(--sl-hairline);
}
.pw-ia-into { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.pw-ia-into-select { max-width: 360px; cursor: pointer; }
.pw-ia-into-hint { font-size: 11.5px; color: var(--sl-text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.pw-ia-progress { display: flex; align-items: center; gap: 10px; flex: 0 1 340px; min-width: 0; }
.pw-ia-progress .sl-progress { flex: 1; }
.pw-ia-progress .sl-progress > span { width: 0; transition: width 0.2s ease-out; }
.pw-ia-progress-text { flex: none; font-size: 12px; color: var(--sl-text-2); font-variant-numeric: tabular-nums; }
.pw-ia.is-busy .pw-ia-tile { cursor: default; }

/* phones: a full-screen sheet, filters scroll sideways */
@media (max-width: 640px) {
    .pw-ia-scrim { padding: 0; align-items: stretch; }
    .pw-ia { width: 100%; height: 100%; border-radius: 0; border: none; }
    .pw-ia-toolbar { flex-wrap: nowrap; overflow-x: auto; padding: 10px 12px; }
    .pw-ia-toolbar .sl-seg { flex: none; }
    .pw-ia-selbar, .pw-ia-body { padding-left: 12px; padding-right: 12px; }
    .pw-ia-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
    .pw-ia-foot { flex-wrap: wrap; padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px)); }
    .pw-ia-into { flex: 1 1 100%; flex-wrap: wrap; }
    .pw-ia-into-hint { flex: 1 1 100%; }
    .pw-ia-tile.pw-ia-frame { width: 104px; }
    .pw-ia-into-select { flex: 1; max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
    .pw-ia, .pw-ia-tile, .pw-ia-progress .sl-progress > span { animation: none; transition: none; }
    .pw-ia-spin { animation-duration: 2.4s; }
}
