/* Social Evidence Archive - Forensic Brand Theme */

:root {
    /* Color Palette - Midnight Slate Theme */
    --bg-primary: #0F172A;
    --bg-secondary: #1E293B;
    --bg-card: #1E293B;
    --bg-hover: #334155;
    --bg-input: #0F172A;
    
    --accent: #1D4ED8;
    --accent-hover: #2563EB;
    --accent-subtle: rgba(29, 78, 216, 0.1);
    --accent-cyan: #06B6D4;
    
    --success: #22c55e;
    --warning: #F59E0B;
    --danger: #ef4444;
    
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --border: #1e293b;
    --border-light: #334155;
    
    /* Typography */
    --font-heading: 'Public Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    
    /* Spacing */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    
    /* Radius */
    --radius-sm: 2px;
    --radius-md: 4px;
    --radius-lg: 4px;
    --radius-full: 9999px;
}

/* Light Mode */
body:not(.dark-mode) {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-hover: #f1f5f9;
    --bg-input: #f8fafc;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --border-light: #cbd5e1;
}

/* Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    touch-action: manipulation;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: none;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    width: 260px;
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 200;
    transition: transform 0.2s ease;
}

.sidebar.collapsed {
    transform: translateX(-100%);
}

.sidebar-header {
    padding: var(--space-5);
    border-bottom: 1px solid var(--border);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-logo img {
    height: 50px;
    width: auto;
}

/* Dark mode (default) - show dark logo */
.sidebar-logo .logo-dark { display: block; }
.sidebar-logo .logo-light { display: none; }

/* Light mode - show light logo */
body:not(.dark-mode) .sidebar-logo .logo-dark { display: none; }
body:not(.dark-mode) .sidebar-logo .logo-light { display: block; }

.sidebar-section {
    flex: 1;
    padding: var(--space-4);
    overflow-y: auto;
}

.sidebar-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-3);
    padding: 0 var(--space-2);
}

.sidebar-section-header span {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

/* Legacy small button (hidden) */
.btn-add-account {
    display: none;
}

/* Prominent Add Account button below account list */
.btn-add-account-prominent {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: calc(100% - var(--space-4));
    margin: var(--space-3) auto;
    padding: 10px 16px;
    background: var(--accent);
    border: 1.5px solid var(--accent);
    border-radius: var(--radius);
    color: #fff;
    font-size: 0.82rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-add-account-prominent:hover {
    background: var(--accent);
    border-color: var(--accent);
    border-style: solid;
    color: #fff;
    box-shadow: 0 2px 12px rgba(99, 102, 241, 0.35);
}

.btn-add-account-prominent svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.accounts-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.account-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s ease;
    border: 1px solid transparent;
    position: relative;
}

.account-item:hover {
    background: var(--bg-hover);
}

.account-item.active {
    background: var(--accent-subtle);
    border-color: var(--accent);
}

.btn-remove-account {
    position: absolute;
    right: var(--space-2);
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.15s ease;
}

.account-item:hover .btn-remove-account {
    opacity: 1;
}

.btn-remove-account:hover {
    background: var(--error);
    color: white;
}

/* Account item processing state */
.account-item.processing {
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.08);
}

.account-job-indicator {
    position: absolute;
    right: var(--space-3);
    top: 50%;
    transform: translateY(-50%);
}

.mini-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.job-progress-inline {
    color: var(--accent);
    font-weight: 600;
}

.btn-remove-account svg {
    width: 14px;
    height: 14px;
}

.account-avatar {
    display: none;
}

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

.account-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.account-handle {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.account-stats {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.demo-tag {
    display: inline-block;
    background: linear-gradient(135deg, #1D4ED8, #06B6D4);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
    letter-spacing: 0.5px;
    margin-right: 5px;
    vertical-align: middle;
    line-height: 1.4;
}

.account-item.demo-account {
    border-color: rgba(99, 102, 241, 0.2);
    background: rgba(99, 102, 241, 0.03);
}

.sidebar-footer {
    padding: var(--space-4);
    border-top: 1px solid var(--border);
}

.sidebar-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.sidebar-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.sidebar-btn svg {
    width: 18px;
    height: 18px;
}

/* ============================================
   MAIN WRAPPER
   ============================================ */
.main-wrapper {
    flex: 1;
    margin-left: 260px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.2s ease;
}

/* Collapsed sidebar state */
body.sidebar-collapsed .sidebar {
    transform: translateX(-260px);
}

body.sidebar-collapsed .main-wrapper {
    margin-left: 0;
}

/* ============================================
   MAIN HEADER
   ============================================ */
.main-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: var(--space-4) var(--space-6);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 950;
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.btn-menu {
    display: none;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
}

.btn-menu svg {
    width: 20px;
    height: 20px;
}

.current-account h1 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.current-account span {
    font-size: 0.875rem;
    color: var(--accent);
}

#account-profile-url:hover {
    text-decoration: underline;
    color: var(--accent);
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

/* ============================================
   HEADER
   ============================================ */
.archive-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: var(--space-4) var(--space-6);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1800px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-6);
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-cyan) 100%);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-icon svg {
    width: 20px;
    height: 20px;
    color: white;
}

.logo-text h1 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.logo-text span {
    font-size: 0.8rem;
    color: var(--accent);
    font-weight: 500;
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

/* View Options */
.view-options {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    background: var(--bg-secondary);
    padding: var(--space-1);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.btn-view-size {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-view-size:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-view-size.active {
    background: var(--accent);
    color: white;
}

.btn-view-size svg {
    width: 16px;
    height: 16px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.btn svg {
    width: 16px;
    height: 16px;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-light);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #16a34a;
}

.last-updated-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.auto-update-toggle {
    display: none;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
    user-select: none;
}
.auto-update-toggle.visible { display: inline-flex; }
.auto-update-toggle input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: #22c55e;
    cursor: pointer;
    margin: 0;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
}

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

/* ============================================
   STATS BAR
   ============================================ */
.stats-bar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: var(--space-4) var(--space-6);
}

.stats-grid {
    max-width: 1800px;
    margin: 0 auto;
    display: flex;
    gap: var(--space-8);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ============================================
   CONTROLS
   ============================================ */
.controls {
    background: var(--bg-primary);
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--border);
}

.controls-inner {
    max-width: 1800px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: var(--space-4);
    flex-wrap: wrap;
}

/* Search */
.search-box {
    flex: 1;
    min-width: 280px;
    max-width: 460px;
    position: relative;
}

.search-box svg {
    position: absolute;
    left: var(--space-3);
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    pointer-events: none;
}

.search-box > input {
    width: 100%;
    padding: var(--space-3) 90px var(--space-3) 40px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: all 0.15s ease;
}

.search-box > input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

.search-box > input::placeholder {
    color: var(--text-muted);
}

.search-comments-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    font-size: 0.7rem;
    color: var(--text-muted);
    user-select: none;
    white-space: nowrap;
}

.search-comments-toggle input {
    width: 13px;
    height: 13px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--accent);
}

.search-comments-toggle span {
    opacity: 0.7;
}

.search-comments-toggle:hover span {
    opacity: 1;
    color: var(--text-primary);
}

/* Filters */
.filters {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.filter-group label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.date-range {
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.date-range input {
    padding: var(--space-2) var(--space-3);
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: var(--font-sans);
    width: 130px;
}

.date-range input:focus {
    outline: none;
}

.date-range input::-webkit-calendar-picker-indicator {
    filter: invert(0.5);
    cursor: pointer;
}

.date-range .separator {
    color: var(--text-muted);
    font-size: 0.75rem;
    padding: 0 var(--space-1);
}

/* Select */
.select-wrapper {
    position: relative;
}

.select-wrapper select {
    appearance: none;
    padding: var(--space-2) var(--space-8) var(--space-2) var(--space-3);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: var(--font-sans);
    cursor: pointer;
    min-width: 150px;
}

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

.select-wrapper::after {
    content: '';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-top-color: var(--text-muted);
    pointer-events: none;
}

/* Actions */
.controls-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-left: auto;
}

/* ============================================
   RESULTS BAR
   ============================================ */
.results-bar {
    padding: var(--space-3) var(--space-6);
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 1800px;
    margin: 0 auto;
    box-sizing: border-box;
}

.results-count {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.results-count strong {
    color: var(--text-primary);
}

/* ============================================
   VIDEO GRID
   ============================================ */
.video-grid {
    max-width: 100%;
    margin: 0 auto;
    padding: var(--space-4) var(--space-6) var(--space-10);
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-5);
    overflow-x: hidden;
}

/* Grid size variants */
.video-grid.grid-large {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

.video-grid.grid-medium {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.video-grid.grid-small {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.video-grid.grid-small .video-card .video-meta {
    padding: var(--space-2);
}

.video-grid.grid-small .video-card .video-filename {
    font-size: 0.7rem;
}

.video-grid.grid-small .video-card .video-date,
.video-grid.grid-small .video-card .video-caption {
    font-size: 0.7rem;
}

.video-grid.grid-small .video-card .video-actions {
    gap: var(--space-1);
    flex-wrap: wrap;
}

.video-grid.grid-small .video-card .video-actions .btn {
    padding: var(--space-1) var(--space-2);
    font-size: 0.65rem;
}

/* ============================================
   VIDEO CARD
   ============================================ */
.video-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.2s ease;
    position: relative;
}

/* Checkbox overlay on thumbnail */
.video-card .card-select-overlay {
    position: absolute;
    top: var(--space-2);
    left: var(--space-2);
    z-index: 10;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.video-card:hover .card-select-overlay,
.video-card.selected .card-select-overlay {
    opacity: 1;
}

.video-card .card-select-overlay input[type="checkbox"] {
    width: 22px;
    height: 22px;
    accent-color: var(--accent);
    cursor: pointer;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.video-card:hover {
    border-color: var(--border-light);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.video-card.selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

/* Video Wrapper */
.video-wrapper {
    position: relative;
    aspect-ratio: 9/16;
    background: var(--bg-primary);
    cursor: pointer;
    overflow: hidden;
}

.video-wrapper img,
.video-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-wrapper video {
    background: #000;
}

.play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.video-wrapper:hover .play-overlay {
    opacity: 1;
}

.play-overlay svg {
    width: 56px;
    height: 56px;
    color: white;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}

.corrupted-notice {
    position: absolute;
    top: var(--space-2);
    right: var(--space-2);
    background: var(--warning);
    color: white;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 600;
    display: none;
}

.video-wrapper.no-thumb .corrupted-notice {
    display: block;
}

/* Card Body */
.card-body {
    padding: var(--space-4);
}

.card-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.filename {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    word-break: break-all;
}

/* Checkbox is now in overlay - see .card-select-overlay */

.posted-date {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-3);
}

.caption {
    font-size: 0.875rem;
    color: var(--text-primary);
    line-height: 1.5;
    margin-bottom: var(--space-3);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.caption.expanded {
    -webkit-line-clamp: unset;
}

.caption-toggle {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0;
    margin-bottom: var(--space-3);
}

.caption-toggle:hover {
    text-decoration: underline;
}

/* Metrics */
.metrics {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}

.metric {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.metric-icon {
    font-size: 0.85rem;
}

/* Hashtags */
.hashtags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    margin-bottom: var(--space-3);
}

.hashtag {
    font-size: 0.75rem;
    color: var(--accent);
    background: var(--accent-subtle);
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

/* Music Info */
.music-info {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: var(--space-3);
}

.music-info svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* Technical Details */
.tech-toggle {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    padding: var(--space-2) 0;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    width: 100%;
}

.tech-toggle:hover {
    color: var(--text-secondary);
}

.tech-content {
    display: none;
    padding: var(--space-3);
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    margin-top: var(--space-2);
    font-size: 0.75rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
}

.tech-content.visible {
    display: block;
}

.tech-content div {
    padding: var(--space-1) 0;
    border-bottom: 1px solid var(--border);
}

.tech-content div:last-child {
    border-bottom: none;
}

.tech-content strong {
    color: var(--text-secondary);
}

/* Card Actions */
.card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    background: var(--bg-primary);
    border-top: 1px solid var(--border);
}

.card-actions .btn {
    flex: 1;
    min-width: fit-content;
    padding: var(--space-2) var(--space-3);
    font-size: 0.75rem;
}

/* Transcript Button */
.btn-transcript {
    background: var(--accent-subtle);
    color: var(--accent);
    border: 1px solid transparent;
}

.btn-transcript:hover {
    background: var(--accent);
    color: white;
}

.btn-transcript.no-transcript {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-transcript.no-transcript:hover {
    background: var(--accent-subtle);
    color: var(--accent);
}

/* ============================================
   MODALS
   ============================================ */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-6);
    z-index: 1000;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    max-width: 600px;
    width: 100%;
    max-height: 85vh;
    overflow: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    position: relative;
}

.modal-close {
    position: absolute;
    top: var(--space-4);
    right: var(--space-4);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-hover);
    border: none;
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    z-index: 10;
}

.modal-close:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.modal-header {
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.modal-header h2 svg {
    width: 24px;
    height: 24px;
    color: var(--accent);
}

.modal-body {
    padding: var(--space-5) var(--space-6);
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
}

/* Update Modal */
.update-status {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    margin-bottom: var(--space-4);
}

.update-status p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.update-status-success {
    color: var(--success) !important;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.update-log {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    max-height: 250px;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    line-height: 1.6;
}

.update-log p {
    color: var(--text-muted);
    margin: 0;
}

/* Progress Bar */
.update-progress {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    margin-bottom: var(--space-4);
}

.progress-bar {
    height: 8px;
    background: var(--bg-primary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: var(--space-2);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-cyan));
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-text {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

#progress-step {
    color: var(--text-primary);
}

#progress-percent {
    color: var(--accent);
    font-weight: 600;
}

.progress-videos {
    text-align: center;
    margin-top: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

#progress-video-count {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
}

.progress-eta {
    text-align: center;
    margin-top: var(--space-2);
}

#progress-eta-text {
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* Sidebar Jobs Indicator */
.sidebar-jobs {
    border-top: 1px solid var(--border);
    padding-top: var(--space-3);
    margin-top: var(--space-3);
}

.jobs-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.job-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
}

.job-item .job-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.job-item .job-queued {
    width: 8px;
    height: 8px;
    background: var(--warning);
    border-radius: 50%;
}

.job-item .job-username {
    flex: 1;
    color: var(--text-primary);
    font-weight: 500;
}

.job-item .job-progress {
    color: var(--accent);
    font-weight: 600;
}

.job-item.processing {
    border: 1px solid var(--accent);
    background: rgba(99, 102, 241, 0.05);
}

.job-item.queued {
    opacity: 0.7;
}

/* Transcript Modal */
.transcript-modal-content {
    max-width: 700px;
}

.transcript-video-info {
    background: var(--bg-card);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-4);
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.transcript-search input {
    width: 100%;
    padding: var(--space-3);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.875rem;
    margin-bottom: var(--space-4);
}

.transcript-search input:focus {
    outline: none;
    border-color: var(--accent);
}

.transcript-content {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    max-height: 350px;
    overflow-y: auto;
    font-size: 0.9rem;
    line-height: 1.8;
}

.transcript-content .no-transcript {
    color: var(--text-muted);
    text-align: center;
    padding: var(--space-8);
}

.transcript-content .segment {
    padding: var(--space-2) 0 var(--space-2) var(--space-3);
    border-left: 2px solid var(--border);
    margin-bottom: var(--space-3);
}

.transcript-content .segment:hover {
    border-left-color: var(--accent);
}

.transcript-content .segment-time {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
}

.transcript-content .highlight {
    background: var(--warning);
    color: var(--bg-primary);
    padding: 1px 4px;
    border-radius: 2px;
}

/* ============================================
   TOAST
   ============================================ */
.toast-container {
    position: fixed;
    bottom: var(--space-6);
    right: var(--space-6);
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.toast {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-4);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    animation: slideIn 0.3s ease;
    font-size: 0.875rem;
}

.toast.success {
    border-left: 3px solid var(--success);
}

.toast.error {
    border-left: 3px solid var(--danger);
}

.toast.warning {
    border-left: 3px solid var(--warning);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ============================================
   STATES
   ============================================ */
.loading-state {
    position: relative;
    min-height: 400px;
}

.skeleton-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-5);
    padding: var(--space-4) var(--space-6);
    width: 100%;
}

.skeleton-grid.grid-large { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.skeleton-grid.grid-medium { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.skeleton-grid.grid-small { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }

.skeleton-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    opacity: 0.6;
}

.skeleton-thumb {
    width: 100%;
    aspect-ratio: 9/16;
    max-height: 280px;
    background: var(--bg-tertiary);
    position: relative;
    overflow: hidden;
}

.skeleton-thumb::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.04) 40%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 60%, transparent 100%);
    animation: shimmer 1.8s ease-in-out infinite;
}

.skeleton-meta {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.skeleton-line {
    height: 10px;
    border-radius: 4px;
    background: var(--bg-tertiary);
    position: relative;
    overflow: hidden;
}

.skeleton-line::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.06) 50%, transparent 100%);
    animation: shimmer 1.8s ease-in-out infinite;
}

.skeleton-line.w-60 { width: 60%; }
.skeleton-line.w-40 { width: 40%; }
.skeleton-line.w-80 { width: 80%; }

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.load-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(10,15,26, 0.7);
    backdrop-filter: blur(2px);
    z-index: 1000;
}

.error-state,
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-10);
    text-align: center;
    color: var(--text-muted);
    min-height: 400px;
}

.empty-state-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 400px;
}

.empty-state-content h2 {
    color: var(--text-primary);
    margin-bottom: var(--space-3);
    font-size: 1.5rem;
}

.empty-state-content p {
    margin-bottom: var(--space-6);
    line-height: 1.6;
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-full);
    background: var(--accent-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-6);
}

.empty-state-icon svg {
    width: 40px;
    height: 40px;
    color: var(--accent);
    opacity: 1;
    margin-bottom: 0;
}

.btn-large {
    padding: var(--space-4) var(--space-6);
    font-size: 1rem;
    gap: var(--space-3);
}

.btn-large svg {
    width: 20px;
    height: 20px;
}

/* Welcome screen for first-time users */
.welcome-content {
    max-width: 480px;
}

.welcome-content h2 {
    font-size: 1.75rem;
    margin-bottom: var(--space-4);
}

.welcome-content p {
    font-size: 1.05rem;
    line-height: 1.7;
    margin-bottom: var(--space-6);
}

.welcome-icon {
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
}

.welcome-icon svg {
    width: 48px;
    height: 48px;
    color: white;
}

/* Welcome CTA Button */
.btn-welcome-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-8);
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}

.btn-welcome-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

.btn-welcome-cta:active {
    transform: translateY(0);
}

.btn-welcome-cta .btn-icon {
    font-size: 1.4rem;
    font-weight: 300;
    line-height: 1;
}

.loading-state svg,
.error-state svg,
.empty-state > svg {
    width: 64px;
    height: 64px;
    margin-bottom: var(--space-4);
    opacity: 0.5;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: var(--space-4);
}

.load-progress-wrap {
    width: 260px;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 12px;
}

.load-progress-bar {
    height: 100%;
    width: 0%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.15s linear;
}

.load-progress-pct {
    font-size: 0.75rem;
    color: var(--text-muted);
    opacity: 0.6;
    margin-top: 4px;
}

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

/* ============================================
   FOOTER
   ============================================ */
.archive-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: var(--space-6);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* ============================================
   BATCH BAR
   ============================================ */
.batch-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: var(--space-4) var(--space-6);
    z-index: 90;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.1);
}

.batch-content {
    max-width: 1800px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-4);
}

#batch-count {
    font-weight: 600;
    color: var(--text-primary);
}

/* ============================================
   THEME TOGGLE
   ============================================ */
.dark-mode .icon-sun { display: block; }
.dark-mode .icon-moon { display: none; }
body:not(.dark-mode) .icon-sun { display: none; }
body:not(.dark-mode) .icon-moon { display: block; }
body:not(.dark-mode) .load-overlay { background: rgba(248,250,252, 0.7); }

/* Form Elements */
.form-group {
    margin-bottom: var(--space-5);
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.form-group input {
    width: 100%;
    padding: var(--space-3);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

.form-group small {
    display: block;
    margin-top: var(--space-2);
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Select All Label */
.select-all-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Video Modal Content */
.modal-video-content {
    max-width: 1000px;
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.modal-video-wrapper {
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-video-wrapper video {
    width: 100%;
    max-height: 80vh;
}

.modal-video-details {
    padding: var(--space-6);
    overflow-y: auto;
    max-height: 80vh;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        z-index: 1000;
    }
    
    .sidebar.open {
        transform: translateX(0) !important;
    }

    /* Disable desktop collapsed on mobile */
    body.sidebar-collapsed .sidebar {
        transform: translateX(-100%);
    }
    body.sidebar-collapsed .sidebar.open {
        transform: translateX(0) !important;
    }
    body.sidebar-collapsed .main-wrapper {
        margin-left: 0;
    }
    
    .main-wrapper {
        margin-left: 0;
    }
    
    .btn-menu {
        display: flex;
    }
    
    .controls-inner {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-box {
        max-width: none;
    }
    
    .filters {
        flex-wrap: wrap;
    }
    
    .controls-actions {
        margin-left: 0;
        justify-content: flex-start;
    }

    .header-left {
        flex-wrap: wrap;
        gap: var(--space-2);
    }

    .main-header {
        flex-wrap: wrap;
        gap: var(--space-2);
    }
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}
.sidebar-overlay.active {
    display: block;
}

@media (max-width: 768px) {
    .stats-grid {
        flex-wrap: wrap;
        gap: var(--space-4);
    }
    
    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: var(--space-4);
        padding: var(--space-3) var(--space-3) var(--space-8);
    }
    
    .modal-video-content {
        grid-template-columns: 1fr;
    }

    .modal-content {
        max-height: 95vh;
        max-width: 95vw;
    }

    .modal {
        padding: var(--space-2);
    }

    .controls {
        padding: var(--space-3) var(--space-4);
    }

    .main-header {
        padding: var(--space-3) var(--space-4);
    }

    .card-actions .btn {
        padding: var(--space-1) var(--space-2);
        font-size: 0.7rem;
    }

    /* Mobile perf: isolate card paint */
    .video-card {
        contain: layout style paint;
        will-change: auto;
        transition: none;
    }
    .video-card:hover {
        transform: none;
        box-shadow: none;
    }

    /* Remove expensive backdrop-filter on mobile */
    .modal, .modal-overlay, [style*="backdrop-filter"] {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }
}

/* Phone-specific styles */
@media (max-width: 480px) {
    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: var(--space-3);
        padding: var(--space-2) var(--space-2) var(--space-6);
    }

    .video-grid.grid-large {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }

    .modal {
        padding: 0;
    }

    .modal-content {
        max-width: 100vw;
        max-height: 100vh;
        height: 100%;
        border-radius: 0;
        border: none;
    }

    .screenshot-modal-content {
        width: 100%;
        max-width: 100vw;
        border-radius: 0;
    }

    .main-header {
        padding: var(--space-2) var(--space-3);
        gap: var(--space-1);
    }

    .header-left {
        gap: var(--space-2);
        width: 100%;
    }

    .header-right {
        width: 100%;
        justify-content: flex-end;
    }

    .controls {
        padding: var(--space-2) var(--space-3);
    }

    .controls-inner {
        gap: var(--space-2);
    }

    .search-box {
        font-size: 0.85rem;
    }

    .stats-grid {
        gap: var(--space-3);
    }

    .stat-value {
        font-size: 1.1rem;
    }

    .stat-label {
        font-size: 0.65rem;
    }

    .caption {
        font-size: 0.75rem;
        -webkit-line-clamp: 2;
        margin-bottom: var(--space-2);
    }

    .card-body {
        padding: var(--space-2) var(--space-3);
    }

    .card-actions {
        padding: var(--space-2) var(--space-3);
        gap: var(--space-1);
    }

    .card-actions .btn {
        padding: var(--space-1) var(--space-2);
        font-size: 0.65rem;
        min-height: 32px;
    }

    .posted-date {
        font-size: 0.7rem;
    }

    .filename {
        font-size: 0.7rem;
    }

    .metrics {
        font-size: 0.7rem;
        gap: var(--space-2);
    }

    .hashtags {
        gap: var(--space-1);
    }

    .hashtag {
        font-size: 0.65rem;
        padding: 1px 4px;
    }

    .modal-close {
        width: 36px;
        height: 36px;
        top: var(--space-2);
        right: var(--space-2);
    }

    .btn, button {
        min-height: 44px;
    }

    .card-actions .btn {
        min-height: 32px;
    }

    .ig-type-tabs {
        gap: var(--space-1);
    }

    .ig-type-tab {
        padding: var(--space-1) var(--space-3);
        font-size: 0.75rem;
        min-height: 36px;
    }

    .results-bar {
        padding: var(--space-2) var(--space-3);
        font-size: 0.75rem;
    }

    .minimized-progress {
        left: var(--space-2);
        right: var(--space-2);
        bottom: var(--space-2);
        max-width: none;
    }
}

/* ============================================
   PRINT
   ============================================ */
@media print {
    .archive-header,
    .controls,
    .batch-bar,
    .video-wrapper,
    .card-actions,
    .modal {
        display: none !important;
    }
    
    body {
        background: white;
        color: black;
    }
    
    .video-grid {
        display: block;
    }
    
    .video-card {
        break-inside: avoid;
        margin-bottom: 1rem;
    }
}

/* ============================================
   SCREENSHOT MODAL (v1.1)
   ============================================ */
.screenshot-modal-content {
    max-width: 1200px;
    width: 95%;
    max-height: 90vh;
}

.screenshot-info {
    margin-bottom: var(--space-4);
    padding: var(--space-3);
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.screenshot-info p {
    margin-bottom: var(--space-1);
}

.screenshot-info p:last-child {
    margin-bottom: 0;
}

.screenshot-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--space-4);
    max-height: 60vh;
    overflow-y: auto;
    padding: var(--space-2);
}

.screenshot-thumb {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    border: 2px solid var(--border);
    transition: all 0.2s ease;
    background: var(--bg-input);
    aspect-ratio: 16/9;
}

.screenshot-thumb:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

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

.screenshot-thumb.img-error img {
    display: none;
}

.screenshot-thumb.img-error::after {
    content: 'Image not found';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.screenshot-thumb-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: var(--space-2);
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: white;
}

.screenshot-date {
    font-size: 0.7rem;
    display: block;
}

.screenshot-preview {
    text-align: center;
}

/* Browser chrome mockup */
.browser-frame {
    display: inline-block;
    max-width: 100%;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.45);
    background: #1e1e1e;
}

.browser-titlebar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #2d2d2d;
    border-bottom: 1px solid #3a3a3a;
}

.browser-dots {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.browser-dots span {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.browser-dots span:nth-child(1) { background: #ff5f57; }
.browser-dots span:nth-child(2) { background: #febc2e; }
.browser-dots span:nth-child(3) { background: #28c840; }

.browser-nav {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
    margin-left: 4px;
    color: #888;
}

.browser-nav svg {
    width: 14px;
    height: 14px;
    opacity: 0.5;
}

.browser-urlbar {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    background: #1a1a1a;
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 0.75rem;
    color: #ccc;
    min-width: 0;
}

.browser-urlbar .lock-icon {
    flex-shrink: 0;
    color: #28c840;
}

.browser-urlbar .url-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, monospace;
}

.browser-capture-badge {
    flex-shrink: 0;
    font-size: 0.65rem;
    color: #999;
    background: #1a1a1a;
    border-radius: 4px;
    padding: 3px 8px;
    white-space: nowrap;
}

.browser-viewport {
    line-height: 0;
}

.browser-viewport img {
    max-width: 100%;
    max-height: 52vh;
    display: block;
    margin: 0 auto;
}

.screenshot-preview-meta {
    margin-top: var(--space-4);
    text-align: left;
    padding: var(--space-3);
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}

.screenshot-preview-meta p {
    margin-bottom: var(--space-2);
}

.screenshot-preview-meta p:last-child {
    margin-bottom: 0;
}

.screenshot-preview-meta a {
    color: var(--accent);
    text-decoration: none;
    word-break: break-all;
}

.screenshot-preview-meta a:hover {
    text-decoration: underline;
}

.no-screenshots-msg {
    grid-column: 1 / -1;
    text-align: center;
    padding: var(--space-8);
    color: var(--text-muted);
}

.no-screenshots-msg p {
    margin-bottom: var(--space-2);
}

/* Screenshot button on video cards */
.btn-screenshots {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
}

.btn-screenshots.no-screenshots {
    opacity: 0.4;
    pointer-events: none;
}

/* Header screenshots button */
#btn-screenshots {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}

/* ============================================
   USER MENU (Auth)
   ============================================ */
.user-menu {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-left: var(--space-4);
    padding-left: var(--space-4);
    border-left: 1px solid var(--border);
    position: relative;
}

.user-info-header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
    padding: var(--space-2);
    border-radius: var(--radius-md);
    transition: background 0.2s;
}

.user-info-header:hover {
    background: var(--bg-hover);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: var(--accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    overflow: hidden;
    flex-shrink: 0;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-dropdown {
    position: absolute;
    top: calc(100% - 4px);
    right: 0;
    padding-top: 8px;
    display: none;
    z-index: 1000;
}

.user-dropdown-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    min-width: 220px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.user-menu:hover .user-dropdown,
.user-menu:focus-within .user-dropdown,
.user-dropdown:hover {
    display: block;
}

.user-dropdown-link {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 13px;
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-2);
    transition: background 0.2s;
}

.user-dropdown-link:hover {
    background: var(--bg-hover);
}

.user-dropdown-link svg {
    width: 16px;
    height: 16px;
    opacity: 0.7;
}

.user-dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: var(--space-3) 0;
}

.user-email {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: var(--space-3);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--border);
    word-break: break-all;
}

.btn-sm {
    padding: var(--space-2) var(--space-3);
    font-size: 12px;
}

.btn-danger {
    background: var(--danger);
    color: white;
    border: none;
}

.btn-danger:hover {
    background: #dc2626;
}

#btn-sign-out {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================
   Payment Modal
   ============================================ */
.payment-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
    overflow-y: auto;
    padding: 24px 16px;
}

.payment-modal {
    background: #1a1a2e;
    border-radius: 16px;
    width: 100%;
    max-width: 520px;
    margin: auto;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.payment-header {
    padding: 24px 24px 16px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.payment-header h2 {
    margin: 0 0 8px;
    font-size: 1.5rem;
    color: white;
}

.payment-header p {
    margin: 0;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.95rem;
}

.payment-body {
    padding: 24px;
}

.payment-summary {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 24px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    padding: 8px 0;
}

.summary-row.total {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 8px;
    padding-top: 16px;
    font-weight: 600;
    font-size: 1.1rem;
    color: white;
}

.payment-form {
    margin-bottom: 20px;
}

.payment-form .form-group {
    margin-bottom: 16px;
}

.payment-form label {
    display: block;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.payment-form input {
    width: 100%;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: white;
    font-size: 1rem;
    transition: all 0.2s;
    box-sizing: border-box;
}

.payment-form input:focus {
    outline: none;
    border-color: #1D4ED8;
    background: rgba(29, 78, 216, 0.1);
}

.payment-form input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.payment-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.btn-payment {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #1D4ED8 0%, #2563EB 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-payment:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(99, 91, 255, 0.4);
}

.btn-payment:disabled {
    opacity: 0.8;
    cursor: wait;
}

.btn-payment.success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.spinner-small {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.payment-footer {
    margin-top: 20px;
    text-align: center;
}

.payment-features {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 20px;
}

.payment-features-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 10px;
}

.payment-features ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.payment-features li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.75);
    line-height: 1.4;
}

.payment-features li svg {
    width: 14px;
    height: 14px;
    color: #10b981;
    flex-shrink: 0;
    margin-top: 1px;
}

.payment-features li strong {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
}

.payment-features li .pf-desc {
    color: rgba(255, 255, 255, 0.45);
    font-weight: 400;
}

.payment-trust-row {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

.payment-trust-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.4);
    white-space: nowrap;
}

.payment-trust-badge svg {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}

.payment-guarantee {
    margin-top: 10px;
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.35);
    text-align: center;
}

.payment-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.6);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.payment-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* Voucher Row */
.voucher-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 16px;
}

.voucher-row input {
    flex: 1;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: white;
    padding: 10px 14px;
    font-size: 0.9rem;
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 1px;
}

.voucher-row input:focus {
    outline: none;
    border-color: #1D4ED8;
}

.btn-voucher-apply {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.8);
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-voucher-apply:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.voucher-status {
    font-size: 0.8rem;
    white-space: nowrap;
    color: rgba(255, 255, 255, 0.5);
}

.voucher-success {
    color: #10b981 !important;
    font-weight: 600;
}

.voucher-error {
    color: #ef4444 !important;
}

/* Payment Mode Toggle */
.payment-mode-toggle {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.mode-option {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 14px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    gap: 4px;
}

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

.mode-option span {
    font-size: 0.9rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

.mode-option small {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
}

.mode-option.active {
    border-color: #1D4ED8;
    background: rgba(29, 78, 216, 0.15);
}

.mode-option:hover:not(.active) {
    border-color: rgba(255, 255, 255, 0.25);
}

/* Subscription Expired Popup */
.subscription-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.subscription-popup {
    background: #1a1a2e;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 40px 36px;
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.subscription-popup-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    background: rgba(255, 107, 107, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.subscription-popup-icon svg {
    width: 28px;
    height: 28px;
    color: #ff6b6b;
}

.subscription-popup h3 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: white;
}

.subscription-popup p {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 24px;
}

.subscription-popup strong {
    color: white;
}

.subscription-retention-note {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.35);
    margin-bottom: 20px;
    margin-top: -12px;
}

.btn-dismiss-expired {
    display: block;
    width: 100%;
    margin-top: 10px;
    padding: 10px 20px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.85rem;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
}

.btn-dismiss-expired:hover {
    border-color: rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.8);
}

.expired-persistent-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 8px 16px;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 4px;
    margin: 12px 24px 0;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
}

.expired-persistent-banner strong {
    color: white;
}

.expired-persistent-banner button {
    padding: 4px 14px;
    background: #1D4ED8;
    border: none;
    border-radius: 4px;
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}

.expired-persistent-banner button:hover {
    background: #2563EB;
}

.expired-readonly .star-toggle,
.expired-readonly .btn-star {
    pointer-events: none;
    opacity: 0.3;
}

/* =====================================================
   Platform Selector - Add Account Modal (v2.7)
   ===================================================== */

.platform-selector {
    padding: 16px 24px 12px;
}

.platform-selector-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.platform-selector-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.platform-pill {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.platform-pill:hover {
    color: var(--text-primary);
    border-color: var(--text-muted);
    background: var(--bg-hover);
}

.platform-pill[data-platform="tiktok"].active {
    color: #69C9D0;
    border-color: #69C9D0;
    background: rgba(105, 201, 208, 0.10);
    box-shadow: 0 0 0 1px #69C9D0;
}

.platform-pill[data-platform="instagram"].active {
    color: #E1306C;
    border-color: #E1306C;
    background: rgba(225, 48, 108, 0.10);
    box-shadow: 0 0 0 1px #E1306C;
}

.platform-pill[data-platform="facebook"].active {
    color: #1877F2;
    border-color: #1877F2;
    background: rgba(24, 119, 242, 0.10);
    box-shadow: 0 0 0 1px #1877F2;
}

.platform-pill[data-platform="snapchat"].active {
    color: #FFFC00;
    border-color: #FFFC00;
    background: rgba(255, 252, 0, 0.08);
    box-shadow: 0 0 0 1px #FFFC00;
}

.platform-pill.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
    flex: 0 1 auto;
}

.platform-pill.disabled:hover {
    background: var(--bg-secondary);
    border-color: var(--border);
    color: var(--text-secondary);
}

.platform-pill .coming-soon-badge {
    font-size: 0.55rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: rgba(255, 255, 255, 0.08);
    padding: 2px 5px;
    border-radius: 3px;
    white-space: nowrap;
    flex-shrink: 0;
}

.platform-pill svg {
    flex-shrink: 0;
}

/* .platform-form inherits from modal-body, no extra styling needed */

/* Platform icon in sidebar account handle */
.platform-icon {
    vertical-align: middle;
    margin-right: 2px;
    opacity: 0.7;
}

.platform-icon.ig {
    color: #E1306C;
}

.platform-icon.tt {
    color: #69C9D0;
}

/* Instagram Type Tabs (Posts / Reels filter) */
.ig-type-tabs {
    display: flex;
    gap: 0;
    padding: 0 24px;
    margin-bottom: 0;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}

.ig-type-tab {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 10px 20px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
    letter-spacing: 0.3px;
}

.ig-type-tab:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.ig-type-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* =====================================================
   Instagram Grid Layout (v2.7)
   Uniform card heights with full metadata
   ===================================================== */

/* All Instagram cards: flex column so actions pin to bottom */
.video-grid.ig-grid .video-card {
    display: flex;
    flex-direction: column;
}

/* Standardize ALL media wrappers to 1:1 square */
.video-grid.ig-grid .video-card .video-wrapper {
    aspect-ratio: 1;
}

.video-grid.ig-grid .video-card .photo-wrapper {
    aspect-ratio: 1;
}

/* Card body grows to fill remaining space */
.video-grid.ig-grid .video-card .card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Push actions to bottom of card */
.video-grid.ig-grid .video-card .card-actions {
    margin-top: auto;
}

/* Instagram Photo Card - image-specific styles */
.video-card .photo-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    background: var(--bg-tertiary);
    cursor: pointer;
    border-radius: var(--radius) var(--radius) 0 0;
}

.video-card .photo-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.video-card .photo-wrapper:hover img {
    transform: scale(1.03);
}

.video-card .photo-wrapper .photo-icon-overlay {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.55);
    border-radius: 4px;
    padding: 4px 6px;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    color: #fff;
    pointer-events: none;
}

/* Carousel Navigation - Card */
.carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 1.3rem;
    cursor: pointer;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    line-height: 1;
}
.photo-wrapper:hover .carousel-arrow { opacity: 1; }
.carousel-arrow:hover { background: rgba(0, 0, 0, 0.85); }
.carousel-prev { left: 6px; }
.carousel-next { right: 6px; }
.carousel-counter {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    z-index: 3;
    pointer-events: none;
}

/* Carousel Navigation - Modal */
.modal-carousel-nav {
    position: absolute;
    top: 35%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.6rem;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.modal-carousel-nav:hover { background: rgba(0, 0, 0, 0.85); }
.modal-carousel-prev { left: 12px; }
.modal-carousel-next { right: 12px; }
.modal-carousel-counter {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 0.85rem;
    padding: 4px 12px;
    border-radius: 12px;
    z-index: 10;
}

/* Instagram Photo Popup Modal */
.modal-photo-content {
    max-width: 900px;
    width: 95%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

.modal-photo-content .modal-photo-image {
    width: 100%;
    max-height: 60vh;
    object-fit: contain;
    background: #000;
    border-radius: var(--radius) var(--radius) 0 0;
}

.modal-photo-content .modal-photo-meta {
    padding: 16px 20px;
    overflow-y: auto;
    max-height: 30vh;
}

.modal-photo-content .modal-photo-meta .meta-row {
    display: flex;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 0.85rem;
    line-height: 1.4;
}

.modal-photo-content .modal-photo-meta .meta-row .meta-label {
    color: var(--text-secondary);
    min-width: 80px;
    font-weight: 500;
}

.modal-photo-content .modal-photo-meta .meta-row .meta-value {
    color: var(--text-primary);
    word-break: break-word;
}

.modal-photo-content .modal-photo-meta .meta-caption {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-primary);
    white-space: pre-wrap;
}

.modal-photo-content .modal-photo-meta .meta-hashtags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.modal-photo-content .modal-photo-meta .meta-hashtags .hashtag {
    font-size: 0.8rem;
}

/* =====================================================
   Comments Button & Modal (v2.7)
   ===================================================== */

.btn-comments.no-comments {
    opacity: 0.4;
    pointer-events: none;
}

/* Comments Modal */
.comments-modal-content {
    max-width: 600px;
    width: 95%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.comments-modal-content .modal-body {
    overflow-y: hidden;
    display: flex;
    flex-direction: column;
}

.comments-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 12px;
    flex-shrink: 0;
}

.comments-list {
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.15) transparent;
}
.comments-list::-webkit-scrollbar { width: 6px; }
.comments-list::-webkit-scrollbar-track { background: transparent; }
.comments-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }
.comments-list::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.25); }

.comment-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

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

.comment-item.comment-reply {
    margin-left: 24px;
    padding-left: 12px;
    border-left: 2px solid var(--border);
    border-bottom: none;
    padding-top: 8px;
    padding-bottom: 8px;
}

.comment-item.comment-reply .comment-username {
    font-size: 0.8rem;
}

.comment-item.comment-reply .comment-text {
    font-size: 0.825rem;
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}

.comment-username {
    font-weight: 600;
    font-size: 0.85rem;
    color: #60a5fa;
    text-decoration: none;
    cursor: pointer;
}

.comment-username:hover {
    text-decoration: underline;
}

.comment-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.comment-likes {
    font-size: 0.75rem;
    color: #f87171;
    font-weight: 500;
    margin-left: auto;
}

.comment-text {
    font-size: 0.875rem;
    color: var(--text-primary);
    opacity: 0.9;
    line-height: 1.5;
    word-break: break-word;
}

.comments-search input {
    width: 100%;
    padding: var(--space-3);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.875rem;
    margin-bottom: var(--space-3);
}

.comments-search input:focus {
    outline: none;
    border-color: var(--accent);
}

.comments-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.btn-retrieve-comments {
    margin-top: 12px;
    padding: 8px 20px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: opacity 0.2s;
}
.btn-retrieve-comments:hover { opacity: 0.85; }
.btn-retrieve-comments:disabled { opacity: 0.5; cursor: not-allowed; }

/* Matching comments strip on cards (comment search) */
.comment-matches {
    padding: 8px 12px;
    margin: 0 8px 6px;
    background: var(--bg-tertiary);
    border: 1px solid var(--accent-subtle);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
}

.comment-matches-header {
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 6px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.comment-match-item {
    padding: 4px 0;
    line-height: 1.4;
    color: var(--text-secondary);
    border-top: 1px solid var(--border);
}

.comment-match-item:first-of-type {
    border-top: none;
}

.comment-match-user {
    color: var(--accent);
    font-weight: 500;
    margin-right: 6px;
    font-size: 0.7rem;
}

.comment-match-text {
    word-break: break-word;
}

.comment-matches-more {
    color: var(--text-muted);
    font-size: 0.7rem;
    margin-top: 4px;
    font-style: italic;
}

mark.search-highlight {
    background: rgba(59, 130, 246, 0.3);
    color: inherit;
    border-radius: 2px;
    padding: 0 2px;
}

/* Modal header actions (minimize + close) */
.modal-header-actions {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 1;
}

.modal-header-actions .modal-close {
    position: static;
}

.modal-minimize {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s, background 0.15s;
}

.modal-minimize:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

/* Minimized Progress Bar */
.minimized-progress {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1100;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    min-width: 300px;
    max-width: 420px;
    animation: minimizedSlideUp 0.3s ease;
}

@keyframes minimizedSlideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.minimized-progress-inner {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.minimized-progress-top {
    display: flex;
    align-items: center;
    gap: 10px;
}

.spinner-small {
    width: 14px;
    height: 14px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

#minimized-progress-text {
    flex: 1;
    font-size: 0.8rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#minimized-progress-percent {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent);
    flex-shrink: 0;
}

.minimized-progress-expand {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    border-radius: 4px;
    transition: background 0.15s;
}

.minimized-progress-expand:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.minimized-progress-bar {
    height: 3px;
    background: var(--bg-primary);
    border-radius: 2px;
    overflow: hidden;
}

.minimized-progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.5s ease;
}

/* AI Thinking Animation */
.ai-thinking-dots span {
    animation: aiDotPulse 1.4s infinite;
    font-size: 1.4rem;
    font-weight: bold;
    color: #06B6D4;
}
.ai-thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.ai-thinking-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes aiDotPulse {
    0%, 80%, 100% { opacity: 0.2; }
    40% { opacity: 1; }
}

/* Floating Ask AI Button */
.ai-fab {
    position: fixed;
    right: 28px;
    top: 94px;
    z-index: 900;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 24px;
    background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%);
    border: 1.5px solid rgba(255, 255, 255, 0.18);
    border-radius: 4px;
    color: #fff;
    font-size: 0.95rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 4px 24px rgba(0,0,0,0.3), 0 0 20px rgba(6,182,212,0.1);
    transition: all 0.2s ease;
    letter-spacing: 0.3px;
}
.ai-fab:hover {
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 6px 32px rgba(0,0,0,0.4), 0 0 28px rgba(6,182,212,0.15);
    transform: translateY(-2px);
}
.ai-fab span {
    background: linear-gradient(135deg, #e0f2fe, #67e8f9);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.ai-sparkle { flex-shrink: 0; }
.ai-sparkle-l { animation: aiSparkle 3s ease-in-out infinite; }
.ai-sparkle-r { animation: aiSparkle 3s ease-in-out 1.5s infinite; }
@keyframes aiSparkle {
    0%, 100% { opacity: 0.6; transform: scale(1) rotate(0deg); }
    50% { opacity: 1; transform: scale(1.2) rotate(15deg); }
}

/* ── Media Viewer Modal ── */
.modal-media-viewer-content {
    max-width: 900px;
    width: 95vw;
    max-height: 92vh;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 12px;
    background: var(--bg-secondary, #1a1a2e);
}
.modal-media-viewer-content .modal-close {
    position: absolute;
    top: 8px;
    right: 12px;
    z-index: 10;
    background: rgba(0,0,0,0.5);
    border: none;
    color: #fff;
    font-size: 28px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.media-viewer-media {
    position: relative;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    max-height: 60vh;
    overflow: hidden;
}
.media-viewer-media video {
    width: 100%;
    max-height: 60vh;
    outline: none;
}
.media-viewer-media img {
    max-width: 100%;
    max-height: 60vh;
    object-fit: contain;
}
.media-viewer-speed {
    display: flex;
    gap: 4px;
    justify-content: center;
    padding: 6px 0;
    background: #000;
}
.media-viewer-speed button {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: #ccc;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    cursor: pointer;
    min-height: 28px;
}
.media-viewer-speed button.active {
    background: var(--accent, #1D4ED8);
    color: #fff;
    border-color: var(--accent, #1D4ED8);
}
.media-viewer-carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.6);
    border: none;
    color: #fff;
    font-size: 28px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
}
.media-viewer-carousel-prev { left: 8px; }
.media-viewer-carousel-next { right: 8px; }
.media-viewer-carousel-counter {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.6);
    color: #fff;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 12px;
}
.media-viewer-caption {
    padding: 10px 16px;
    font-size: 13px;
    color: #ccc;
    max-height: 60px;
    overflow: hidden;
    cursor: pointer;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.media-viewer-caption.expanded {
    max-height: none;
}
.media-viewer-caption:empty { display: none; }
.media-viewer-actions {
    display: flex;
    gap: 6px;
    padding: 10px 16px;
    flex-wrap: wrap;
    justify-content: center;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.media-viewer-actions .mv-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.06);
    color: #ddd;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    min-height: 38px;
    white-space: nowrap;
    transition: background 0.15s;
}
.media-viewer-actions .mv-btn:hover {
    background: rgba(255,255,255,0.12);
}
.media-viewer-actions .mv-btn.active {
    background: var(--accent, #1D4ED8);
    color: #fff;
    border-color: var(--accent, #1D4ED8);
}
.media-viewer-actions .mv-btn svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}
.media-viewer-panel {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    max-height: 35vh;
}
.media-viewer-panel:empty { display: none; }
.media-viewer-panel .mv-panel-inner {
    padding: 12px 16px;
}
.media-viewer-panel .comment-item {
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.media-viewer-panel .comment-header {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 4px;
}
.media-viewer-panel .comment-username {
    font-weight: 600;
    color: var(--accent, #1D4ED8);
    font-size: 13px;
}
.media-viewer-panel .comment-time {
    font-size: 11px;
    color: #888;
}
.media-viewer-panel .comment-text {
    font-size: 13px;
    color: #ccc;
}
.media-viewer-panel .comment-reply {
    margin-left: 20px;
    border-left: 2px solid rgba(255,255,255,0.1);
    padding-left: 10px;
}
.media-viewer-panel .mv-empty {
    text-align: center;
    padding: 24px;
    color: #888;
    font-size: 13px;
}
.media-viewer-panel .mv-loading {
    text-align: center;
    padding: 24px;
    color: #aaa;
}
.mv-transcript-search {
    padding: 8px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    position: sticky;
    top: 0;
    background: var(--bg-secondary, #1a1a2e);
    z-index: 1;
    display: flex;
    gap: 6px;
}
.mv-transcript-search-input {
    flex: 1;
    padding: 7px 10px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.06);
    color: #ddd;
    font-size: 13px;
    outline: none;
}
.mv-transcript-search-input:focus {
    border-color: var(--accent, #1D4ED8);
}
.mv-transcript-search-btn {
    padding: 7px 12px;
    border-radius: 6px;
    border: none;
    background: var(--accent, #1D4ED8);
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}
.mv-transcript-search-btn:hover {
    opacity: 0.85;
}
.media-viewer-panel .highlight {
    background: #facc15;
    color: #000;
    padding: 1px 3px;
    border-radius: 2px;
}
.media-viewer-panel .segment {
    padding: 6px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    transition: background 0.15s, border-left 0.15s;
    cursor: pointer;
}
.media-viewer-panel .segment.segment-active {
    background: rgba(250, 204, 21, 0.15);
    border-left: 2px solid #facc15;
    padding-left: 10px;
    border-radius: 2px;
}
.media-viewer-panel .segment-time {
    font-size: 11px;
    color: var(--accent, #1D4ED8);
    margin-bottom: 2px;
}
.media-viewer-panel .segment-text {
    font-size: 13px;
    color: #ccc;
}
.media-viewer-panel .screenshot-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
    padding: 4px 0;
}
.media-viewer-panel .screenshot-thumb {
    cursor: pointer;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.1);
}
.media-viewer-panel .screenshot-thumb img {
    width: 100%;
    display: block;
}

@media (max-width: 768px) {
    .modal-media-viewer-content {
        width: 100vw;
        max-width: 100vw;
        max-height: 100vh;
        height: 100vh;
        border-radius: 0;
    }
    .modal-media-viewer-content .modal-close {
        position: fixed;
        top: 10px;
        right: 10px;
        width: 44px;
        height: 44px;
        font-size: 32px;
        background: rgba(0,0,0,0.7);
        z-index: 9999;
    }
    .media-viewer-media {
        max-height: 45vh;
    }
    .media-viewer-media video,
    .media-viewer-media img {
        max-height: 45vh;
    }
    .media-viewer-actions {
        padding: 8px 10px;
        gap: 4px;
        flex-wrap: nowrap;
        overflow-x: auto;
        justify-content: flex-start;
        -webkit-overflow-scrolling: touch;
    }
    .media-viewer-actions .mv-btn {
        padding: 8px 10px;
        font-size: 12px;
        min-height: 38px;
        flex: 0 0 auto;
    }
    .media-viewer-panel {
        max-height: 40vh;
    }
    .media-viewer-caption {
        padding: 8px 10px;
    }
}

.comments-progress-bar {
    width: 100%;
    max-width: 260px;
    height: 6px;
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
    overflow: hidden;
    margin: 0 auto 10px;
}
.comments-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--accent-primary, #1D4ED8);
    border-radius: 3px;
    transition: width 0.3s ease;
}
.comments-progress-label {
    font-size: 13px;
    opacity: 0.8;
    margin: 0;
}

/* Drag-and-drop account reorder */
.drag-handle {
    cursor: grab;
    padding: 4px 2px;
    opacity: 0.3;
    flex-shrink: 0;
    display: flex;
    align-items: center;
}
.drag-handle:hover { opacity: 0.7; }
.account-item.dragging { opacity: 0.35; }
.account-item.drag-over { border-top: 2px solid var(--accent-primary, #1D4ED8); }

/* Account search */
.account-search-input {
    width: 100%;
    padding: 7px 10px;
    margin-bottom: 6px;
    background: var(--bg-tertiary, #1e293b);
    border: 1px solid var(--border-color, #334155);
    border-radius: 6px;
    color: var(--text-primary, #f1f5f9);
    font-size: 0.78rem;
    outline: none;
}
.account-search-input::placeholder { color: var(--text-secondary, #94a3b8); }
.account-search-input:focus { border-color: var(--accent-primary, #1D4ED8); }

/* Star button on cards */
.star-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 4;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: #fff;
    opacity: 0.3;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
    transition: opacity 0.15s, color 0.15s, transform 0.15s;
    padding: 2px;
    line-height: 1;
}
.star-btn:hover { opacity: 0.8; transform: scale(1.15); }
.star-btn.starred { color: #f5c518; opacity: 1; }

/* Starred filter button */
.btn-starred-filter {
    background: none;
    border: 1px solid var(--border-color, #334155);
    color: var(--text-secondary, #94a3b8);
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    cursor: pointer;
    margin-left: 8px;
    transition: all 0.15s;
    white-space: nowrap;
}
.btn-starred-filter:hover { border-color: var(--accent-primary, #1D4ED8); color: var(--text-primary); }
.btn-starred-filter.active {
    background: var(--accent-primary, #1D4ED8);
    border-color: var(--accent-primary, #1D4ED8);
    color: #fff;
}

/* =====================================================
   Billing Modal (v2.34 – tabs + cards)
   ===================================================== */

.billing-modal-content {
    max-width: 640px;
    width: 95%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.billing-modal-content .modal-body {
    overflow-y: auto;
    flex: 1;
    padding: 0 20px 16px;
}

.billing-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    padding: 0 20px;
}

.billing-tab {
    background: none;
    border: none;
    padding: 10px 18px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    position: relative;
    transition: color 0.15s;
}

.billing-tab:hover { color: var(--text-primary); }

.billing-tab.active {
    color: var(--accent);
    font-weight: 600;
}

.billing-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent);
    border-radius: 2px 2px 0 0;
}

.billing-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    gap: 12px;
}

.billing-card:last-child { border-bottom: none; }

.billing-card-main {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.billing-card-account {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.billing-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.billing-card-detail {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.billing-card-action {
    flex-shrink: 0;
}

.billing-cancel-btn {
    background: rgba(239,68,68,0.12);
    color: #ef4444;
    border: none;
    padding: 5px 14px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.billing-cancel-btn:hover { background: rgba(239,68,68,0.25); }
.billing-cancel-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.billing-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: capitalize;
}

.billing-badge-active { background: rgba(34,197,94,0.15); color: #22c55e; }
.billing-badge-cancelled { background: rgba(239,68,68,0.15); color: #ef4444; }
.billing-badge-expired { background: rgba(148,163,184,0.15); color: #94a3b8; }

/* ============================================
   STATS PANEL (addon)
   ============================================ */
.stats-panel {
    padding: var(--space-6);
    overflow-y: auto;
    max-height: calc(100vh - 200px);
}
.stats-empty {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-secondary);
}

/* Header */
.sp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.sp-title {
    font-family: 'Public Sans', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}
.sp-subtitle {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-left: 12px;
}
.sp-close {
    flex-shrink: 0;
}

/* Sections */
.sp-section {
    margin-bottom: 36px;
}
.sp-section-title {
    font-family: 'Public Sans', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 16px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.sp-badge {
    font-size: 0.68rem;
    font-weight: 500;
    color: var(--accent-cyan);
    background: rgba(6, 182, 212, 0.1);
    padding: 2px 8px;
    border-radius: 3px;
    font-family: 'Inter', sans-serif;
}
.sp-muted {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* KPI Grid */
.sp-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}
.sp-kpi {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 16px;
    text-align: center;
    transition: border-color 0.15s;
}
.sp-kpi:hover {
    border-color: var(--accent);
}
.sp-kpi-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}
.sp-kpi-label {
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.sp-kpi[data-type="likes"] .sp-kpi-value { color: #F43F5E; }
.sp-kpi[data-type="views"] .sp-kpi-value { color: var(--accent-cyan); }
.sp-kpi[data-type="comments"] .sp-kpi-value { color: var(--accent); }
.sp-kpi[data-type="shares"] .sp-kpi-value { color: #10B981; }
.sp-kpi[data-type="saves"] .sp-kpi-value { color: #F59E0B; }
.sp-kpi[data-type="rate"] .sp-kpi-value { color: #8B5CF6; }

/* Chart rows */
.sp-chart-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}
.sp-chart-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 16px;
    position: relative;
    height: 300px;
}
.sp-chart-card canvas {
    width: 100% !important;
    height: 100% !important;
}
.sp-chart-wide {
    grid-column: 1 / -1;
    height: 320px;
}
.sp-chart-sm {
    max-width: 320px;
    height: 280px;
}

/* Top posts grid */
.sp-top-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
}
.sp-top-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 16px;
}
.sp-top-card h4 {
    font-family: 'Public Sans', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 12px 0;
}
.sp-wide-card {
    grid-column: 1 / -1;
}

/* Tables */
.sp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}
.sp-table th {
    text-align: left;
    color: var(--text-secondary);
    font-weight: 500;
    padding: 6px 8px;
    border-bottom: 1px solid var(--border);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.sp-table td {
    padding: 8px;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(51, 65, 85, 0.3);
    vertical-align: middle;
}
.sp-table tr:hover td {
    background: rgba(29, 78, 216, 0.04);
}
.sp-rank {
    width: 28px;
    text-align: center;
    color: var(--text-secondary);
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
}
.sp-thumb {
    width: 40px;
    height: 40px;
    border-radius: 3px;
    object-fit: cover;
    display: block;
}
.sp-thumb-cell { width: 48px; }
.sp-thumb-empty {
    background: var(--bg-primary);
    border: 1px solid var(--border);
}
.sp-cap-cell { min-width: 120px; }
.sp-cap-text {
    display: block;
    color: var(--text-primary);
    font-size: 0.78rem;
    line-height: 1.3;
}
.sp-post-date {
    display: block;
    font-size: 0.68rem;
    color: var(--text-secondary);
    margin-top: 2px;
}
.sp-metric-cell {
    text-align: right;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    color: var(--accent-cyan);
    font-size: 0.82rem;
}
.sp-commenter-name {
    font-weight: 600;
    color: var(--accent);
}
.sp-sample {
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-secondary);
    font-size: 0.75rem;
}

/* Performance grid */
.sp-perf-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
}
.sp-perf-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 14px;
    text-align: center;
}
.sp-perf-val {
    display: block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}
.sp-perf-lbl {
    display: block;
    font-size: 0.68rem;
    color: var(--text-secondary);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* Collapsible commenters */
.sp-collapsible {
    margin-top: 16px;
}
.sp-collapse-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--accent);
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: background 0.15s;
}
.sp-collapse-btn:hover {
    background: var(--accent-subtle);
}
.sp-collapse-body {
    margin-top: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 16px;
    max-height: 400px;
    overflow-y: auto;
}
.sp-commenter-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.sp-commenter-pill {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 3px 8px;
    font-size: 0.75rem;
    color: var(--text-primary);
    white-space: nowrap;
}
.sp-commenter-pill em {
    color: var(--text-secondary);
    font-style: normal;
    font-size: 0.68rem;
}

/* Insights */
.sp-insight-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}
.sp-insight-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 16px;
}
.sp-insight-label {
    display: block;
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-weight: 500;
}
.sp-insight-val {
    display: block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}
.sp-insight-sub {
    display: block;
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-top: 6px;
}
.sp-progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-primary);
    border-radius: 4px;
    overflow: hidden;
}
.sp-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-cyan));
    border-radius: 4px;
    transition: width 0.3s;
}

/* Word clouds */
.sp-word-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 16px;
}
.sp-word-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 16px;
}
.sp-word-card h4 {
    font-family: 'Public Sans', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 12px 0;
}
.sp-word-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.sp-word-pill {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 3px 8px;
    font-size: 0.78rem;
    color: var(--text-primary);
}
.sp-word-pill em {
    color: var(--accent-cyan);
    font-style: normal;
    margin-left: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
}

/* Footer */
.sp-footer {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.72rem;
    padding: 24px 0 8px 0;
    border-top: 1px solid var(--border);
    margin-top: 16px;
}

/* Clickable post rows in stats */
.sp-table tr[data-video-id] {
    cursor: pointer;
    transition: background 0.12s;
}
.sp-table tr[data-video-id]:hover td {
    background: rgba(29, 78, 216, 0.1);
}

/* Active stats button */
#btn-stats.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* Responsive */
@media (max-width: 768px) {
    .sp-kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .sp-chart-row { grid-template-columns: 1fr; }
    .sp-chart-card, .sp-chart-wide { height: 260px; }
    .sp-top-grid { grid-template-columns: 1fr; }
    .sp-insight-row { grid-template-columns: 1fr; }
    .sp-perf-grid { grid-template-columns: repeat(3, 1fr); }
    .sp-header { flex-direction: column; align-items: flex-start; gap: 12px; }
}