/* ============================================================
   Layout
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

/* Auto-grow summary textareas so long AI summaries are readable
   without nested scrolling. Falls back to the `rows` attribute
   in browsers that don't support field-sizing (<Chrome 123). */
.summary-textarea {
    field-sizing: content;
    min-height: 8rem;
    max-height: 60vh;
    resize: vertical;
    line-height: 1.5;
}

body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #f0f2f5;
}
/* Dashboard pages run app-shell flex; lock viewport so the sidebar
   and main content scroll independently. Other pages scroll naturally. */
body[data-page="review"],
body[data-page="scraper"] {
    overflow: hidden;
    height: 100vh;
}

#app, .dashboard-shell {
    display: flex;
    height: calc(100vh - 48px); /* viewport minus .topnav */
    overflow: hidden;
}

/* ============================================================
   Top navigation (shared across all pages)
   ============================================================ */
.topnav {
    height: 48px;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    padding: 0 1.25rem;
    box-shadow: 0 1px 2px rgba(15,23,42,0.04);
    flex-shrink: 0;
}
.topnav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: #1e293b;
    margin-right: 0.4rem;
}
.topnav-brand-mark { font-size: 1.05rem; line-height: 1; }
.topnav-brand-name {
    font-weight: 700;
    font-size: 0.92rem;
    letter-spacing: -0.01em;
}
.topnav-links {
    display: flex;
    align-items: center;
    gap: 0.15rem;
}
.topnav-links a {
    padding: 0.35rem 0.85rem;
    border-radius: 6px;
    color: #64748b;
    text-decoration: none;
    font-size: 0.83rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}
.topnav-links a:hover { background: #f1f5f9; color: #1e293b; }
.topnav-links a.active {
    background: #eef2ff;
    color: #4361ee;
}
.topnav-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* ============================================================
   Sidebar
   ============================================================ */
#sidebar {
    width: 340px;
    min-width: 340px;
    height: 100%;
    background: #0f172a;
    color: #dde3f0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
}

#sidebar-top {
    flex-shrink: 0;
    padding: 0.8rem 0.9rem 0.5rem;
}

#video-list-wrapper {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 0 0.9rem 0.9rem;
}

#sidebar::-webkit-scrollbar { width: 3px; }
#sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.sidebar-section { margin-bottom: 0.4rem; }

.sidebar-divider {
    border: none;
    border-top: 1px solid rgba(255,255,255,0.06);
    margin: 0.4rem 0;
}

.sidebar-btn {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    width: 100%;
    padding: 0.45rem 0.7rem;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.04);
    color: #94a3b8;
    font-size: 0.88rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    margin-bottom: 3px;
    transition: all 0.15s;
}
.sidebar-btn:hover { background: rgba(255,255,255,0.09); color: #e2e8f0; border-color: rgba(255,255,255,0.14); }
.sidebar-btn.primary {
    background: linear-gradient(135deg, #4361ee, #3a0ca3);
    border-color: transparent;
    color: white;
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(67,97,238,0.35);
}
.sidebar-btn.primary:hover { opacity: 0.9; }

.sidebar-input {
    width: 100%;
    padding: 0.45rem 0.7rem;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    color: #e2e8f0;
    font-size: 0.88rem;
    margin-bottom: 6px;
    outline: none;
    transition: border-color 0.15s, background 0.15s;
}
.sidebar-input:focus { border-color: #4361ee; background: rgba(255,255,255,0.09); }
.sidebar-input::placeholder { color: #475569; }
.sidebar-input option { background: #0f172a; color: white; }

.sidebar-details {
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 6px;
    margin-bottom: 3px;
    overflow: hidden;
}
.sidebar-details summary {
    color: #94a3b8;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0.4rem 0.7rem;
    list-style: none;
    user-select: none;
    background: rgba(255,255,255,0.03);
    transition: background 0.15s;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.sidebar-details summary:hover { background: rgba(255,255,255,0.07); color: #e2e8f0; }
.sidebar-details summary::after { content: '›'; margin-left: auto; font-size: 1rem; transition: transform 0.2s; }
.sidebar-details[open] summary::after { transform: rotate(90deg); }
.sidebar-details .details-body { padding: 0.6rem 0.7rem 0.5rem; }

/* Video nav list */
.annot-tab-toggle {
    display: flex;
    gap: 0;
    margin-bottom: 6px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.1);
}
.annot-tab-btn {
    flex: 1;
    padding: 5px 0;
    font-size: 0.75rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all .15s;
    background: rgba(255,255,255,0.04);
    color: #8899bb;
}
.annot-tab-btn.active {
    background: linear-gradient(135deg, #4361ee, #3a0ca3);
    color: white;
}
.annot-tab-btn:hover:not(.active) { background: rgba(255,255,255,0.09); color: #e2e8f0; }

/* Video scraper listing controls (View / Sort dropdowns + stub empty state) */
.scraper-ctl-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 4px;
}
.scraper-ctl-row label {
    flex: 0 0 38px;
    font-size: 0.7rem;
    color: #8899bb;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
    margin: 0;
}
.scraper-ctl-row .scraper-select {
    flex: 1;
    margin-bottom: 0;
    padding-right: 1.6rem;
}
.scraper-filter { margin: 6px 0 8px; }

.video-list-stub {
    padding: 18px 12px;
    margin-top: 6px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 6px;
    color: #94a3b8;
    font-size: 0.82rem;
    line-height: 1.5;
    text-align: center;
}

/* Compact metric strip (replaces stacked metric boxes) */
.metric-strip {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 6px;
    padding: 7px 10px;
    margin-bottom: 8px;
    font-size: 0.78rem;
    color: #cbd5e1;
}
.metric-strip b { color: #fff; font-weight: 600; }
.metric-strip .metric-dot { color: #475569; }
.metric-reload {
    margin-left: auto;
    width: 22px;
    height: 22px;
    border: none;
    background: transparent;
    color: #8899bb;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}
.metric-reload:hover { background: rgba(255,255,255,0.08); color: #fff; }

/* Review-mode search bar (find an annotated link to re-edit) */
.review-search {
    margin: 6px 0 8px;
    padding: 8px 0 4px;
    border-top: 1px solid rgba(255,255,255,0.06);
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
/* Review-mode instructions block */
.sidebar-instructions { margin-top: 6px; }
.sidebar-instructions .muted-tag {
    font-size: 0.7rem;
    color: #8899bb;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
    margin-bottom: 4px;
}
.sidebar-instructions ol {
    font-size: 0.78rem;
    color: #aab4cc;
    padding-left: 1.1rem;
    margin: 0;
    line-height: 1.5;
}

#video-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-right: 2px;
}
#video-list::-webkit-scrollbar { width: 3px; }
#video-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }
#video-list::-webkit-scrollbar { width: 3px; }
#video-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.nav-video-btn {
    display: block;
    width: 100%;
    padding: 0.45rem 0.65rem;
    border-radius: 5px;
    border: none;
    background: transparent;
    color: #64748b;
    font-size: 0.88rem;
    text-align: left;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 1px;
    transition: all 0.13s;
    line-height: 1.4;
}
.nav-video-btn:hover { background: rgba(255,255,255,0.07); color: #cbd5e1; }
.nav-video-btn.active {
    background: rgba(67,97,238,0.2);
    color: #93b4ff;
    border-left: 2px solid #4361ee;
    padding-left: calc(0.55rem - 2px);
}

/* ============================================================
   Main area
   ============================================================ */
#main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* .topbar-btn is still used inside the topnav's #topbar-actions zone
   (Guidelines / Hints / Class Distribution on the scraper page). */
.topbar-btn {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.75rem;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #475569;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.topbar-btn:hover { background: #eef2ff; color: #4361ee; border-color: #c7d2fe; }

#main-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem 1.5rem;
}

/* ============================================================
   Cards
   ============================================================ */
.card {
    background: white;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    padding: 1.1rem;
    margin-bottom: 1rem;
}

/* ============================================================
   YouTube player
   ============================================================ */
#yt-player-container {
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}
#yt-player-container iframe {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

/* ============================================================
   TikTok player
   ============================================================ */
.tt-player-container {
    width: 100%;
    max-width: 340px;
    aspect-ratio: 9 / 16;
    margin: 0 auto 0.5rem;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.tt-player-container .tt-player-frame {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}
.tt-player-loading {
    padding: 1rem;
    text-align: center;
}

/* ============================================================
   Screenshot controls
   ============================================================ */
.screenshot-bar {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.screenshot-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.42rem 0.9rem;
    background: linear-gradient(135deg, #4361ee, #7209b7);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.15s;
}
.screenshot-btn:hover { opacity: 0.88; }
.screenshot-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.ts-live {
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    background: #eef2ff;
    color: #4361ee;
    padding: 0.3rem 0.6rem;
    border-radius: 5px;
    min-width: 52px;
    text-align: center;
}

/* ============================================================
   Screenshot gallery
   ============================================================ */
.screenshot-gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.ss-item {
    position: relative;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}
.ss-item img {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    display: block;
}
.ss-item .ss-label {
    background: rgba(0,0,0,0.55);
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
}
.ss-saved-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.ss-saved-item .ss-caption {
    font-size: 0.8rem;
    color: #333;
    padding: 2px 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: #f0f0f0;
    border-radius: 4px;
}
.ss-item .ss-discard {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(220,38,38,0.85);
    border: none;
    color: white;
    font-size: 0.7rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.ss-item .ss-discard:hover { background: rgba(220,38,38,1); }

/* ============================================================
   Loading overlay
   ============================================================ */
#loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9000;
}
.loading-box {
    background: white;
    border-radius: 10px;
    padding: 2rem 2.5rem;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    min-width: 180px;
}

/* ============================================================
   Misc utilities
   ============================================================ */
.info-row { font-size: 0.82rem; color: #64748b; margin-bottom: 3px; }
.info-row strong { color: #334155; }

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 60vh;
    color: #94a3b8;
    text-align: center;
    gap: 0.5rem;
}
.empty-state h4 { color: #475569; }

details summary { cursor: pointer; user-select: none; }
details summary::-webkit-details-marker { display: none; }

.section-divider {
    border: none;
    border-top: 1px solid #e2e8f0;
    margin: 0.75rem 0;
}

/* Staged screenshot item */
.ss-staged {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 7px;
    padding: 0.5rem;
}

/* Annotation status badges */
.badge-safe     { background: #dcfce7; color: #166534; border-radius: 999px; padding: 2px 8px; font-size: 0.75rem; font-weight: 600; }
.badge-harmful  { background: #fee2e2; color: #991b1b; border-radius: 999px; padding: 2px 8px; font-size: 0.75rem; font-weight: 600; }
.badge-pending  { background: #fef3c7; color: #92400e; border-radius: 999px; padding: 2px 8px; font-size: 0.75rem; font-weight: 600; }

/* ============================================================
   Home (landing page with 4 workflow cards)
   ============================================================ */
.home-shell {
    max-width: 1320px;
    margin: 0 auto;
    padding: 3rem 1.75rem 4rem;
}
.home-hero {
    text-align: center;
    margin-bottom: 2.5rem;
}
.home-hero h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #1e293b;
    letter-spacing: -0.02em;
    margin: 0 0 0.4rem;
}
.home-hero p {
    color: #64748b;
    font-size: 1rem;
    margin: 0;
}
.home-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.75rem;
}
@media (max-width: 1100px) { .home-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 720px)  { .home-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px)  { .home-grid { grid-template-columns: 1fr; } }

.home-card {
    aspect-ratio: 1 / 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    text-decoration: none;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 1.4rem 1.1rem;
    color: inherit;
    cursor: pointer;
    transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
    font-family: inherit;
    font-size: inherit;
}
.home-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(15,23,42,0.08);
    border-color: #c7d2fe;
}
.home-card-icon {
    font-size: 2rem;
    line-height: 1;
    margin-bottom: 0.55rem;
}
.home-card h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 0.4rem;
    letter-spacing: -0.01em;
}
.home-card p {
    font-size: 0.82rem;
    color: #64748b;
    line-height: 1.45;
    margin: 0;
    flex: 1;
    /* 3-line clamp keeps long descriptions from breaking the square */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.home-card-cta {
    font-size: 0.84rem;
    color: #4361ee;
    font-weight: 600;
    transition: transform 0.18s;
    margin-top: 0.7rem;
}
.home-card:hover .home-card-cta { transform: translateX(2px); }

/* ============================================================
   Class distribution modal — split totals + per-label stacked bars
   ============================================================ */
.splits-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.split-chip {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.45rem 0.65rem;
    font-size: 0.83rem;
}
.split-dot {
    width: 10px; height: 10px; border-radius: 50%;
    flex-shrink: 0;
}
.split-name {
    font-weight: 600;
    color: #1e293b;
    text-transform: lowercase;
}
.split-count {
    margin-left: auto;
    font-weight: 700;
    color: #1e293b;
}
.split-pct {
    color: #94a3b8;
    font-size: 0.78rem;
}

.dist-section-label {
    font-size: 0.72rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    margin: 1rem 0 0.5rem;
}

.dist-rows {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}
.dist-row {
    display: grid;
    grid-template-columns: 180px 1fr 70px 200px;
    align-items: center;
    gap: 0.85rem;
    font-size: 0.82rem;
}
.dist-label {
    color: #1e293b;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dist-bar-track {
    background: #f1f5f9;
    border-radius: 4px;
    overflow: hidden;
    height: 14px;
}
.dist-bar {
    display: flex;
    height: 100%;
    width: 100%; /* always fill the track; segments share by ratio */
}
.bar-seg {
    height: 100%;
    transition: filter 0.15s;
}
.bar-seg:hover { filter: brightness(1.15); }
.dist-total {
    font-variant-numeric: tabular-nums;
    text-align: right;
    color: #1e293b;
    font-weight: 700;
}
.dist-breakdown {
    font-size: 0.74rem;
    color: #94a3b8;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    text-align: right;
    letter-spacing: 0.01em;
}
.dist-breakdown .brk-new   { color: #64748b; }
.dist-breakdown .brk-train { color: #4361ee; }
.dist-breakdown .brk-valid { color: #10b981; }
.dist-breakdown .brk-test  { color: #d97706; }

/* ============================================================
   Link Dataset page (/dataset)
   ============================================================ */
.dataset-shell {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.5rem 1.75rem 3rem;
}
.dataset-header { margin-bottom: 1.25rem; }
.dataset-header h1 {
    font-size: 1.55rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 0.25rem;
}
.dataset-header p { margin: 0; }

.dataset-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.85rem;
}
.dataset-filters input:not([type="checkbox"]),
.dataset-filters select {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    color: #1e293b;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.dataset-filters input[type="text"],
.dataset-filters input[type="search"] { flex: 1; min-width: 220px; max-width: 360px; }
.dataset-filters select { min-width: 140px; }
.vo-wrap { position: relative; display: inline-block; }
.vo-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0 0.75rem 0 0.7rem;
    height: 34px;
    font-size: 0.85rem;
    color: #1e293b;
    cursor: pointer;
    min-width: 160px;
    text-align: left;
}
.vo-toggle:focus {
    outline: none;
    border-color: #4361ee;
    box-shadow: 0 0 0 3px rgba(67,97,238,0.1);
}
.vo-toggle-label { font-size: 0.78rem; color: #64748b; }
.vo-caret { margin-left: auto; font-size: 0.7rem; color: #94a3b8; }
.vo-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 1000;
    display: none;
    width: 180px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 6px 24px rgba(15,23,42,0.08);
    padding: 6px 0;
    box-sizing: border-box;
}
.vo-menu.open { display: block; }
/* Labels: plain block elements (no flex). Children are inline-block, vertical-aligned. */
.vo-menu label {
    display: block !important;
    padding: 7px 14px;
    margin: 0;
    font-size: 13px;
    color: #1e293b;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    text-align: left;
    line-height: 1.3;
}
.vo-menu label:hover { background: #f1f5f9; }
.vo-menu label input[type="checkbox"] {
    display: inline-block;
    vertical-align: middle;
    width: 14px;
    height: 14px;
    margin: 0 8px 0 0;
    padding: 0;
    cursor: pointer;
}
.vo-menu label span {
    display: inline-block;
    vertical-align: middle;
}

.ds-date-pair {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0 0.6rem 0 0.75rem;
}
.ds-date-pair .ds-date-label {
    font-size: 0.78rem;
    color: #64748b;
    white-space: nowrap;
}
.ds-date-pair input[type="date"] {
    border: none !important;
    padding: 0.4rem 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    min-width: 130px;
    font-size: 0.85rem;
}
.ds-date-pair:focus-within {
    border-color: #4361ee;
    box-shadow: 0 0 0 3px rgba(67,97,238,0.1);
}
.ds-date-hint {
    font-size: 0.78rem;
    color: #64748b;
    margin: -0.25rem 0 0.85rem;
}
.ds-date-hint code {
    font-size: 0.78rem;
    padding: 1px 6px;
}
.stats-date-hint {
    margin-left: auto;
}
.dataset-filters input:not([type="checkbox"]):focus,
.dataset-filters select:focus {
    border-color: #4361ee;
    box-shadow: 0 0 0 3px rgba(67,97,238,0.1);
}
.ds-count { margin-left: auto; }

.ds-table-shell {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(15,23,42,0.04);
    margin-bottom: 1rem;
}
.ds-table { margin: 0; font-size: 0.85rem; }
.ds-table th {
    background: #f8fafc;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94a3b8;
    border-bottom: 1px solid #e2e8f0 !important;
    padding: 0.65rem 0.9rem;
    white-space: nowrap;
}
.ds-table td {
    padding: 0.6rem 0.9rem;
    vertical-align: middle;
    border-color: #f1f5f9 !important;
}
.ds-row:hover td { background: #f8fafc; }
.ds-url a {
    color: #4361ee;
    text-decoration: none;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.78rem;
}
.ds-url a:hover { text-decoration: underline; }

.ds-badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: lowercase;
}
.ds-badge.badge-safe    { background: #dcfce7; color: #166534; }
.ds-badge.badge-harmful { background: #fee2e2; color: #991b1b; }

.ds-summary {
    max-width: 420px;
    color: #475569;
    line-height: 1.45;
}
.ds-summary.clickable { cursor: pointer; }
.ds-summary.clickable:hover { color: #1e293b; }

.ds-source {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.ds-source-review  { background: #eef2ff; color: #4338ca; }
.ds-source-scraper { background: #fef3c7; color: #92400e; }
.ds-source-both    { background: #ede9fe; color: #6b21a8; }

.ds-pagination {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    justify-content: center;
}
.ds-pagination button { font-variant-numeric: tabular-nums; }

.ds-source-list {
    list-style: disc;
    padding-left: 1.25rem;
    margin: 0;
    color: #1e293b;
    font-size: 0.85rem;
    line-height: 1.7;
}

/* Date filter row inside stats modals */
.stats-date-filter {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.85rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.83rem;
}
.stats-date-filter label {
    color: #64748b;
    font-weight: 500;
    margin: 0;
}
.stats-date-filter input[type="date"] {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 0.3rem 0.6rem;
    font-size: 0.83rem;
    color: #1e293b;
    outline: none;
}
.stats-date-filter input[type="date"]:focus {
    border-color: #4361ee;
    box-shadow: 0 0 0 3px rgba(67,97,238,0.1);
}

/* Stats modal — top blocks with source breakdown */
.ds-stats-legend {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
    font-size: 0.78rem;
    color: #64748b;
}
.ds-stats-legend .ds-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.ds-stats-legend .dot {
    width: 10px; height: 10px; border-radius: 50%;
}

.ds-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.65rem;
    margin-bottom: 0.5rem;
}
.ds-stat-block {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.6rem 0.75rem;
}
.ds-stat-top {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}
.ds-stat-top .split-name {
    font-weight: 600;
    color: #1e293b;
    text-transform: capitalize;
}
.ds-stat-count {
    margin-left: auto;
    font-weight: 700;
    font-size: 1.05rem;
    color: #1e293b;
    font-variant-numeric: tabular-nums;
}
.ds-mini-bar {
    display: flex;
    height: 8px;
    border-radius: 3px;
    overflow: hidden;
    background: #f1f5f9;
    margin-bottom: 0.35rem;
}
.ds-mini-bar .seg {
    height: 100%;
    transition: filter 0.15s;
}
.ds-mini-bar .seg:hover { filter: brightness(1.15); }
.ds-stat-breakdown {
    font-size: 0.74rem;
    color: #475569;
    font-variant-numeric: tabular-nums;
}

/* Pre-label modal stub hint */
.prelabel-stub {
    background: rgba(245,158,11,0.08);
    border: 1px solid rgba(245,158,11,0.25);
    border-radius: 6px;
    padding: 8px 12px;
    color: #92400e;
    font-size: 0.8rem;
    line-height: 1.45;
}
