* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f8f9fb;
    color: #292D32;
    min-height: 100vh;
    padding: 2rem;
    -webkit-font-smoothing: antialiased;
}

.page {
    max-width: 1180px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.top-row {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.container {
    flex: 1;
    min-width: 0;
    max-width: 560px;
    background: #ffffff;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.detail-panel {
    flex: 1;
    min-width: 0;
    min-height: 0;
    max-height: calc(100vh - 4rem);
    background: #ffffff;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.datasets-panel {
    background: #ffffff;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

@media (max-width: 960px) {
    .top-row { flex-direction: column; }
    .container, .detail-panel { max-width: 560px; width: 100%; margin: 0 auto; }
}

/* Detail panel */
.detail-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #A9ACB4;
    font-size: 0.9rem;
    text-align: center;
    gap: 0.75rem;
}

.detail-empty svg {
    width: 56px;
    height: auto;
    color: #d1d5db;
}

.detail-header {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eef0f4;
    margin-bottom: 1rem;
}

.detail-header-text {
    flex: 1;
    min-width: 0;
}

.detail-header-name {
    font-size: 1rem;
    font-weight: 600;
    color: #292D32;
    margin-bottom: 0.2rem;
    word-break: break-all;
}

.detail-header-stats {
    font-size: 0.8rem;
    color: #A9ACB4;
}

.detail-header-actions {
    display: flex;
    gap: 0.35rem;
    flex-shrink: 0;
}

.detail-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.detail-action-btn:hover {
    background: #f3f4f6;
    color: #292D32;
}

.detail-action-btn.danger:hover {
    background: #fee2e2;
    color: #dc2626;
    border-color: #fecaca;
}

.detail-action-btn svg {
    width: 16px;
    height: 16px;
}

.detail-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.session-group {
    margin-bottom: 1rem;
}

.session-group-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: #EEF1F7;
    border-radius: 8px;
    margin-bottom: 0.25rem;
}

.session-group-folder {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    background: linear-gradient(180deg, #94a3b8, #64748b);
    box-shadow: 0 1px 2px rgba(71, 85, 105, 0.2), inset 0 1px 0 rgba(255,255,255,0.3);
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
}

.session-group-folder svg {
    width: 14px;
    height: auto;
}

.session-group-name {
    flex: 1;
    min-width: 0;
    font-weight: 600;
    font-size: 0.85rem;
    color: #292D32;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.session-group-stats {
    font-size: 0.72rem;
    color: #6b7280;
    flex-shrink: 0;
}

.session-files {
    padding-left: 1.5rem;
}

/* Datasets bottom panel */
.datasets-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eef0f4;
    margin-bottom: 1rem;
}

.datasets-header h2 {
    font-size: 1rem;
    font-weight: 600;
    color: #292D32;
}

.datasets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.6rem;
}


/* ====== Header ====== */
.panel-header {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eef0f4;
    margin-bottom: 1.25rem;
    position: relative;
}

.panel-header-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.panel-header-icon svg {
    width: 20px;
    height: 20px;
    color: #292D32;
}

.panel-header-text {
    flex: 1;
}

.panel-header-title {
    font-size: 1rem;
    font-weight: 600;
    color: #292D32;
    margin-bottom: 0.15rem;
}

.panel-header-subtitle {
    font-size: 0.85rem;
    color: #6b7280;
}

.panel-header-close {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
}

.panel-header-close:hover {
    background: #f3f4f6;
    color: #292D32;
}

.panel-header-close svg {
    width: 18px;
    height: 18px;
}

/* Form fields */
.fields {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.field {
    flex: 1;
}

.field label {
    display: block;
    font-size: 0.8rem;
    color: #57606a;
    margin-bottom: 0.35rem;
    font-weight: 500;
}

.field input, .field textarea {
    width: 100%;
    padding: 0.55rem 0.75rem;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    color: #292D32;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.field input:focus, .field textarea:focus {
    border-color: #93243f;
    box-shadow: 0 0 0 3px rgba(147, 36, 63, 0.1);
}

.field input::placeholder, .field textarea::placeholder {
    color: #A9ACB4;
    font-size: 0.8rem;
}

.field-full {
    margin-bottom: 1.5rem;
}

.field-full label {
    font-size: 0.8rem;
    color: #57606a;
    margin-bottom: 0.35rem;
    display: block;
    font-weight: 500;
}

.field-full textarea {
    width: 100%;
    padding: 0.55rem 0.75rem;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    color: #292D32;
    font-size: 0.85rem;
    font-family: monospace;
    outline: none;
    resize: vertical;
    min-height: 60px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.field-full textarea:focus {
    border-color: #93243f;
    box-shadow: 0 0 0 3px rgba(147, 36, 63, 0.1);
}

/* Drop zone */
.dropzone {
    border: 1.5px dashed #d1d5db;
    border-radius: 14px;
    padding: 2rem 1.5rem;
    text-align: center;
    cursor: default;
    transition: all 0.2s;
    margin-bottom: 1rem;
    position: relative;
    background: #ffffff;
}

.dropzone.dragover {
    border-color: #93243f;
    background: #fdf2f5;
}

.dropzone-icon {
    width: 36px;
    height: 36px;
    margin: 0 auto 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dropzone-icon svg {
    width: 36px;
    height: 36px;
}

.dropzone-text {
    font-size: 0.95rem;
    color: #292D32;
    font-weight: 500;
}

.dropzone-hint {
    font-size: 0.8rem;
    color: #9ca3af;
    margin-top: 0.35rem;
    margin-bottom: 1rem;
}

.browse-btn {
    display: inline-block;
    padding: 0.5rem 1.25rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: #292D32;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.browse-btn:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.dropzone input[type="file"] {
    display: none;
}

/* File list */
.file-list {
    margin-bottom: 1.5rem;
}

.file-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.file-list-header h3 {
    font-size: 0.85rem;
    font-weight: 500;
    color: #57606a;
}

.file-list-toggle {
    font-size: 0.75rem;
    color: #0969da;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    margin-right: 0.25rem;
}

.file-list-toggle:hover {
    background: rgba(9, 105, 218, 0.08);
}

.file-items {
    padding-right: 0.25rem;
}

/* Summary bar above the tree */
.upload-summary {
    background: #EEF1F7;
    border-radius: 12px;
    padding: 0.75rem 0.85rem;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
}

.upload-summary-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}

.upload-summary-text {
    font-weight: 600;
    color: #292D32;
    font-size: 0.85rem;
}

.upload-summary-meta {
    font-size: 0.78rem;
    color: #6b7280;
}

.upload-summary-bar {
    height: 4px;
    background: #d8dce5;
    border-radius: 999px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.upload-summary-bar-fill {
    height: 100%;
    background: #93243f;
    border-radius: 999px;
    width: 0%;
    transition: width 0.2s;
}

.upload-summary-bar-fill.complete {
    background: #16a34a;
}

/* Tree row */
.tree-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.5rem;
    border-radius: 8px;
    font-size: 0.85rem;
    user-select: none;
}

.tree-row:hover {
    background: #f3f4f6;
}

.tree-row.folder {
    cursor: pointer;
    font-weight: 600;
    color: #292D32;
}

.tree-row.file {
    cursor: default;
}

.tree-caret {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    transition: transform 0.15s;
}

.tree-caret.expanded {
    transform: rotate(90deg);
}

.tree-caret svg {
    width: 14px;
    height: 14px;
}

.tree-icon {
    width: 22px;
    height: 28px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tree-icon.folder-icon {
    width: 22px;
    height: 22px;
    background: linear-gradient(180deg, #94a3b8, #64748b);
    box-shadow: 0 1px 2px rgba(71, 85, 105, 0.2), inset 0 1px 0 rgba(255,255,255,0.3);
    border-radius: 5px;
    color: #ffffff;
}

.tree-icon.folder-icon svg {
    width: 14px;
    height: auto;
}

/* File type badge — urmauur-inspired document card with corner banner */
.tree-badge {
    position: relative;
    width: 20px;
    height: 26px;
    flex-shrink: 0;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 3px;
    padding: 2px 2px;
    display: flex;
    flex-direction: column;
    gap: 1px;
    margin-right: 4px; /* room for the banner that overhangs */
}

.tree-badge-line {
    height: 1px;
    background: rgba(0,0,0,0.08);
    border-radius: 1px;
}

.tree-badge-line.bold {
    background: rgba(0,0,0,0.18);
}

.tree-badge-banner {
    position: absolute;
    right: -4px;
    bottom: 2px;
    font-size: 0.34rem;
    font-weight: 700;
    color: #ffffff;
    text-transform: uppercase;
    padding: 1px 2px;
    border-radius: 2px;
    letter-spacing: 0.02em;
    line-height: 1.2;
    box-shadow: 0 1px 1px rgba(0,0,0,0.1);
}

.tree-row-body {
    flex: 1;
    min-width: 0;
}

.tree-row-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tree-row-stats {
    font-size: 0.75rem;
    color: #6b7280;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.tree-row-action {
    width: 26px;
    height: 26px;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #9ca3af;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.15s;
}

.tree-row:hover .tree-row-action {
    opacity: 1;
}

.tree-row-action:hover {
    background: #e5e7eb;
    color: #dc2626;
}

.tree-row-action svg {
    width: 15px;
    height: 15px;
}

/* File state indicators in tree rows */
.tree-status {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.72rem;
}

.tree-status .spinner {
    width: 10px;
    height: 10px;
}

.tree-status.uploading { color: #93243f; }
.tree-status.done { color: #16a34a; }
.tree-status.error { color: #dc2626; }

.tree-mini-bar {
    width: 50px;
    height: 3px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
}

.tree-mini-bar-fill {
    height: 100%;
    background: #93243f;
    transition: width 0.2s;
}

/* Sticky upload bar */
.sticky-upload {
    margin-top: 1rem;
}

.clear-btn {
    font-size: 0.75rem;
    color: #cf222e;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.clear-btn:hover {
    background: rgba(207, 34, 46, 0.1);
}

.file-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem;
    background: #EEF1F7;
    border-radius: 12px;
    margin-bottom: 0.6rem;
    font-size: 0.85rem;
}

/* Colored file-type badge (PDF-style) */
.file-item-badge {
    width: 38px;
    height: 44px;
    flex-shrink: 0;
    background: #ef4444;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    color: #ffffff;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    box-shadow: 0 2px 4px rgba(0,0,0,0.06);
}

.file-item-badge::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 10px;
    height: 10px;
    background: #ffffff;
    clip-path: polygon(0 0, 100% 100%, 0 100%);
    opacity: 0.25;
}

/* Badge colors by file type */
.badge-pdf     { background: #dc2626; }
.badge-doc     { background: #3b82f6; }
.badge-data    { background: #10b981; }
.badge-img     { background: #0ea5e9; }
.badge-archive { background: #8b5cf6; }
.badge-video   { background: #f97316; }
.badge-default { background: #6b7280; }

.file-item-body {
    flex: 1;
    min-width: 0;
}

.file-item-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
    color: #292D32;
    font-size: 0.9rem;
    margin-bottom: 0.2rem;
}

.file-item-meta {
    font-size: 0.78rem;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.file-item-meta .dot {
    color: #d1d5db;
}

.file-item-status {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

/* Spinner for uploading */
.spinner {
    width: 12px;
    height: 12px;
    border: 1.5px solid #d1d5db;
    border-top-color: #93243f;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.check-icon {
    width: 14px;
    height: 14px;
    color: #16a34a;
    flex-shrink: 0;
}

.file-item-progress-bg {
    height: 5px;
    background: #d8dce5;
    border-radius: 999px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.file-item-progress {
    height: 100%;
    background: #93243f;
    border-radius: 999px;
    width: 0%;
    transition: width 0.2s;
}

.file-item.error .file-item-progress {
    background: #ef4444;
}

/* Cancel / delete action button */
.file-item-action {
    width: 28px;
    height: 28px;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #6b7280;
    flex-shrink: 0;
}

.file-item-action:hover {
    background: #e5e7eb;
    color: #292D32;
}

.file-item-action svg {
    width: 18px;
    height: 18px;
}

/* Upload button */
.upload-btn {
    width: 100%;
    padding: 0.75rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: #ffffff;
    background: #93243f;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.upload-btn:hover:not(:disabled) {
    background: #7a1d34;
}

.upload-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.upload-btn.ghost {
    background: #ffffff;
    color: #93243f;
    border: 1px solid #93243f;
}

.upload-btn.ghost:hover:not(:disabled) {
    background: #fdf2f5;
}

/* Progress */
.progress-wrap {
    margin-top: 1rem;
    display: none;
}

.progress-wrap.active {
    display: block;
}

.progress-bar-bg {
    width: 100%;
    height: 6px;
    background: #eaeef2;
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: #0969da;
    border-radius: 3px;
    transition: width 0.2s;
}

.progress-text {
    font-size: 0.8rem;
    color: #57606a;
    margin-top: 0.4rem;
    text-align: center;
}

/* Result */
.result {
    margin-top: 1.5rem;
    padding: 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    display: none;
}

.result.success {
    display: block;
    background: #dafbe1;
    border: 1px solid #2da44e;
    color: #1a7f37;
}

.result.error {
    display: block;
    background: #ffebe9;
    border: 1px solid #cf222e;
    color: #cf222e;
}

.result pre {
    white-space: pre-wrap;
    word-break: break-all;
    font-family: monospace;
    font-size: 0.8rem;
    margin-top: 0.5rem;
    color: #292D32;
}

/* Browse section */
.browse-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eef0f4;
    margin-bottom: 1rem;
}

.browse-header h2 {
    font-size: 1rem;
    font-weight: 600;
    color: #292D32;
}

/* Search + sort toolbar */
.datasets-toolbar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.search-wrap {
    flex: 1;
    position: relative;
}

.search-wrap svg {
    position: absolute;
    left: 0.65rem;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    color: #A9ACB4;
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 0.5rem 0.75rem 0.5rem 2rem;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    color: #292D32;
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.search-input:focus {
    border-color: #93243f;
    box-shadow: 0 0 0 3px rgba(147, 36, 63, 0.1);
}

.search-input::placeholder {
    color: #A9ACB4;
    font-size: 0.8rem;
}

/* Custom sort dropdown */
.sort-wrap {
    position: relative;
}

.sort-button {
    padding: 0.5rem 2.1rem 0.5rem 0.75rem;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.8rem;
    color: #292D32;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    transition: border-color 0.15s, box-shadow 0.15s;
    position: relative;
    min-width: 140px;
    text-align: left;
}

.sort-button:hover {
    border-color: #9ca3af;
}

.sort-wrap.open .sort-button {
    border-color: #93243f;
    box-shadow: 0 0 0 3px rgba(147, 36, 63, 0.1);
}

.sort-button::after {
    content: '';
    position: absolute;
    right: 0.75rem;
    top: 50%;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid #6b7280;
    transform: translateY(-50%);
    transition: transform 0.15s;
}

.sort-wrap.open .sort-button::after {
    transform: translateY(-50%) rotate(180deg);
}

.sort-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 170px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    padding: 4px;
    z-index: 100;
    display: none;
}

.sort-wrap.open .sort-menu {
    display: block;
}

.sort-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.45rem 0.75rem;
    border-radius: 6px;
    font-size: 0.82rem;
    color: #292D32;
    cursor: pointer;
    white-space: nowrap;
}

.sort-option:hover {
    background: #f3f4f6;
}

.sort-option.selected {
    color: #93243f;
    font-weight: 600;
}

.sort-option.selected::after {
    content: '✓';
    margin-left: 0.75rem;
    font-size: 0.85rem;
}

.dataset-list {
    max-height: calc(100vh - 160px);
    overflow-y: auto;
    padding-right: 0.25rem;
}

.dataset-card {
    position: relative;
    background: #ffffff;
    border: 1px solid #eef0f4;
    border-radius: 12px;
    padding: 0.85rem;
    margin-bottom: 0.6rem;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
    cursor: pointer;
    overflow: hidden;
}

.dataset-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.06);
    border-color: #d8dce5;
}

.dataset-card.selected {
    border-color: #93243f;
    background: #fdf2f5;
}

.dataset-card.selected::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: #93243f;
}

.dataset-card.empty {
    background: #ffffff;
    border: 1px dashed #d8dce5;
}

.dataset-card.empty .dataset-card-name {
    color: #6b7280;
}

.dataset-card-row {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.dataset-card-icon {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    background: linear-gradient(180deg, #b83d5e, #93243f);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(147, 36, 63, 0.2), inset 0 1px 0 rgba(255,255,255,0.25);
}

.dataset-card.empty .dataset-card-icon {
    background: #f3f4f6;
    color: #A9ACB4;
    box-shadow: none;
}

.dataset-card-icon svg {
    width: 20px;
    height: auto;
}

.dataset-card-info {
    flex: 1;
    min-width: 0;
}

.dataset-card-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
}

.dataset-card-stats-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: #f3f4f6;
    color: #4b5563;
    font-size: 0.7rem;
    font-weight: 500;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    flex-shrink: 0;
}

.dataset-card-meta {
    font-size: 0.72rem;
    color: #A9ACB4;
    margin-top: 0.35rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.dataset-card-meta .dot {
    color: #d1d5db;
}

.dataset-caret {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    color: #A9ACB4;
    transition: transform 0.15s;
}

.dataset-caret.expanded {
    transform: rotate(90deg);
}

.dataset-delete-btn {
    width: 26px;
    height: 26px;
    border: none;
    background: none;
    color: #A9ACB4;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s, color 0.15s;
    align-self: flex-start;
}

.dataset-card.selected .dataset-delete-btn {
    opacity: 0.6;
}

.dataset-card:hover .dataset-delete-btn {
    opacity: 1;
}

.dataset-delete-btn:hover {
    background: #fee2e2;
    color: #dc2626;
}

.dataset-delete-btn svg {
    width: 14px;
    height: 14px;
}

.dataset-detail {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #d8dce5;
}

.session-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.25rem;
    font-size: 0.8rem;
    border-radius: 6px;
}

.session-row:hover {
    background: rgba(255,255,255,0.5);
}

.session-row-name {
    font-weight: 500;
    color: #292D32;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.session-row-stats {
    font-size: 0.72rem;
    color: #6b7280;
    flex-shrink: 0;
}

.session-delete-btn {
    width: 22px;
    height: 22px;
    border: none;
    background: none;
    color: #A9ACB4;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: 0;
}

.session-row:hover .session-delete-btn {
    opacity: 1;
}

.session-delete-btn:hover {
    background: #fee2e2;
    color: #dc2626;
}

.session-delete-btn svg {
    width: 13px;
    height: 13px;
}

.file-link {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.75rem 0.25rem 1.75rem;
    font-size: 0.76rem;
    color: #4b5563;
    text-decoration: none;
    border-radius: 4px;
}

.file-link:hover {
    background: rgba(255,255,255,0.6);
    color: #292D32;
}

.file-link-name {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-link-size {
    font-size: 0.7rem;
    color: #A9ACB4;
    flex-shrink: 0;
}

.dataset-card-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: #292D32;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dataset-card-stats {
    font-size: 0.75rem;
    color: #6b7280;
    flex-shrink: 0;
    white-space: nowrap;
    margin-left: 0.5rem;
}

.session-tag {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    background: #ffffff;
    border-radius: 12px;
    font-size: 0.7rem;
    color: #4b5563;
    margin: 0.15rem 0.2rem 0.15rem 0;
    font-weight: 500;
}

.empty-state {
    text-align: center;
    color: #A9ACB4;
    padding: 2rem;
    font-size: 0.9rem;
    grid-column: 1 / -1; /* span all columns of a grid parent */
}

.refresh-btn {
    font-size: 0.8rem;
    font-weight: 500;
    color: #292D32;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    padding: 0.4rem 0.85rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.refresh-btn:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.refresh-btn svg {
    width: 14px;
    height: auto;
    color: #6b7280;
}

.refresh-btn.icon-only {
    padding: 0;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.refresh-btn.icon-only svg {
    width: 16px;
    height: 16px;
    color: #6b7280;
    display: block;
}

.refresh-btn.icon-only.spinning svg {
    animation: spin-once 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes spin-once {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
