/* ===== Workflow Browser Styles ===== */
/* Gallery overlay: top nav, left sidebar, card grid, right detail panel */

/* ----- Full-screen Panel Window ----- */
.panel-window--workflows {
    width: 80vw;
    max-width: 1200px;
    height: 92vh;
    max-height: 92vh;
    padding: 0;
    overflow: hidden;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    background: var(--bg-surface);
}

/* ===== Top Navigation Bar ===== */
.wf-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    height: 40px;
    flex-shrink: 0;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-subtle);
}

.wf-topbar-left {
    display: flex;
    align-items: center;
    gap: 24px;
}

.wf-topbar-title {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--text-primary);
}

.wf-role-badge {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.5px;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}
.wf-role-badge--admin {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}
.wf-role-badge--enduser {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
}

.wf-topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Search in top bar */
.wf-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.wf-search-icon {
    position: absolute;
    left: 10px;
    color: var(--text-disabled);
    pointer-events: none;
}

.wf-search-input {
    width: 200px;
    padding: 5px 10px 5px 30px;
    background: var(--bg-muted);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s, width 0.2s;
}

.wf-search-input:focus {
    border-color: var(--interactive-focus);
    width: 260px;
}

.wf-search-input::placeholder {
    color: var(--text-disabled);
}

/* Upload button in top bar */
.wf-upload-btn {
    padding: 5px 14px;
    background: var(--accent-main);
    border: none;
    border-radius: 8px;
    color: var(--shade-white);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.15s;
    white-space: nowrap;
}

.wf-upload-btn:hover {
    filter: brightness(1.15);
}

/* Close button in top bar */
.wf-topbar-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.wf-topbar-icon-btn:hover {
    background: var(--interactive-hover);
    color: var(--text-primary);
}

/* ===== Main Body (sidebar + center + detail) ===== */
.wf-body {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* ===== Tab Switcher ===== */
.wf-tabs {
    display: flex;
    flex-shrink: 0;
    gap: 4px;
    padding: 0 16px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-primary);
}

.wf-tab {
    padding: 10px 16px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease;
    margin-bottom: -1px;
}

.wf-tab:hover {
    color: var(--text-secondary);
}

.wf-tab:first-child {
    padding-left: 0;
}

.wf-tab.active {
    color: var(--text-primary);
    border-bottom-color: var(--accent-main);
}

/* ===== Section Header ===== */
.wf-section-header {
    padding: 12px 16px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border-subtle);
}

.wf-section-description {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.4;
}


/* ===== Center Content Area ===== */
.wf-center {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-elevated);
    overflow: hidden;
}

.wf-center-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px 8px;
    flex-shrink: 0;
}

.wf-meta-count {
    font-size: 12px;
    color: var(--text-muted);
}

.wf-center-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wf-sort-select {
    padding: 6px 10px;
    background: var(--bg-muted);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s;
}

.wf-sort-select:hover {
    border-color: var(--accent-main);
}

.wf-sort-select:focus {
    border-color: var(--interactive-focus);
}

/* ===== Tag Filter Bar ===== */
.wf-tags-wrap {
    flex-shrink: 0;
    padding: 0 16px 8px;
}

.wf-tags-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    max-height: 22px;
    overflow: hidden;
}

.wf-tags-bar.expanded {
    max-height: none;
}

.wf-tags-toggle {
    display: inline-flex;
    align-items: center;
    margin-top: 4px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--border-default);
    background: transparent;
    color: var(--text-muted);
    user-select: none;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.wf-tags-toggle:hover {
    border-color: var(--accent-main);
    color: var(--text-primary);
}

.wf-tag-chip {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--border-default);
    background: transparent;
    color: var(--text-muted);
    transition: all 0.15s ease;
    user-select: none;
    text-transform: capitalize;
    white-space: nowrap;
    flex-shrink: 0;
}

.wf-tag-chip:hover {
    border-color: var(--accent-main);
    color: var(--text-primary);
}

.wf-tag-chip.active {
    background: color-mix(in srgb, var(--accent-main) 15%, transparent);
    border-color: var(--accent-main);
    color: var(--accent-main);
}

/* ===== Grid Scroll Container ===== */
.wf-grid-scroll {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    padding: 0 16px 16px;
}

.wf-grid-scroll::-webkit-scrollbar {
    width: 6px;
}

.wf-grid-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.wf-grid-scroll::-webkit-scrollbar-thumb {
    background-color: var(--neutral-600);
    border-radius: 3px;
}

.wf-grid-scroll::-webkit-scrollbar-thumb:hover {
    background-color: var(--neutral-500);
}

/* ===== Template Grid ===== */
.wf-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
}

/* View mode overrides are in the View Mode section below */

/* ===== Template Card ===== */
.wf-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    overflow: hidden;
}

.wf-card:hover {
    border-color: var(--border-default);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

.wf-card.wf-card--selected,
.wf-card.wf-card--selected:hover {
    border-color: var(--accent-main);
    box-shadow: 0 0 0 1px var(--accent-main), 0 4px 20px rgba(71, 144, 255, 0.2);
}

/* Card thumbnail */
.wf-card-thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    background: var(--bg-muted);
    overflow: hidden;
}

.wf-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.wf-card:hover .wf-card-thumb img {
    transform: scale(1.05);
}

.wf-card-thumb--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--neutral-800) 0%, var(--neutral-850) 100%);
}

.wf-card-thumb--placeholder::after {
    content: '';
    width: 40px;
    height: 40px;
    opacity: 0.1;
    background: var(--text-muted);
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='1.5'%3E%3Crect x='3' y='3' width='18' height='18' rx='2'/%3E%3Ccircle cx='8.5' cy='8.5' r='1.5'/%3E%3Cpolyline points='21 15 16 10 5 21'/%3E%3C/svg%3E") center/contain no-repeat;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='1.5'%3E%3Crect x='3' y='3' width='18' height='18' rx='2'/%3E%3Ccircle cx='8.5' cy='8.5' r='1.5'/%3E%3Cpolyline points='21 15 16 10 5 21'/%3E%3C/svg%3E") center/contain no-repeat;
}

/* Overlay badge row on thumbnail */
.wf-card-badge-row {
    position: absolute;
    top: 6px;
    left: 6px;
    right: 32px;
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    z-index: 2;
    overflow: hidden;
}

.wf-card-badge {
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    backdrop-filter: blur(8px);
}

.wf-card-badge--official {
    background: color-mix(in srgb, var(--accent-main) 85%, transparent);
    color: var(--shade-white);
}

.wf-card-badge--community {
    background: color-mix(in srgb, var(--hue-purple) 80%, transparent);
    color: var(--shade-white);
}

.wf-card-badge--hidden {
    background: color-mix(in srgb, var(--accent-caution) 85%, transparent);
    color: var(--shade-white);
}

.wf-card-badge--tag {
    background: color-mix(in srgb, var(--shade-white) 15%, transparent);
    color: var(--shade-white);
    backdrop-filter: blur(8px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 120px;
}

.wf-card-badge--more {
    background: color-mix(in srgb, var(--shade-white) 20%, transparent);
    color: var(--shade-white);
    backdrop-filter: blur(8px);
    flex-shrink: 0;
}

/* Favorite heart button */
.wf-card-fav {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--shade-black) 40%, transparent);
    backdrop-filter: blur(8px);
    border: none;
    border-radius: 50%;
    color: color-mix(in srgb, var(--shade-white) 70%, transparent);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    z-index: 2;
    opacity: 0;
}

.wf-card:hover .wf-card-fav {
    opacity: 1;
}

.wf-card-fav:hover {
    background: color-mix(in srgb, var(--shade-black) 60%, transparent);
    color: var(--shade-white);
}

.wf-card-fav.active {
    opacity: 1;
    color: var(--accent-danger);
}

.wf-card-fav.active svg {
    fill: var(--accent-danger);
}

/* Card info area */
.wf-card-info {
    padding: 6px 8px 8px;
}

.wf-card-title {
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wf-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-top: 2px;
    font-size: 10px;
    color: var(--text-disabled);
    min-width: 0;
}

.wf-card-author {
    color: var(--text-muted);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.wf-card-date {
    white-space: nowrap;
    flex-shrink: 0;
}

.wf-card-date {
    color: var(--text-disabled);
}

/* Create New Template card */
.wf-card--create {
    border: 2px dashed var(--border-default);
    background: transparent;
    min-height: 140px;
}

.wf-card--create:hover {
    border-color: var(--accent-main);
    background: color-mix(in srgb, var(--accent-main) 4%, transparent);
    box-shadow: none;
    transform: none;
}

.wf-card-create-inner {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
    transition: color 0.15s;
}

.wf-card--create:hover .wf-card-create-inner {
    color: var(--accent-main);
}

.wf-card-create-inner svg {
    opacity: 0.5;
    transition: opacity 0.15s;
}

.wf-card--create:hover .wf-card-create-inner svg {
    opacity: 1;
}

/* ===== View Mode Toggle ===== */
.wf-view-toggle {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-muted);
    border-radius: 4px;
    padding: 4px 6px;
}

.wf-size-icon {
    color: var(--text-muted);
    flex-shrink: 0;
}

.wf-size-slider {
    width: 72px;
    height: 3px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border-default);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
    flex-shrink: 0;
}

.wf-size-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--text-primary);
    cursor: pointer;
}

.wf-size-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--text-primary);
    border: none;
    cursor: pointer;
}

.wf-view-divider {
    width: 1px;
    height: 16px;
    background: var(--border-default);
    margin: 0 2px;
    flex-shrink: 0;
}

.wf-view-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 24px;
    border: none;
    border-radius: 3px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.wf-view-btn:hover {
    color: var(--text-primary);
}

.wf-view-btn.active {
    background: var(--bg-elevated);
    color: var(--text-primary);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* ===== Grid View Modes ===== */

/* Grid (size driven by --wf-card-size CSS var) */
.wf-grid--grid {
    grid-template-columns: repeat(auto-fill, minmax(var(--wf-card-size, 160px), 1fr));
}

/* Compact overrides when cards are very small */
.wf-grid--compact {
    gap: 4px;
}

.wf-grid--compact .wf-card-info {
    padding: 4px 6px 5px;
}

.wf-grid--compact .wf-card-title {
    font-size: 10px;
}

.wf-grid--compact .wf-card-meta {
    display: none;
}

.wf-grid--compact .wf-card-badge {
    font-size: 7px;
    padding: 1px 4px;
}

.wf-grid--compact .wf-card-fav {
    width: 20px;
    height: 20px;
}

.wf-grid--compact .wf-card-fav svg {
    width: 12px;
    height: 12px;
}

.wf-grid--compact .wf-card--create {
    min-height: 0;
}

.wf-grid--compact .wf-card-create-inner {
    gap: 4px;
}

.wf-grid--compact .wf-card-create-inner svg {
    width: 20px;
    height: 20px;
}

.wf-grid--compact .wf-card-create-inner span {
    font-size: 10px;
}

/* List */
.wf-grid--list {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.wf-grid--list .wf-card--create {
    height: 48px;
    min-height: 0;
    max-height: 48px;
    border-radius: 4px;
    border-width: 1px;
    border-style: dashed;
    overflow: hidden;
}

.wf-grid--list .wf-card--create .wf-card-create-inner {
    flex-direction: row;
    gap: 6px;
    padding: 0;
    min-height: 0;
    height: 100%;
}

.wf-grid--list .wf-card--create .wf-card-create-inner svg {
    width: 14px;
    height: 14px;
}

.wf-grid--list .wf-card--create .wf-card-create-inner span {
    font-size: 11px;
}

/* List row */
.wf-list-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 10px;
    background: var(--bg-primary);
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.wf-list-row:hover {
    background: var(--bg-elevated);
    border-color: var(--border-default);
}

.wf-list-row--selected {
    border-color: var(--accent-main);
    background: var(--bg-elevated);
}

.wf-list-thumb {
    width: 48px;
    height: 36px;
    border-radius: 3px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg-muted);
}

.wf-list-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.wf-list-thumb--placeholder {
    background: linear-gradient(135deg, var(--neutral-800) 0%, var(--neutral-850) 100%);
}

.wf-list-info {
    flex: 1;
    min-width: 0;
}

.wf-list-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wf-list-desc {
    font-size: 10px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wf-list-tags {
    flex-shrink: 0;
}

.wf-list-author {
    font-size: 11px;
    color: var(--text-muted);
    width: 80px;
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wf-list-date {
    font-size: 11px;
    color: var(--text-muted);
    width: 90px;
    flex-shrink: 0;
    text-align: right;
}

.wf-list-fav {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
}

.wf-list-fav:hover {
    background: color-mix(in srgb, var(--shade-white) 5%, transparent);
    color: var(--text-primary);
}

.wf-list-fav.active {
    color: var(--accent-danger);
}

.wf-list-fav.active svg {
    fill: var(--accent-danger);
}

/* ===== Right Detail Panel ===== */
.wf-detail-panel {
    width: 0;
    min-width: 0;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-primary);
    border-left: 1px solid var(--border-subtle);
    transition: width 0.25s ease;
}

.wf-detail-panel.open {
    width: 340px;
}

.wf-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.wf-detail-header-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.wf-detail-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: none;
    border: none;
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.wf-detail-close:hover {
    background: var(--interactive-hover);
    color: var(--text-primary);
}

.wf-detail-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.wf-detail-content::-webkit-scrollbar {
    width: 6px;
}

.wf-detail-content::-webkit-scrollbar-thumb {
    background: var(--neutral-600);
    border-radius: 3px;
}

.wf-detail-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 40px 20px;
    color: var(--text-muted);
    text-align: center;
}

.wf-detail-empty-text {
    font-size: 13px;
    color: var(--text-disabled);
}

/* Detail thumbnail */
.wf-detail-thumb-wrap {
    width: 100%;
    aspect-ratio: 16 / 10;
    flex-shrink: 0;
    background: var(--bg-muted);
    overflow: hidden;
}

.wf-detail-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.wf-detail-thumb--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-muted) 0%, var(--bg-subtle) 100%);
}

/* Detail badge */
.wf-detail-badge-row {
    padding: 12px 16px 0;
}

.wf-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    white-space: nowrap;
}

.wf-badge--official {
    background: color-mix(in srgb, var(--accent-main) 15%, transparent);
    color: var(--accent-main);
    border: 1px solid color-mix(in srgb, var(--accent-main) 30%, transparent);
}

.wf-badge--community {
    background: color-mix(in srgb, var(--hue-purple) 12%, transparent);
    color: var(--hue-purple);
    border: 1px solid color-mix(in srgb, var(--hue-purple) 25%, transparent);
}

.wf-badge--hidden {
    background: color-mix(in srgb, var(--accent-caution) 12%, transparent);
    color: var(--accent-caution);
    border: 1px solid color-mix(in srgb, var(--accent-caution) 30%, transparent);
}

/* Hidden graphlet notice in detail panel */
.wf-detail-hidden-notice {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 8px 16px 0;
    padding: 8px 12px;
    background: color-mix(in srgb, var(--accent-caution) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent-caution) 25%, transparent);
    border-radius: 6px;
    font-size: 12px;
    color: var(--accent-caution);
    line-height: 1.4;
}

.wf-detail-hidden-notice svg {
    flex-shrink: 0;
    margin-top: 1px;
}

/* Detail title */
.wf-detail-title {
    margin: 10px 16px 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
}

/* Detail description */
.wf-detail-desc {
    margin: 8px 16px 0;
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.6;
}

/* Detail tags */
.wf-detail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 12px 16px 0;
}

.wf-detail-tag {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    background: color-mix(in srgb, var(--shade-white) 6%, transparent);
    color: var(--text-muted);
    border: 1px solid color-mix(in srgb, var(--shade-white) 8%, transparent);
}

/* Import button */
.wf-detail-import-section {
    padding: 16px;
}

.wf-detail-import-btn {
    width: 100%;
    padding: 12px 16px;
    background: var(--accent-main);
    border: none;
    border-radius: 8px;
    color: var(--shade-white);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: filter 0.15s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wf-detail-import-btn:hover {
    filter: brightness(1.15);
}

/* Detail metadata table */
.wf-detail-meta-table {
    padding: 0 16px;
    display: flex;
    flex-direction: column;
}

.wf-detail-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-top: 1px solid var(--border-subtle);
}

.wf-detail-meta-label {
    font-size: 12px;
    color: var(--text-muted);
}

.wf-detail-meta-value {
    font-size: 12px;
    color: var(--text-primary);
    font-weight: 500;
}

/* Detail secondary actions */
.wf-detail-secondary-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 16px 20px;
    margin-top: auto;
}

.wf-detail-link-btn {
    background: none;
    border: none;
    color: var(--text-disabled);
    font-size: 12px;
    cursor: pointer;
    padding: 4px 0;
    transition: color 0.15s;
    text-align: left;
}

.wf-detail-link-btn:hover {
    color: var(--text-primary);
}

.wf-detail-link-btn--danger:hover {
    color: var(--destructive-400);
}

/* ===== Empty & Loading States ===== */
.wf-empty {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 60px 20px;
    color: var(--text-muted);
    text-align: center;
}

.wf-empty-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
}

.wf-empty-subtitle {
    font-size: 13px;
}

.wf-loading {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 13px;
}

.wf-loading::before {
    content: '';
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-subtle);
    border-top-color: var(--accent-main);
    border-radius: 50%;
    animation: wf-spin 0.7s linear infinite;
}

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

/* ===== Upload Form ===== */
.wf-upload-form {
    display: flex;
    flex-direction: column;
}

.wf-upload-container {
    display: flex;
    gap: 32px;
    padding: 32px 0 0;
}

.wf-upload-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
    max-width: 680px;
}

.wf-upload-heading {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.2;
}

.wf-upload-subheading {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
    margin-top: -8px;
}

.wf-upload-right {
    width: 320px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-top: 0;
}

/* Thumbnail section */
.wf-thumb-section {
    margin-bottom: 4px;
}

.wf-thumb-dropzone {
    width: 100%;
    aspect-ratio: 16 / 9;
    max-height: 180px;
    border: 2px dashed var(--border-default);
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    overflow: hidden;
    background: var(--bg-muted);
}

.wf-thumb-dropzone:hover {
    border-color: var(--accent-main);
    background: color-mix(in srgb, var(--accent-main) 5%, transparent);
}

.wf-thumb-dropzone--hover {
    border-color: var(--accent-main);
    background: color-mix(in srgb, var(--accent-main) 10%, transparent);
}

.wf-thumb-dropzone--has-image {
    border-style: solid;
    border-color: transparent;
}

.wf-thumb-dropzone--has-image:hover {
    border-color: var(--accent-main);
}

.wf-thumb-dropzone-inner {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
}

.wf-thumb-dropzone-inner svg {
    color: var(--text-disabled);
}

.wf-thumb-dropzone-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.wf-thumb-dropzone-hint {
    font-size: 12px;
    color: var(--text-disabled);
}

.wf-thumb-preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.wf-thumb-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--shade-black) 70%, transparent);
    color: var(--shade-white);
    border: none;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.wf-thumb-remove:hover {
    background: color-mix(in srgb, var(--accent-danger) 80%, transparent);
}

/* Form fields */
.wf-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.wf-form-label {
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wf-form-input,
.wf-form-textarea {
    padding: 10px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s, background 0.15s;
}

.wf-form-input::placeholder,
.wf-form-textarea::placeholder {
    color: var(--text-disabled);
}

.wf-form-input:focus,
.wf-form-textarea:focus {
    border-color: var(--interactive-focus);
    background: var(--bg-surface);
}

.wf-form-textarea {
    resize: vertical;
    min-height: 80px;
    scrollbar-width: thin;
    scrollbar-color: var(--neutral-600) transparent;
}

.wf-form-textarea::-webkit-scrollbar {
    width: 6px;
}

.wf-form-textarea::-webkit-scrollbar-track {
    background: transparent;
}

.wf-form-textarea::-webkit-scrollbar-thumb {
    background-color: var(--neutral-600);
    border-radius: 3px;
}

.wf-form-textarea::-webkit-scrollbar-thumb:hover {
    background-color: var(--neutral-500);
}

/* Upload actions */
/* Visibility radio toggle in upload form */
.wf-visibility-toggle {
    display: flex;
    gap: 12px;
}

.wf-toggle-option {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 16px;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    cursor: pointer;
    flex: 1;
    transition: border-color 0.15s, background 0.15s;
}

.wf-toggle-option:has(input:checked) {
    border-color: var(--accent-main);
    background: color-mix(in srgb, var(--accent-main) 8%, transparent);
}

.wf-toggle-option input[type="radio"] {
    display: none;
}

.wf-toggle-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.wf-toggle-hint {
    font-size: 11px;
    color: var(--text-secondary);
}

.wf-upload-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}

.wf-upload-submit-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--accent-main);
    border: none;
    border-radius: 8px;
    color: var(--shade-white);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.15s;
}

.wf-upload-submit-btn:hover {
    filter: brightness(1.15);
}

.wf-upload-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: none;
}

.wf-upload-cancel-btn {
    padding: 12px 20px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.15s;
}

.wf-upload-cancel-btn:hover {
    color: var(--text-primary);
}

/* Live Preview */
.wf-preview-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.wf-preview-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wf-preview-draft-badge {
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(71, 144, 255, 0.12);
    color: var(--accent-main);
}

.wf-preview-card {
    background: var(--bg-primary);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border-subtle);
}

.wf-preview-thumb {
    width: 100%;
    aspect-ratio: 16 / 10;
    background: var(--bg-muted);
    overflow: hidden;
}

.wf-preview-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.wf-preview-thumb-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--neutral-800) 0%, var(--neutral-700) 100%);
}

.wf-preview-badge-row {
    padding: 10px 14px 0;
}

.wf-preview-title {
    padding: 6px 14px 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
}

.wf-preview-desc {
    padding: 4px 14px 0;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.wf-preview-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px 14px;
    font-size: 11px;
    color: var(--text-disabled);
}

.wf-preview-meta-author {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-weight: 500;
}

.wf-preview-meta-version {
    color: var(--text-disabled);
}

/* Visibility Rules */
.wf-visibility-rules {
    background: rgba(71, 144, 255, 0.06);
    border: 1px solid rgba(71, 144, 255, 0.15);
    border-radius: 10px;
    padding: 14px;
}

.wf-visibility-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-main);
    margin-bottom: 10px;
}

.wf-visibility-list {
    margin: 0;
    padding: 0 0 0 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.wf-visibility-list li {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}

.wf-visibility-list strong {
    color: var(--accent-main);
}

/* ===== Tag Input with Autocomplete ===== */
.wf-tag-input-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    min-height: 40px;
    align-items: center;
    cursor: text;
    transition: border-color 0.15s;
    position: relative;
}

.wf-tag-input-wrap:focus-within {
    border-color: var(--interactive-focus);
    background: var(--bg-surface);
}

.wf-tag-input-wrap .wf-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    background: rgba(71, 144, 255, 0.15);
    border: 1px solid rgba(71, 144, 255, 0.3);
    color: var(--accent-main);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.wf-tag-input-wrap .wf-chip-remove {
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    opacity: 0.6;
    transition: opacity 0.1s;
    margin-left: 2px;
}

.wf-tag-input-wrap .wf-chip-remove:hover {
    opacity: 1;
}

.wf-tag-input-wrap .wf-tag-text-input {
    flex: 1;
    min-width: 80px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    padding: 2px 0;
}

.wf-tag-input-wrap .wf-tag-text-input::placeholder {
    color: var(--text-disabled);
}

/* Tag suggestions dropdown */
.wf-tag-suggestions {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 100%;
    margin-bottom: 4px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: 8px;
    max-height: 160px;
    overflow-y: auto;
    z-index: 10;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.3);
    display: none;
}

.wf-tag-suggestions.visible {
    display: block;
}

.wf-tag-suggestion-item {
    padding: 8px 14px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.1s;
}

.wf-tag-suggestion-item:hover,
.wf-tag-suggestion-item.highlighted {
    background: var(--interactive-hover);
    color: var(--text-primary);
}

.wf-tag-suggestions::-webkit-scrollbar {
    width: 5px;
}

.wf-tag-suggestions::-webkit-scrollbar-thumb {
    background: var(--neutral-600);
    border-radius: 3px;
}

.wf-load-more {
    grid-column: 1 / -1;
    display: block;
    width: 100%;
    padding: 10px;
    margin-top: 8px;
    background: var(--interactive-default);
    border: 1px solid var(--border-default);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.1s;
}

.wf-load-more:hover {
    background: var(--interactive-hover);
}
