/* ── Variables ─────────────────────────────────────────────────────────── */
:root {
    --bg: #0a0c10;
    --bg2: #111420;
    --bg3: #181d2e;
    --border: #1e2540;
    --border2: #252d45;
    --accent: #4f8ef7;
    --accent2: #7c5af0;
    --accent3: #3ecf8e;
    --text: #e2e8f0;
    --text2: #94a3b8;
    --text3: #64748b;
    --danger: #ef4444;
    --warn: #f59e0b;
    --font: "Inter", system-ui, sans-serif;
    --mono: "JetBrains Mono", "Fira Code", monospace;
    --radius: 10px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

/* ── Reset ─────────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
html {
    scroll-behavior: smooth;
}
body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.6;
    min-height: 100vh;
}
a {
    color: var(--accent);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

/* ── Header ─────────────────────────────────────────────────────────────── */
.site-header {
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}
.header-inner {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    gap: 24px;
}
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.logo-icon {
    font-size: 20px;
    color: var(--accent);
}
.logo-text {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}
.logo-sub {
    font-size: 11px;
    color: var(--text3);
    display: none;
}
@media (min-width: 640px) {
    .logo-sub {
        display: block;
    }
}

.main-nav {
    display: flex;
    gap: 4px;
    flex: 1;
}
.nav-link {
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text2);
    transition: all 0.15s;
}
.nav-link:hover,
.nav-link.active {
    color: var(--text);
    background: var(--border);
    text-decoration: none;
}
.nav-link.active {
    color: var(--accent);
}

.header-status {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.crawl-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text2);
}
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text3);
}
.status-dot.idle {
    background: var(--accent3);
}
.status-dot.pulsing {
    background: var(--warn);
    animation: pulse 1s ease-in-out infinite;
}
@keyframes pulse {
    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(0.8);
    }
}

.btn-crawl {
    padding: 6px 14px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    font-family: var(--font);
}
.btn-crawl:hover {
    background: #6ba3f9;
}
.btn-crawl:disabled {
    opacity: 0.5;
    cursor: default;
}

/* ── Main ───────────────────────────────────────────────────────────────── */
.main-content {
    max-width: 1600px;
    margin: 0 auto;
    padding: 24px;
}

/* ── Controls Bar ───────────────────────────────────────────────────────── */
.controls-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 24px;
}
.filters-form {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    flex: 1;
}
.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.filter-group label {
    font-size: 11px;
    color: var(--text3);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.filter-group select,
.filter-group .search-input {
    background: var(--bg3);
    border: 1px solid var(--border2);
    color: var(--text);
    padding: 7px 10px;
    border-radius: 6px;
    font-size: 13px;
    font-family: var(--font);
    outline: none;
    transition: border-color 0.15s;
    min-width: 140px;
}
.filter-group select:focus,
.filter-group .search-input:focus {
    border-color: var(--accent);
}
.search-group {
    flex: 1;
    min-width: 240px;
}
.search-row {
    display: flex;
    gap: 6px;
    align-items: center;
}
.search-input {
    flex: 1;
}
.btn-search {
    padding: 7px 14px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font);
}
.btn-search:hover {
    background: #6ba3f9;
}
.btn-clear {
    padding: 7px 10px;
    background: var(--bg3);
    color: var(--text2);
    border: 1px solid var(--border2);
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
}
.btn-clear:hover {
    color: var(--danger);
    border-color: var(--danger);
    text-decoration: none;
}

.stats-bar {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.stat-pill {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 4px 12px;
    display: flex;
    gap: 5px;
    align-items: center;
}
.stat-num {
    font-weight: 700;
    color: var(--accent);
    font-size: 13px;
}
.stat-label {
    color: var(--text3);
    font-size: 12px;
}

/* ── Panels ─────────────────────────────────────────────────────────────── */
.panel {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.panel-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.panel-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}
.panel-icon {
    color: var(--accent);
    font-size: 14px;
}
.filter-badge {
    font-size: 11px;
    background: var(--accent);
    color: #fff;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 500;
}
.count-badge {
    font-size: 11px;
    background: var(--bg3);
    color: var(--text3);
    padding: 2px 8px;
    border-radius: 20px;
}

/* ── Dashboard Grid ─────────────────────────────────────────────────────── */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 20px;
    align-items: start;
}
@media (max-width: 1100px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .panel-side {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 20px;
    }
}
@media (max-width: 640px) {
    .panel-side {
        grid-template-columns: 1fr;
    }
}
.panel-side {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ── Trends List ────────────────────────────────────────────────────────── */
.trends-list {
    padding: 8px 0;
}
.trend-item {
    display: flex;
    gap: 12px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border);
    transition: background 0.1s;
}
.trend-item:last-child {
    border-bottom: none;
}
.trend-item:hover {
    background: var(--bg3);
}
.trend-rank {
    font-size: 11px;
    font-weight: 700;
    color: var(--text3);
    width: 24px;
    flex-shrink: 0;
    padding-top: 2px;
    font-family: var(--mono);
}
.trend-body {
    flex: 1;
    min-width: 0;
}
.trend-term-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 5px;
}
.trend-term {
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
    text-transform: capitalize;
}
.trend-meta {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}
.trend-bar-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.trend-bar {
    height: 4px;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    border-radius: 2px;
    transition: width 0.5s ease;
}
.trend-score {
    font-size: 11px;
    color: var(--text3);
    white-space: nowrap;
    font-family: var(--mono);
}
.trends-empty {
    padding: 32px 24px;
    color: var(--text2);
    font-size: 13px;
    line-height: 1.8;
}
.trend-articles {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.trend-article-link {
    display: flex;
    gap: 6px;
    align-items: baseline;
    font-size: 12px;
    color: var(--text2);
    text-decoration: none;
    transition: color 0.1s;
}
.trend-article-link:hover {
    color: var(--accent);
    text-decoration: none;
}
.article-source {
    font-size: 10px;
    font-weight: 600;
    color: var(--accent);
    background: rgba(79, 142, 247, 0.1);
    padding: 1px 5px;
    border-radius: 3px;
    white-space: nowrap;
    flex-shrink: 0;
}
.article-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Badges ─────────────────────────────────────────────────────────────── */
.badge {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.badge-cat {
    background: rgba(79, 142, 247, 0.12);
    color: var(--accent);
}
.badge-region {
    background: rgba(62, 207, 142, 0.12);
    color: var(--accent3);
}

/* ── Charts ─────────────────────────────────────────────────────────────── */
.chart-wrap {
    padding: 14px 16px 10px;
}
.donut-wrap {
    display: flex;
    justify-content: center;
}

/* ── Region Bars ────────────────────────────────────────────────────────── */
.region-bars {
    padding: 12px 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.region-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.region-label {
    font-size: 11px;
    color: var(--text2);
    width: 60px;
    flex-shrink: 0;
}
.region-bar-outer {
    flex: 1;
    height: 6px;
    background: var(--bg3);
    border-radius: 3px;
    overflow: hidden;
}
.region-bar-inner {
    height: 100%;
    background: linear-gradient(90deg, var(--accent3), var(--accent));
    border-radius: 3px;
    transition: width 0.5s ease;
}
.region-count {
    font-size: 11px;
    color: var(--text3);
    width: 28px;
    text-align: right;
    font-family: var(--mono);
}

/* ── Sources mini ───────────────────────────────────────────────────────── */
.sources-mini-list {
    padding: 8px 18px;
}
.source-mini-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
}
.source-mini-row:last-child {
    border-bottom: none;
}
.source-mini-name {
    color: var(--text2);
}
.source-mini-count {
    color: var(--accent);
    font-family: var(--mono);
    font-size: 11px;
}

/* ── Articles Grid ──────────────────────────────────────────────────────── */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.article-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition:
        border-color 0.15s,
        transform 0.1s;
}
.article-card:hover {
    border-color: var(--border2);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}
.article-card-meta {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}
.article-source-name {
    font-size: 11px;
    color: var(--text3);
    margin-left: 2px;
}
.article-card-title {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.5;
}
.article-card-title a {
    color: var(--text);
}
.article-card-title a:hover {
    color: var(--accent);
    text-decoration: none;
}
.article-card-summary {
    font-size: 12px;
    color: var(--text2);
    line-height: 1.6;
}
.article-card-footer {
    margin-top: auto;
}
.article-time {
    font-size: 11px;
    color: var(--text3);
}

/* ── Pagination ─────────────────────────────────────────────────────────── */
.pagination {
    display: flex;
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
}
.page-btn {
    padding: 7px 12px;
    background: var(--bg2);
    border: 1px solid var(--border);
    color: var(--text2);
    border-radius: 6px;
    font-size: 13px;
    transition: all 0.15s;
}
.page-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    text-decoration: none;
}
.page-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* ── Sources Page ───────────────────────────────────────────────────────── */
.sources-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 24px;
}
.sources-nav-chip {
    padding: 5px 12px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 12px;
    color: var(--text2);
    transition: all 0.15s;
}
.sources-nav-chip:hover {
    border-color: var(--accent);
    color: var(--accent);
    text-decoration: none;
}
.sources-sections {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.sources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0;
}

/* ── Empty State ────────────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 80px 24px;
    color: var(--text2);
}
.empty-icon {
    font-size: 48px;
    color: var(--text3);
    margin-bottom: 16px;
}
.empty-state h2 {
    font-size: 20px;
    margin-bottom: 8px;
    color: var(--text);
}
.empty-state p {
    font-size: 14px;
    margin-bottom: 24px;
}
.btn-crawl-big {
    padding: 12px 28px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font);
    transition: background 0.15s;
}
.btn-crawl-big:hover {
    background: #6ba3f9;
}

/* ── Toast ──────────────────────────────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--bg2);
    border: 1px solid var(--border2);
    border-radius: 8px;
    padding: 12px 18px;
    font-size: 13px;
    box-shadow: var(--shadow);
    z-index: 999;
    transition: all 0.3s;
    max-width: 320px;
}
.toast.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
}
.toast.success {
    border-color: var(--accent3);
    color: var(--accent3);
}
.toast.info {
    border-color: var(--accent);
    color: var(--accent);
}

/* ── Sources page: add button + card actions ────────────────────────────── */
.page-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}
.page-hero-text h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 6px;
}
.page-hero-text p {
    color: var(--text2);
    font-size: 14px;
}

.btn-add-source {
    padding: 9px 18px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font);
    transition: background 0.15s;
    white-space: nowrap;
    flex-shrink: 0;
}
.btn-add-source:hover {
    background: #6ba3f9;
}

.source-card {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
}
.source-card:hover {
    background: var(--bg3);
}
.source-card:hover .source-card-actions {
    opacity: 1;
}
.source-card-header {
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: space-between;
}
.source-card-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
}
.source-card-badges {
    display: flex;
    gap: 4px;
    align-items: center;
}
.source-url {
    font-size: 10px;
    color: var(--text3);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.source-url:hover {
    color: var(--accent);
}
.badge-custom {
    background: rgba(124, 90, 240, 0.15);
    color: var(--accent2);
}

.source-card-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s;
    margin-top: 2px;
}
.btn-icon {
    padding: 3px 7px;
    background: transparent;
    border: 1px solid var(--border2);
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    font-family: var(--font);
    transition: all 0.12s;
    line-height: 1.4;
}
.btn-edit {
    color: var(--accent);
}
.btn-edit:hover {
    background: rgba(79, 142, 247, 0.12);
    border-color: var(--accent);
}
.btn-delete {
    color: var(--danger);
}
.btn-delete:hover {
    background: rgba(239, 68, 68, 0.12);
    border-color: var(--danger);
}

/* ── Modal ──────────────────────────────────────────────────────────────── */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 24px;
    backdrop-filter: blur(4px);
}
.modal-backdrop.hidden {
    display: none;
}
.modal {
    background: var(--bg2);
    border: 1px solid var(--border2);
    border-radius: 12px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
    animation: modalIn 0.18s ease;
}
@keyframes modalIn {
    from {
        opacity: 0;
        transform: translateY(-12px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--border);
}
.modal-title {
    font-size: 15px;
    font-weight: 700;
}
.modal-close {
    background: none;
    border: none;
    color: var(--text3);
    font-size: 16px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    line-height: 1;
    font-family: var(--font);
}
.modal-close:hover {
    color: var(--text);
    background: var(--bg3);
}
.modal-form {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.form-group label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text2);
}
.form-group label .required {
    color: var(--danger);
}
.form-group input {
    background: var(--bg3);
    border: 1px solid var(--border2);
    color: var(--text);
    padding: 9px 12px;
    border-radius: 7px;
    font-size: 13px;
    font-family: var(--font);
    outline: none;
    transition: border-color 0.15s;
}
.form-group input:focus {
    border-color: var(--accent);
}
.form-group input::placeholder {
    color: var(--text3);
}
.form-error {
    font-size: 12px;
    color: var(--danger);
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: 6px;
    padding: 8px 12px;
}
.form-error.hidden {
    display: none;
}
.form-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    padding-top: 4px;
}
.btn-secondary {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--border2);
    color: var(--text2);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    font-family: var(--font);
    transition: all 0.12s;
}
.btn-secondary:hover {
    background: var(--bg3);
    color: var(--text);
}
.btn-primary {
    padding: 8px 18px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font);
    transition: background 0.12s;
}
.btn-primary:hover {
    background: #6ba3f9;
}
.btn-primary:disabled {
    opacity: 0.6;
    cursor: default;
}

/* ── Breaking News ──────────────────────────────────────────────────────── */
.breaking-section {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.06) 0%, rgba(245, 158, 11, 0.04) 100%);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius);
    margin-bottom: 24px;
    overflow: hidden;
}
.breaking-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(239, 68, 68, 0.15);
    background: rgba(239, 68, 68, 0.06);
}
.breaking-badge {
    font-size: 11px;
    font-weight: 800;
    color: #ef4444;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    animation: breakingPulse 2s ease-in-out infinite;
}
@keyframes breakingPulse {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}
.breaking-sub {
    font-size: 11px;
    color: var(--text3);
}
.breaking-time {
    font-size: 11px;
    color: var(--text3);
    margin-left: auto;
}

.breaking-ticker {
    display: flex;
    flex-direction: column;
}
.breaking-item {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 9px 16px;
    border-bottom: 1px solid rgba(239, 68, 68, 0.08);
    text-decoration: none;
    transition: background 0.12s;
}
.breaking-item:last-child {
    border-bottom: none;
}
.breaking-item:hover {
    background: rgba(239, 68, 68, 0.06);
    text-decoration: none;
}
.breaking-source {
    font-size: 10px;
    font-weight: 700;
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    padding: 1px 6px;
    border-radius: 3px;
    white-space: nowrap;
    flex-shrink: 0;
}
.breaking-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    flex: 1;
    line-height: 1.4;
}
.breaking-age {
    font-size: 10px;
    color: var(--text3);
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Trend word stats panel ─────────────────────────────────────────────── */
.trend-words-chart-wrap {
    padding: 12px 14px;
    overflow: hidden;
}
.trend-words-chart-wrap canvas {
    cursor: pointer;
}

/* ── Trend clickable hint ───────────────────────────────────────────────── */
.trend-link-icon {
    font-size: 10px;
    color: var(--text3);
    opacity: 0;
    transition: opacity 0.15s;
}
.trend-item:hover .trend-link-icon {
    opacity: 1;
    color: var(--accent);
}

/* ── Stats page ─────────────────────────────────────────────────────────── */
.stats-page-header {
    margin-bottom: 24px;
}
.back-link {
    font-size: 13px;
    color: var(--text3);
    display: inline-block;
    margin-bottom: 16px;
    transition: color 0.15s;
}
.back-link:hover {
    color: var(--accent);
    text-decoration: none;
}
.stats-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 24px;
}
.stats-term {
    font-size: 28px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.03em;
}
.stats-hero-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.hero-pill {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 90px;
}
.hero-num {
    font-size: 22px;
    font-weight: 700;
    color: var(--accent);
    font-family: var(--mono);
}
.hero-label {
    font-size: 11px;
    color: var(--text3);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 2px;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
    align-items: start;
}
@media (max-width: 900px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}
.stats-side {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.chart-legend {
    display: flex;
    align-items: center;
    font-size: 11px;
    color: var(--text3);
}
.legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 5px;
}

.src-bar-wrap {
    flex: 1;
    height: 4px;
    background: var(--bg3);
    border-radius: 2px;
    overflow: hidden;
    margin: 0 8px;
}
.src-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent3), var(--accent));
    border-radius: 2px;
}

.daily-table-wrap {
    overflow-x: auto;
}
.daily-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.daily-table th {
    padding: 8px 14px;
    text-align: left;
    color: var(--text3);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
    font-weight: 500;
}
.daily-table td {
    padding: 7px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text2);
}
.daily-table tr:last-child td {
    border-bottom: none;
}
.daily-table tr:hover td {
    background: var(--bg3);
}
.peak-row td {
    color: var(--text);
}
.peak-badge {
    font-size: 9px;
    background: rgba(245, 158, 11, 0.15);
    color: var(--warn);
    border-radius: 3px;
    padding: 1px 5px;
    margin-left: 5px;
    font-weight: 600;
    vertical-align: middle;
}

.recent-articles-list {
    padding: 4px 0;
}
.recent-article-row {
    padding: 10px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: background 0.1s;
}
.recent-article-row:last-child {
    border-bottom: none;
}
.recent-article-row:hover {
    background: var(--bg3);
}
.recent-article-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}
.recent-article-date {
    font-size: 11px;
    color: var(--text3);
}
.recent-article-title {
    font-size: 13px;
    color: var(--text);
    font-weight: 500;
    line-height: 1.5;
}
.recent-article-title:hover {
    color: var(--accent);
    text-decoration: none;
}

/* ── Filter-out terms ───────────────────────────────────────────────────── */
.btn-filter-out {
    background: none;
    border: 1px solid var(--border2);
    border-radius: 4px;
    color: var(--text3);
    font-size: 10px;
    padding: 2px 7px;
    cursor: pointer;
    white-space: nowrap;
    opacity: 0;
    transition:
        opacity 0.15s,
        color 0.15s,
        border-color 0.15s;
    margin-left: 6px;
}
.trend-item:hover .btn-filter-out {
    opacity: 1;
}
.btn-filter-out:hover {
    color: var(--danger);
    border-color: var(--danger);
}

.show-more-wrap {
    padding: 12px 16px;
    text-align: center;
    display: flex;
    gap: 8px;
    justify-content: center;
}
.btn-show-more {
    background: none;
    border: 1px solid var(--border);
    color: var(--accent);
    border-radius: 6px;
    padding: 6px 16px;
    font-size: 13px;
    cursor: pointer;
    transition:
        background 0.15s,
        border-color 0.15s;
}
.btn-show-more:hover {
    background: var(--bg3);
    border-color: var(--accent);
}

.filtered-count {
    font-size: 11px;
    color: var(--text3);
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 2px 9px;
    margin-left: auto;
}
.filtered-count:hover {
    color: var(--text2);
    border-color: var(--border2);
}

.filtered-panel {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: var(--bg3);
}
.filtered-panel-title {
    font-size: 11px;
    color: var(--text3);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.filtered-remove-all {
    background: none;
    border: 1px solid var(--border2);
    border-radius: 4px;
    color: var(--danger);
    font-size: 10px;
    padding: 2px 8px;
    cursor: pointer;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 500;
}
.filtered-remove-all:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--danger);
}
.filtered-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.filtered-tag {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--text2);
    background: var(--bg2);
    border: 1px solid var(--border2);
    border-radius: 6px;
    padding: 3px 10px;
}
.filtered-tag-remove {
    background: none;
    border: none;
    color: var(--accent3);
    cursor: pointer;
    font-size: 12px;
    padding: 0;
    line-height: 1;
}
.filtered-tag-remove:hover {
    color: var(--text);
}

/* ── Settings bar ───────────────────────────────────────────────────────── */
.settings-bar {
    margin-bottom: 18px;
    padding: 14px 20px;
}
.settings-bar-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
.settings-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text2);
    white-space: nowrap;
}
.settings-interval-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.settings-interval-input {
    width: 72px;
    padding: 6px 10px;
    background: var(--bg3);
    border: 1px solid var(--border2);
    border-radius: 6px;
    color: var(--text);
    font-size: 13px;
    font-family: var(--mono);
    text-align: center;
}
.settings-interval-input:focus {
    outline: none;
    border-color: var(--accent);
}
.settings-unit {
    font-size: 13px;
    color: var(--text3);
}
.btn-sm {
    padding: 6px 14px;
    font-size: 12px;
}
.settings-hint {
    font-size: 12px;
    color: var(--text3);
}

/* ── Breaking News nav ──────────────────────────────────────────────────── */
.nav-breaking {
    color: #ef4444 !important;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.nav-breaking:hover,
.nav-breaking.active {
    color: #ff6b6b !important;
}

/* ── Breaking News page ─────────────────────────────────────────────────── */
.breaking-pill .stat-num {
    color: #ef4444;
}

.breaking-page-hero {
    padding: 28px 0 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.breaking-page-title {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}
.breaking-badge-lg {
    font-size: 13px;
    padding: 5px 14px;
    border-radius: 6px;
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    font-weight: 700;
    letter-spacing: 0.08em;
    border: 1px solid rgba(239, 68, 68, 0.3);
    text-transform: uppercase;
}
.breaking-page-sub {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
}
.breaking-summary-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* ── Breaking cards grid ─────────────────────────────────────────────────── */
.breaking-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
    padding-bottom: 40px;
}

.breaking-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition:
        border-color 0.15s,
        transform 0.1s,
        box-shadow 0.15s;
}
.breaking-card:hover {
    border-color: var(--border2);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}
.breaking-card-hot {
    border-color: rgba(239, 68, 68, 0.35);
    background: linear-gradient(135deg, var(--bg2), rgba(239, 68, 68, 0.05));
}
.breaking-card-hot:hover {
    border-color: rgba(239, 68, 68, 0.6);
}

.breaking-card-header {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.breaking-source-tag {
    font-size: 11px;
    font-weight: 600;
    color: var(--text3);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-right: 4px;
}
.breaking-card-age {
    font-size: 10px;
    color: var(--text3);
    margin-left: auto;
}

.breaking-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.5;
    display: block;
}
.breaking-card-title:hover {
    color: var(--accent);
    text-decoration: none;
}

.breaking-card-summary {
    font-size: 12px;
    color: var(--text2);
    line-height: 1.55;
    flex: 1;
}

.breaking-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 6px;
    border-top: 1px solid var(--border);
}
.breaking-score-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}
.score-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ef4444;
    opacity: 0.7;
}
.breaking-read-more {
    font-size: 11px;
    color: var(--accent);
    font-weight: 600;
    letter-spacing: 0.03em;
}
.breaking-read-more:hover {
    color: #fff;
    text-decoration: none;
}

.btn-inline {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: inherit;
    padding: 0;
    text-decoration: underline;
}

@media (max-width: 700px) {
    .breaking-cards-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Utility ────────────────────────────────────────────────────────────── */
.mono {
    font-family: var(--mono);
}

/* ── Scrollbar ──────────────────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg);
}
::-webkit-scrollbar-thumb {
    background: var(--border2);
    border-radius: 3px;
}

/* ── Dashboard page ─────────────────────────────────────────────────────── */
.dashboard-page-header {
    display: flex;
    align-items: baseline;
    gap: 20px;
    padding: 20px 0 8px;
    flex-wrap: wrap;
}
.dashboard-page-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--fg);
}
.dashboard-page-meta {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.filter-sel-sm {
    background: var(--surface2);
    border: 1px solid var(--border2);
    color: var(--fg);
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 12px;
}

/* Range picker */
.range-picker {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 10px 14px;
    background: var(--surface2);
    border: 1px solid var(--border2);
    border-radius: 10px;
}
.range-presets {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.range-btn {
    padding: 5px 13px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 6px;
    border: 1px solid var(--border2);
    background: var(--surface);
    color: var(--muted);
    text-decoration: none;
    transition:
        background 0.15s,
        color 0.15s,
        border-color 0.15s;
}
.range-btn:hover {
    background: var(--surface2);
    color: var(--fg);
}
.range-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.range-day-form {
    display: flex;
    align-items: center;
    gap: 6px;
}
.range-form-label {
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
}
.range-custom-form {
    display: flex;
    align-items: center;
    gap: 6px;
}
.range-custom-input {
    width: 72px;
    padding: 4px 8px;
    font-size: 12px;
    background: var(--surface);
    border: 1px solid var(--border2);
    color: var(--fg);
    border-radius: 6px;
}
.range-go-btn {
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 6px;
    background: var(--surface);
    border: 1px solid var(--border2);
    color: var(--fg);
    cursor: pointer;
}
.range-go-btn:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.range-active-label {
    font-size: 11px;
    color: var(--muted);
    margin-left: auto;
    white-space: nowrap;
    font-family: var(--mono);
}

/* KPI row */
.kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.kpi-card {
    background: var(--surface2);
    border: 1px solid var(--border2);
    border-radius: 10px;
    padding: 16px 14px;
    text-align: center;
}
.kpi-num {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
    line-height: 1;
}
.kpi-label {
    font-size: 11px;
    color: var(--muted);
    margin-top: 4px;
}
.kpi-sub {
    font-size: 10px;
    color: var(--muted2, #64748b);
    margin-top: 2px;
}

/* Grid layouts */
.dash-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}
.dash-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}
@media (max-width: 900px) {
    .dash-grid-2,
    .dash-grid-3 {
        grid-template-columns: 1fr;
    }
}

/* Leaderboard */
.leaderboard {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 4px 0;
}
.lb-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}
.lb-rank {
    width: 28px;
    text-align: right;
    color: var(--muted);
    font-size: 11px;
}
.lb-name {
    width: 160px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--fg);
}
.lb-link {
    color: var(--accent);
    text-decoration: none;
}
.lb-link:hover {
    text-decoration: underline;
}
.lb-bar-outer {
    flex: 1;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}
.lb-bar-inner {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.3s;
}
.lb-count {
    width: 72px;
    text-align: right;
    color: var(--muted);
    font-size: 11px;
    white-space: nowrap;
}

/* Panel sub-label */
.panel-sub {
    font-size: 11px;
    color: var(--muted);
    margin-left: 8px;
}

/* Silent sources */
.silent-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 4px 0;
}
.silent-tag {
    background: var(--surface2);
    border: 1px solid var(--border2);
    border-radius: 5px;
    padding: 3px 8px;
    font-size: 11px;
    color: var(--muted);
}
.silent-region {
    color: var(--muted2, #64748b);
    font-size: 10px;
}
.silent-more {
    font-size: 11px;
    color: var(--muted);
    padding: 3px 6px;
}
.muted-note {
    color: var(--muted);
    font-size: 12px;
    padding: 8px 0;
}

/* Top per category grid */
.top-per-cat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
    padding: 4px 0;
}
.tpc-card {
    background: var(--surface2);
    border: 1px solid var(--border2);
    border-radius: 8px;
    padding: 12px;
}
.tpc-cat {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin-bottom: 4px;
}
.tpc-term {
    font-size: 15px;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    display: block;
    margin-bottom: 4px;
}
.tpc-term:hover {
    text-decoration: underline;
}
.tpc-score {
    font-size: 11px;
    color: var(--muted);
}

/* Heatmaps */
.heatmap-wrap {
    overflow-x: auto;
}
.heatmap-table {
    border-collapse: collapse;
    font-size: 11px;
    width: 100%;
}
.heatmap-table th {
    padding: 3px 5px;
    color: var(--muted);
    font-weight: 500;
    white-space: nowrap;
    text-align: center;
}
.hm-label {
    padding: 3px 8px 3px 2px;
    color: var(--fg);
    white-space: nowrap;
    text-align: right;
    font-weight: 500;
    min-width: 70px;
}
.hm-cell {
    padding: 3px 4px;
    text-align: center;
    min-width: 24px;
    border-radius: 2px;
    cursor: default;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.8);
}
.hm-small .hm-cell {
    min-width: 18px;
    padding: 2px 2px;
}
.hm-small th {
    padding: 2px 3px;
    font-size: 10px;
}

/* Full table */
.table-scroll {
    overflow-x: auto;
}
.stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.stats-table th {
    text-align: left;
    padding: 6px 10px;
    color: var(--muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border2);
    white-space: nowrap;
}
.stats-table td {
    padding: 5px 10px;
    border-bottom: 1px solid var(--border);
}
.stats-table tr:last-child td {
    border-bottom: none;
}
.td-source {
    font-weight: 500;
    color: var(--fg);
    white-space: nowrap;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text3);
}
