/* ============================================================
   HEXIS DAM v2 — Admin Panel
   Sidebar, dashboard, forms, tables
   ============================================================ */

[hidden] { display: none !important; }

/* ── Layout ─────────────────────────────────────────────── */
.admin-layout {
    display: flex;
    min-height: 100vh;
    background: var(--bg);
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    flex-shrink: 0;
    transition: width var(--ease-base);
    z-index: var(--z-sticky);
}

.sidebar__logo {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.sidebar__logo img { height: 24px; }

[data-theme="dark"] .sidebar__logo img { filter: brightness(0) invert(1); }

.sidebar__logo-label {
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar__nav {
    flex: 1;
    padding: var(--space-md) var(--space-sm);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar__section-label {
    font-size: 10px;
    font-weight: var(--weight-semibold);
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: var(--space-sm) var(--space-md);
    margin-top: var(--space-sm);
}

.sidebar__item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: 10px var(--space-md);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    transition: all var(--ease-fast);
    cursor: pointer;
    text-decoration: none;
    position: relative;
}

.sidebar__item svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar__item:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.sidebar__item.active {
    background: color-mix(in srgb, var(--brand-accent) 10%, transparent);
    color: var(--brand-accent);
}

.sidebar__item__badge {
    margin-left: auto;
    background: var(--brand-accent);
    color: white;
    font-size: 10px;
    padding: 1px 7px;
    border-radius: var(--radius-full);
}

.sidebar__footer {
    padding: var(--space-md);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.sidebar__user-name {
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
}

.sidebar__user-role {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.sidebar__logout {
    margin-left: auto;
    padding: 6px;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    transition: all var(--ease-fast);
}

.sidebar__logout:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.sidebar__logout svg { width: 18px; height: 18px; }

/* ── Admin Main ──────────────────────────────────────────── */
.admin-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* ── Admin Header ────────────────────────────────────────── */
.admin-header {
    height: var(--header-height);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 var(--space-xl);
    gap: var(--space-md);
    background: var(--bg-surface);
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
}

.admin-header__title {
    font-size: var(--text-lg);
    font-weight: var(--weight-semibold);
}

.admin-header__breadcrumb {
    font-size: var(--text-sm);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.admin-header__breadcrumb svg { width: 14px; height: 14px; }

.admin-header__actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

/* ── Admin Content ───────────────────────────────────────── */
.admin-content {
    flex: 1;
    padding: var(--space-xl);
    max-width: 1400px;
    width: 100%;
}

/* ── Dashboard Stats ─────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    transition: all var(--ease-fast);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-md);
}

.stat-card__icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-card__icon svg { width: 20px; height: 20px; }

.stat-card__icon--pink   { background: rgba(254,1,108,0.1);  color: #FE016C; }
.stat-card__icon--orange { background: rgba(245,166,35,0.1); color: #F5A623; }
.stat-card__icon--blue   { background: rgba(74,144,217,0.1); color: #4A90D9; }
.stat-card__icon--green  { background: rgba(5,150,105,0.1);  color: #059669; }
.stat-card__icon--purple { background: rgba(124,58,237,0.1); color: #7C3AED; }

.stat-card__value {
    font-size: var(--text-3xl);
    font-weight: var(--weight-bold);
    line-height: 1;
    margin-bottom: 4px;
}

.stat-card__label {
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.stat-card__trend {
    font-size: var(--text-xs);
    font-weight: var(--weight-medium);
}

.stat-card__trend--up   { color: #059669; }
.stat-card__trend--down { color: #DC2626; }

/* ── Section Header ──────────────────────────────────────── */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-lg);
}

.section-title {
    font-size: var(--text-xl);
    font-weight: var(--weight-semibold);
}

/* ── Table ───────────────────────────────────────────────── */
.table-container {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    padding: var(--space-md) var(--space-lg);
    text-align: left;
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    white-space: nowrap;
}

.table td {
    padding: var(--space-md) var(--space-lg);
    font-size: var(--text-sm);
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.table tr:last-child td { border-bottom: none; }

.table tr:hover td { background: var(--bg-hover); }

.table__thumb {
    width: 48px;
    height: 36px;
    border-radius: var(--radius-xs);
    object-fit: cover;
    background: var(--bg-hover);
}

.table__select-all,
.table__select {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--brand-accent);
}

/* ── Bulk Toolbar ────────────────────────────────────────── */
.bulk-toolbar {
    display: none;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    background: color-mix(in srgb, var(--brand-accent) 8%, var(--bg-surface));
    border-bottom: 1px solid var(--border);
    animation: slideDown var(--ease-spring);
}

.bulk-toolbar.visible { display: flex; }

.bulk-toolbar__count {
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
}

/* ── Upload Zone ─────────────────────────────────────────── */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-3xl);
    text-align: center;
    background: var(--bg-surface);
    transition: all var(--ease-base);
    cursor: pointer;
    position: relative;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--brand-accent);
    background: color-mix(in srgb, var(--brand-accent) 4%, var(--bg-surface));
}

.upload-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 1;
}

.upload-zone__icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-lg);
    background: color-mix(in srgb, var(--brand-accent) 10%, transparent);
    color: var(--brand-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-md);
}

.upload-zone__icon svg { width: 28px; height: 28px; }

.upload-zone__title {
    font-size: var(--text-lg);
    font-weight: var(--weight-semibold);
    margin-bottom: var(--space-sm);
}

.upload-zone__subtitle {
    font-size: var(--text-sm);
    color: var(--text-muted);
}

/* ── Upload Queue ────────────────────────────────────────── */
.upload-queue {
    margin-top: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.upload-item {
    display: grid;
    grid-template-columns: 56px 1fr auto;
    gap: var(--space-md);
    align-items: center;
    padding: var(--space-md);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.upload-item__thumb {
    width: 56px;
    height: 42px;
    border-radius: var(--radius-xs);
    object-fit: cover;
    background: var(--bg-hover);
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-item__thumb svg { width: 22px; height: 22px; color: var(--text-light); }

.upload-item__name {
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.upload-item__size { font-size: var(--text-xs); color: var(--text-muted); }

.upload-item__progress {
    width: 100%;
    height: 4px;
    border-radius: var(--radius-full);
    background: var(--bg-hover);
    overflow: hidden;
    margin-top: 6px;
}

.upload-item__progress-bar {
    height: 100%;
    border-radius: var(--radius-full);
    background: var(--brand-accent);
    transition: width 0.3s ease;
}

.upload-item__status { font-size: var(--text-xs); font-weight: var(--weight-medium); }
.upload-item__status--success { color: #059669; }
.upload-item__status--error   { color: #DC2626; }
.upload-item__status--loading { color: var(--brand-accent); }

/* ── AI Tag Result ───────────────────────────────────────── */
.ai-result {
    margin-top: var(--space-md);
    padding: var(--space-md);
    background: color-mix(in srgb, #8B5CF6 8%, var(--bg-surface));
    border: 1px solid color-mix(in srgb, #8B5CF6 20%, transparent);
    border-radius: var(--radius-md);
    animation: fadeIn 0.4s ease;
}

.ai-result__header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    color: #8B5CF6;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ai-result__header svg { width: 14px; height: 14px; }

.ai-result__desc {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

.ai-result__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ai-result__tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    font-size: var(--text-xs);
    border-radius: var(--radius-full);
    background: rgba(139, 92, 246, 0.12);
    color: #7C3AED;
    cursor: pointer;
    transition: all var(--ease-fast);
}

.ai-result__tag:hover { background: rgba(139, 92, 246, 0.2); }

.ai-result__tag--accepted {
    background: rgba(5, 150, 105, 0.12);
    color: #059669;
}

.ai-result__tag svg { width: 12px; height: 12px; }

/* ── Form ────────────────────────────────────────────────── */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-lg);
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.form-field--full { grid-column: 1 / -1; }

.label {
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: var(--text-secondary);
}

.select {
    appearance: none;
    background: var(--bg-input) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' viewBox='0 0 12 8'%3E%3Cpath stroke='%236B7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m1 1 5 5 5-5'/%3E%3C/svg%3E") no-repeat right 14px center;
    padding: 10px 40px 10px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: all var(--ease-fast);
}

.select:focus {
    outline: none;
    border-color: var(--brand-accent);
}

.textarea {
    resize: vertical;
    min-height: 80px;
}

/* ── Activity Feed ───────────────────────────────────────── */
.activity-feed {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.activity-feed__header {
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border);
    font-weight: var(--weight-semibold);
    font-size: var(--text-sm);
}

.activity-item {
    display: flex;
    gap: var(--space-md);
    align-items: flex-start;
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border-light);
}

.activity-item:last-child { border-bottom: none; }

.activity-item__icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
}

.activity-item__icon--upload   { background: rgba(5,150,105,0.1);  color: #059669; }
.activity-item__icon--update   { background: rgba(37,99,235,0.1);  color: #2563EB; }
.activity-item__icon--delete   { background: rgba(220,38,38,0.1);  color: #DC2626; }
.activity-item__icon--login    { background: rgba(124,58,237,0.1); color: #7C3AED; }

.activity-item__icon svg { width: 16px; height: 16px; }

.activity-item__text {
    flex: 1;
    font-size: var(--text-sm);
}

.activity-item__time {
    font-size: var(--text-xs);
    color: var(--text-muted);
    white-space: nowrap;
}

/* ── Division bar chart (pure CSS) ──────────────────────── */
.division-bars {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.division-bar {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.division-bar__label {
    font-size: var(--text-sm);
    width: 120px;
    flex-shrink: 0;
}

.division-bar__track {
    flex: 1;
    height: 8px;
    background: var(--bg-hover);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.division-bar__fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 1s ease;
}

.division-bar__count {
    font-size: var(--text-xs);
    color: var(--text-muted);
    width: 40px;
    text-align: right;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 1100px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -100%;
        transition: left var(--ease-base);
        z-index: var(--z-modal);
    }
    .sidebar.open { left: 0; }
    .admin-header { padding: 0 var(--space-md); }
    .admin-content { padding: var(--space-md); }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
}

/* ── Login Screen ────────────────────────────────────────── */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: var(--space-lg);
}

.login-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-xl) var(--space-2xl);
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-xl);
    text-align: center;
}

.login-logo { height: 36px; margin-bottom: var(--space-lg); }

.login-title {
    font-size: var(--text-xl);
    font-weight: var(--weight-semibold);
    margin-bottom: var(--space-xl);
    text-align: left;
}

.login-error {
    margin-top: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    background: rgba(220,38,38,0.08);
    border: 1px solid rgba(220,38,38,0.2);
    border-radius: var(--radius-sm);
    color: #DC2626;
    font-size: var(--text-sm);
    text-align: left;
}

/* ── Admin App Layout ────────────────────────────────────── */
.admin-app {
    display: flex;
    min-height: 100vh;
    background: var(--bg);
}

.admin-content {
    flex: 1;
    padding: var(--space-xl);
    max-width: 1400px;
    width: 100%;
}

/* ── Toolbar ─────────────────────────────────────────────── */
.admin-toolbar {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    flex-wrap: wrap;
}

/* ── Pagination ──────────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
}

.pagination__btn {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: all var(--ease-fast);
}

.pagination__btn:hover { background: var(--bg-hover); }
.pagination__btn.active { background: var(--brand-accent); color: white; border-color: var(--brand-accent); }
.pagination__btn:disabled { opacity: 0.4; cursor: default; }

/* ── Badges ──────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
}

.badge--admin   { background: rgba(254,1,108,0.1);  color: #FE016C; }
.badge--editor  { background: rgba(37,99,235,0.1);  color: #2563EB; }
.badge--viewer  { background: rgba(107,114,128,0.1); color: #6B7280; }
.badge--image   { background: rgba(5,150,105,0.1);  color: #059669; }
.badge--video   { background: rgba(245,158,11,0.1); color: #D97706; }
.badge--document{ background: rgba(37,99,235,0.1);  color: #2563EB; }
.badge--active  { background: rgba(5,150,105,0.1);  color: #059669; }
.badge--inactive{ background: rgba(220,38,38,0.1);  color: #DC2626; }

/* ── Danger button ───────────────────────────────────────── */
.btn--danger {
    background: #DC2626;
    color: white;
    border-color: #DC2626;
}
.btn--danger:hover { background: #B91C1C; }

/* ── Tag chips ───────────────────────────────────────────── */
.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    background: var(--bg-hover);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

/* ── Modal ───────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: var(--space-lg);
    animation: fadeIn 0.15s ease;
}

.modal {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.2s ease;
}

.modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg) var(--space-xl);
    border-bottom: 1px solid var(--border);
}

.modal__title { font-size: var(--text-lg); font-weight: var(--weight-semibold); }

.modal__close {
    width: 32px; height: 32px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; background: transparent; border: none;
    color: var(--text-muted); transition: all var(--ease-fast);
}
.modal__close:hover { background: var(--bg-hover); color: var(--text); }
.modal__close svg { width: 18px; height: 18px; }

.modal__body { padding: var(--space-xl); }

.modal__footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-xl);
    border-top: 1px solid var(--border);
}

/* ── Sortable column headers ─────────────────────────────── */
.th-sort {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    transition: color var(--ease-fast);
}

.th-sort:hover { color: var(--text); }

.sort-icon { margin-left: 4px; opacity: 0.3; font-style: normal; font-size: 11px; }

.th-sort.sort-active .sort-icon { opacity: 1; color: var(--brand-accent); }

/* ── Wedia Layout ─────────────────────────────────────────── */
.wedia-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 24px;
    align-items: start;
}

.wedia-filters {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    position: sticky;
    top: 20px;
}

.wedia-filters__title {
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

/* ── Wedia Grid ───────────────────────────────────────────── */
.wedia-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
    gap: 12px;
}

.wedia-card {
    background: var(--bg-surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: border-color var(--ease-fast), box-shadow var(--ease-fast);
    position: relative;
}

.wedia-card:not(.imported):hover {
    border-color: var(--brand-accent);
    box-shadow: var(--shadow-md);
}

.wedia-card.imported { opacity: 0.65; }

.wedia-card__thumb {
    width: 100%;
    aspect-ratio: 4/3;
    background: var(--bg-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.wedia-card__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wedia-card__thumb svg { width: 32px; height: 32px; color: var(--text-light); }

.wedia-card__body { padding: 8px 10px 10px; }

.wedia-card__name {
    font-size: 12px;
    font-weight: var(--weight-medium);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 4px;
}

.wedia-card__meta {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.wedia-card__badge {
    position: absolute;
    top: 6px;
    left: 6px;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 10px;
    font-weight: var(--weight-semibold);
    backdrop-filter: blur(4px);
}

.wedia-card__badge--imported { background: rgba(5,150,105,0.85); color: white; }

.wedia-card__import-btn {
    width: 100%;
    padding: 7px;
    background: var(--brand-accent);
    color: white;
    font-size: 12px;
    font-weight: var(--weight-medium);
    text-align: center;
    cursor: pointer;
    border: none;
    transition: background var(--ease-fast), opacity var(--ease-fast);
    opacity: 0;
}

.wedia-card:not(.imported):hover .wedia-card__import-btn { opacity: 1; }

.wedia-card__import-btn--loading { background: var(--text-muted); cursor: not-allowed; opacity: 1; }
.wedia-card__import-btn--done    { background: #059669; opacity: 1; cursor: default; }
.wedia-card__import-btn--error   { background: #DC2626; opacity: 1; }

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

@media (max-width: 900px) {
    .wedia-layout { grid-template-columns: 1fr; }
    .wedia-filters { position: static; }
}

/* ── Tag editor (chips + input) ──────────────────────────── */
.tag-editor {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    padding: 6px 10px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-input);
    min-height: 42px;
    cursor: text;
    transition: border-color var(--ease-fast);
}

.tag-editor:focus-within { border-color: var(--brand-accent); }

.tag-editor__input {
    border: none;
    background: transparent;
    outline: none;
    font-family: var(--font-family);
    font-size: var(--text-sm);
    color: var(--text);
    min-width: 120px;
    flex: 1;
}

.tag-chip--removable {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px 3px 10px;
    border-radius: var(--radius-full);
    background: color-mix(in srgb, var(--brand-accent) 12%, transparent);
    color: var(--brand-accent);
    font-size: var(--text-xs);
    font-weight: var(--weight-medium);
    line-height: 1.4;
}

.tag-chip--removable button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    color: inherit;
    opacity: 0.6;
    font-size: 15px;
    line-height: 1;
    display: flex;
    align-items: center;
}

.tag-chip--removable button:hover { opacity: 1; }

/* ── Textarea ────────────────────────────────────────────── */
.textarea {
    width: 100%;
    padding: 10px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-input);
    color: var(--text);
    font-family: var(--font-family);
    font-size: var(--text-sm);
    resize: vertical;
    min-height: 80px;
    transition: border-color var(--ease-fast);
}
.textarea:focus { outline: none; border-color: var(--brand-accent); }

/* ── Collection asset picker ─────────────────────────────── */
.col-asset-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 20;
    max-height: 260px;
    overflow-y: auto;
    background: var(--bg-surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg, 0 10px 30px rgba(0,0,0,.18));
}
.col-asset-results__head {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 6px 12px;
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
}
.col-asset-result {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
}
.col-asset-result__add {
    margin-left: auto;
    width: 18px; height: 18px;
    color: var(--brand-accent, var(--text-muted));
    flex-shrink: 0;
}
.col-asset-result:last-child { border-bottom: none; }
.col-asset-result:hover { background: var(--bg-input); }
.col-asset-result img,
.col-asset-result .col-asset-ph {
    width: 40px; height: 40px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
    background: var(--bg-input);
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted);
}
.col-asset-result__title { font-size: var(--text-sm); color: var(--text); }
.col-asset-result__type  { font-size: 11px; color: var(--text-muted); }
.col-asset-result--empty { padding: 12px; color: var(--text-muted); font-size: var(--text-sm); }

.col-assets-selected {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
    gap: 8px;
    margin-top: 10px;
}
.col-asset-chip {
    position: relative;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 1;
    cursor: grab;
    background: var(--bg-input);
}
.col-asset-chip.dragging { opacity: .4; }
.col-asset-chip img,
.col-asset-chip .col-asset-ph {
    width: 100%; height: 100%;
    object-fit: cover;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted);
}
.col-asset-chip__remove {
    position: absolute;
    top: 3px; right: 3px;
    width: 20px; height: 20px;
    border: none;
    border-radius: 50%;
    background: rgba(0,0,0,.65);
    color: #fff;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.col-asset-chip__remove:hover { background: #DC2626; }
.col-asset-chip__order {
    position: absolute;
    bottom: 3px; left: 3px;
    background: rgba(0,0,0,.65);
    color: #fff;
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 4px;
}
