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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    color: #1a1a1a;
    background: #f5f5f5;
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 200px;
    min-height: 100vh;
    background: #1a1a2e;
    color: #ccc;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}
.sidebar-logo {
    padding: 20px 16px;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    border-bottom: 1px solid #2a2a4a;
}
.sidebar ul { list-style: none; padding: 8px 0; flex: 1; }
.sidebar ul li a {
    display: block;
    padding: 10px 16px;
    color: #aaa;
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: all 0.15s;
}
.sidebar ul li a:hover, .sidebar ul li a.active {
    color: #fff;
    background: #2a2a4a;
    border-left-color: #e74c3c;
}
.sidebar-footer { padding: 16px; }
.sidebar-footer a { color: #666; text-decoration: none; font-size: 12px; }

/* Content */
.content { flex: 1; padding: 32px; overflow-y: auto; }
h1 { font-size: 22px; margin-bottom: 24px; }
h2 { font-size: 16px; margin: 24px 0 12px; color: #333; }

/* Login */
body.login-page {
    display: flex; align-items: center; justify-content: center;
    background: #1a1a2e;
}
.login-box {
    background: #fff; padding: 40px; border-radius: 8px;
    width: 320px; text-align: center;
}
.login-box h1 { margin-bottom: 24px; color: #1a1a2e; }
.login-box input {
    display: block; width: 100%; padding: 10px 12px;
    margin-bottom: 12px; border: 1px solid #ddd; border-radius: 4px;
    font-size: 14px;
}
.login-box button {
    width: 100%; padding: 10px; background: #e74c3c; color: #fff;
    border: none; border-radius: 4px; cursor: pointer; font-size: 14px;
}
.login-box button:hover { background: #c0392b; }

/* Alerts */
.alert { padding: 10px 14px; border-radius: 4px; margin-bottom: 16px; font-size: 13px; }
.alert-error { background: #fdecea; color: #c0392b; border: 1px solid #f5c6cb; }

/* Widgets */
.widgets-row { display: flex; gap: 16px; margin-bottom: 32px; flex-wrap: wrap; }
.widget {
    background: #fff; border-radius: 8px; padding: 20px 24px;
    flex: 1; min-width: 160px; box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.widget-label { font-size: 12px; color: #888; margin-bottom: 8px; }
.widget-value { font-size: 28px; font-weight: 700; color: #1a1a2e; }

/* Page header */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.page-header h1 { margin-bottom: 0; }

/* Buttons */
.btn {
    padding: 8px 16px; background: #e74c3c; color: #fff;
    border: none; border-radius: 4px; text-decoration: none;
    cursor: pointer; font-size: 13px; display: inline-block;
}
.btn:hover { background: #c0392b; }
.btn-sm { padding: 4px 10px; font-size: 12px; background: #f0f0f0; color: #333;
    border-radius: 4px; text-decoration: none; }
.btn-sm:hover { background: #e0e0e0; }
.btn-danger { padding: 4px 10px; background: #fff; color: #e74c3c;
    border: 1px solid #e74c3c; border-radius: 4px; cursor: pointer; font-size: 12px; }
.btn-danger:hover { background: #fdecea; }

/* Channels grid */
.channels-grid { display: flex; flex-direction: column; gap: 12px; }
.channel-card {
    background: #fff; border-radius: 8px; padding: 16px 20px;
    display: flex; align-items: center; gap: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.channel-avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; }
.channel-avatar-lg { width: 72px; height: 72px; border-radius: 50%; }
.channel-info { flex: 1; }
.channel-title { font-size: 15px; font-weight: 600; color: #1a1a2e; text-decoration: none; }
.channel-title:hover { text-decoration: underline; }
.channel-tags { margin-top: 4px; }
.tag { display: inline-block; padding: 2px 8px; background: #eef; color: #446;
    border-radius: 12px; font-size: 11px; margin-right: 4px; }

/* Tables */
.data-table { width: 100%; border-collapse: collapse; background: #fff;
    border-radius: 8px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.data-table th { padding: 10px 14px; background: #f8f8f8; text-align: left;
    font-size: 12px; color: #666; border-bottom: 1px solid #eee; }
.data-table td { padding: 10px 14px; border-bottom: 1px solid #f0f0f0; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #fafafa; }

/* Forms */
.add-form { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.add-form input {
    flex: 1; min-width: 200px; padding: 8px 12px;
    border: 1px solid #ddd; border-radius: 4px; font-size: 13px;
}
.add-form button { padding: 8px 16px; background: #1a1a2e; color: #fff;
    border: none; border-radius: 4px; cursor: pointer; font-size: 13px; }

/* Event feed */
.event-feed { background: #fff; border-radius: 8px; padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08); min-height: 120px; }

/* Empty state */
.empty-state { color: #aaa; font-size: 13px; padding: 20px 0; }

/* Channel header */
.channel-header { display: flex; align-items: center; gap: 20px; margin-bottom: 32px; }
.channel-header h1 { margin-bottom: 4px; }
.channel-header a { color: #e74c3c; font-size: 13px; }

/* Section */
section { margin-bottom: 40px; }

code { background: #f0f0f0; padding: 2px 6px; border-radius: 3px; font-size: 12px; }

/* Page header with action button */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.page-header h1 { margin: 0; }

/* Buttons */
.btn { padding: 9px 18px; border: none; border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: 500; transition: opacity .15s; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: #1a1a2e; color: #fff; }
.btn-primary:hover:not(:disabled) { opacity: .85; }

/* Collect status banner */
.collect-status { margin-bottom: 16px; padding: 10px 14px; border-radius: 6px; font-size: 13px; }
.collect-status--info    { background: #eef4ff; color: #2563eb; }
.collect-status--success { background: #ecfdf5; color: #059669; }
.collect-status--warn    { background: #fffbeb; color: #d97706; }
.collect-status--error   { background: #fef2f2; color: #dc2626; }

/* Channel stats row */
.channel-stats-row { display: flex; gap: 12px; margin-top: 8px; flex-wrap: wrap; }
.stat-chip { background: #f0f0f0; padding: 3px 10px; border-radius: 20px; font-size: 12px; color: #444; }

/* Channel avatar placeholder */
.channel-avatar--placeholder {
    background: #1a1a2e; color: #fff; display: flex;
    align-items: center; justify-content: center;
    font-size: 20px; font-weight: bold;
}
.channel-avatar-lg.channel-avatar--placeholder { font-size: 32px; }

/* Channel meta in card */
.channel-meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: #666; margin: 4px 0; }

/* Count badge */
.count-badge { background: #eee; color: #555; font-size: 13px; font-weight: normal;
    padding: 2px 8px; border-radius: 10px; margin-left: 6px; }

/* Videos table */
.videos-table-wrap { overflow-x: auto; }
.video-thumb { width: 252px !important; height: 141px !important; object-fit: cover; border-radius: 4px; display: block; }
.video-title { color: #1a1a2e; text-decoration: none; font-size: 13px; line-height: 1.4; }
.video-title:hover { text-decoration: underline; }
td.num { text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; }
td.date { white-space: nowrap; font-size: 12px; color: #888; }

/* Badges */
.badge { font-size: 11px; padding: 2px 7px; border-radius: 10px; white-space: nowrap; margin-right: 2px; display: inline-block; }
.badge--fire    { background: #fff3cd; color: #856404; }
.badge--old     { background: #d1ecf1; color: #0c5460; }
.badge--changed { background: #e2d9f3; color: #4a235a; }
.badge--unavail { background: #f8d7da; color: #721c24; }
.badge--filmed  { background: #d4edda; color: #155724; }

/* Row highlights */
tr.row--outlier-new td { background: #fffbeb; }
tr.row--outlier-old td { background: #f0f9ff; }

.videos-table--muted { opacity: 0.55; }
.videos-table--muted .video-title { color: #888; }

/* Video detail page */
.video-detail-header { margin-bottom: 28px; }
.back-link { color: #666; font-size: 13px; text-decoration: none; display: inline-block; margin-bottom: 16px; }
.back-link:hover { color: #1a1a2e; }
.video-detail-meta { display: flex; gap: 20px; align-items: flex-start; }
.video-thumb-lg { width: 200px; height: 112px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.video-detail-title { font-size: 18px; margin: 0 0 10px; line-height: 1.4; }
.video-detail-title a { color: #1a1a2e; text-decoration: none; }
.video-detail-title a:hover { text-decoration: underline; }
.video-chips { display: flex; gap: 8px; flex-wrap: wrap; }

/* Charts */
.charts-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.chart-card { background: #fff; border-radius: 8px; padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.chart-title { font-size: 13px; font-weight: 600; color: #444; margin-bottom: 14px; }
.chart-empty { margin: 0; }
.single-stat { font-size: 22px; font-weight: 700; color: #1a1a2e; margin-top: 8px; }

/* Growth column */
.growth-pos { color: #059669; font-weight: 600; }

/* YT external link */
.yt-link { color: #aaa; font-size: 11px; margin-left: 5px; text-decoration: none; }
.yt-link:hover { color: #e74c3c; }

/* Widget values */
.widget-value--hot  { color: #e74c3c; }
.widget-value--ok   { color: #27ae60; }
.widget-value--text { font-size: 16px; }

/* Event feed */
.feed-item { display: flex; align-items: baseline; gap: 10px; padding: 10px 0;
    border-bottom: 1px solid #f0f0f0; }
.feed-item:last-child { border-bottom: none; }
.feed-icon { font-size: 16px; flex-shrink: 0; }
.feed-msg  { flex: 1; font-size: 13px; color: #333; line-height: 1.4; }
.feed-time { font-size: 11px; color: #aaa; white-space: nowrap; flex-shrink: 0; }

/* Growth cells */
.growth-neg  { color: #dc2626; }
.growth-zero { color: #aaa; }
.th-num { text-align: right; }
.sortable-active { background: #f0f4ff; }

/* Filter bar */
.filter-bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
    background: #fff; padding: 12px 16px; border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.07); margin-bottom: 16px; }
.filter-bar input[type=text] { padding: 6px 10px; border: 1px solid #ddd;
    border-radius: 4px; font-size: 13px; min-width: 220px; }
.filter-check { font-size: 13px; color: #444; display: flex; align-items: center; gap: 5px; cursor: pointer; }

/* Search page */
.meta-sub { font-size: 11px; color: #888; }
.opp-banner { background: #fffbeb; border: 1px solid #fcd34d; color: #92400e;
    padding: 12px 16px; border-radius: 8px; margin-bottom: 20px; font-size: 13px; }
tr.row--top3 td { background: #f0f9ff; }
tr.row--opportunity td { }

/* Tabs */
.tabs { display: flex; gap: 4px; margin-bottom: 24px; border-bottom: 2px solid #eee; }
.tab-btn { background: none; border: none; padding: 10px 18px; font-size: 14px;
    cursor: pointer; color: #666; border-bottom: 2px solid transparent; margin-bottom: -2px; }
.tab-btn.active { color: #1a1a2e; border-bottom-color: #1a1a2e; font-weight: 600; }
.tab-btn:hover:not(.active) { color: #333; }

/* Settings grid */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.settings-card { background: #fff; border-radius: 8px; padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.settings-card h3 { margin: 0 0 14px; font-size: 14px; color: #1a1a2e; }
.settings-dl { margin: 0; }
.settings-dl dt { font-size: 11px; color: #888; margin-top: 10px; }
.settings-dl dd { margin: 2px 0 0; font-size: 13px; color: #333; }

/* Table actions */
.td-actions { white-space: nowrap; }
.btn-sm--danger { color: #e74c3c; }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.4);
    display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal-box { background: #fff; border-radius: 10px; padding: 24px; width: 480px;
    max-width: 95vw; box-shadow: 0 8px 32px rgba(0,0,0,0.2); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-header button { background: none; border: none; font-size: 18px; cursor: pointer; color: #888; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; color: #666; margin-bottom: 4px; }
.form-group input { width: 100%; padding: 8px 10px; border: 1px solid #ddd;
    border-radius: 4px; font-size: 13px; box-sizing: border-box; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Ideas page */
.status-select { padding: 4px 8px; border: 1px solid #ddd; border-radius: 4px;
    font-size: 12px; cursor: pointer; }

/* Avg VPH baseline bar */
.avg-vph-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    background: #f0f4ff; border: 1px solid #dbe4ff; border-radius: 8px;
    padding: 10px 16px; margin-bottom: 16px; font-size: 13px; }
.avg-vph-label { color: #555; font-weight: 500; }
.avg-vph-value { font-size: 18px; font-weight: 700; color: #2563eb; }
.avg-vph-hint { color: #888; font-size: 12px; }

/* Outlier multiplier badge (vidIQ-style) */
.outlier-x { display: inline-block; padding: 1px 7px; border-radius: 10px;
    font-size: 12px; font-weight: 700; background: #f0f0f0; color: #666; cursor: default; }
.outlier-x--blue   { background: #dbeafe; color: #1d4ed8; }
.outlier-x--purple { background: #ede9fe; color: #6d28d9; }
.outlier-x--red    { background: #fee2e2; color: #b91c1c; }

/* Outlier score badge */
.channel-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.outlier-score { display: inline-flex; align-items: center; gap: 4px;
    background: #fff3cd; color: #92400e; border: 1px solid #f59e0b;
    border-radius: 20px; padding: 2px 10px; font-size: 12px; font-weight: 600;
    white-space: nowrap; cursor: default; }
.outlier-score--lg { font-size: 14px; padding: 4px 14px; }

/* Homepage page */
.hp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 800px) { .hp-grid { grid-template-columns: 1fr; } }
.hp-card { min-width: 0; }
.kw-cloud { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 0; align-items: baseline; }
.kw-tag { background: #e8eeff; color: #2563eb; padding: 4px 10px; border-radius: 20px;
    line-height: 1.4; cursor: default; transition: background 0.15s; }
.kw-tag:hover { background: #c7d4fd; }
