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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.5;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

header h1 {
    font-size: 24px;
    font-weight: 600;
}

/* Header layout adjustments */
.header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.header-nav {
    display: flex;
    gap: 16px;
    align-items: center;
}

.btn-crawl-header {
    background: #007bff;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
}

.btn-crawl-header:hover {
    background: #0056b3;
}

.btn-crawl-header:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* User section */
.user-section {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-email-input {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    width: 180px;
}

.user-email-input:disabled {
    background-color: #f5f5f5;
    color: #666;
    border-color: #e0e0e0;
}

.user-email-input:focus {
    outline: none;
    border-color: #007bff;
}

.user-button {
    padding: 6px 12px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}

.user-button:hover {
    background-color: #0056b3;
}

.user-button.unset {
    background-color: #6c757d;
}

.user-button.unset:hover {
    background-color: #545b62;
}

/* Login Section */
.login-section {
    background: white;
    border-radius: 8px;
    padding: 12px 16px;
    margin-top: 16px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.login-form {
    display: flex;
    gap: 8px;
}

.login-email-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.login-email-input:focus {
    outline: none;
    border-color: #007bff;
}

.login-button {
    padding: 10px 20px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
}

.login-button:hover {
    background-color: #0056b3;
}

/* Demo Banner */
.demo-banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.demo-banner-icon {
    width: 24px;
    height: 24px;
    background: #ffc107;
    color: #856404;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    flex-shrink: 0;
}

.demo-banner-text {
    flex: 1;
}

.demo-banner-text strong {
    display: block;
    color: #856404;
    margin-bottom: 4px;
}

.demo-banner-text p {
    margin: 0;
    color: #856404;
    font-size: 14px;
}

/* Add Feed Section */
.add-feed-section {
    margin-bottom: 16px;
}

.add-feed-form {
    display: flex;
    gap: 8px;
}

.feed-url-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.feed-url-input:focus {
    outline: none;
    border-color: #007bff;
}

.btn-subscribe {
    padding: 8px 16px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
}

.btn-subscribe:hover {
    background-color: #218838;
}

.btn-subscribe:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
}

/* Feed input container for autocomplete positioning */
.feed-input-container {
    position: relative;
    flex: 1;
}

.feed-input-container .feed-url-input {
    width: 100%;
}

/* Autocomplete dropdown */
.feed-autocomplete {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
}

.autocomplete-item {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
}

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

.autocomplete-item:hover {
    background: #f5f5f5;
}

.autocomplete-title {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.autocomplete-url {
    font-size: 11px;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

/* Feed error message */
.feed-error {
    margin-top: 8px;
    padding: 8px 12px;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    color: #721c24;
    font-size: 13px;
}

/* User Feeds Section */
.user-feeds-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #eee;
}

.user-feeds-header {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin: 0 0 12px 0;
}

.user-feeds-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.no-feeds {
    color: #666;
    font-size: 13px;
    font-style: italic;
    margin: 0;
}

.user-feed-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: #f9f9f9;
    border-radius: 4px;
    border: 1px solid #eee;
}

.user-feed-item.confirm-unsubscribe {
    background: #fff3cd;
    border-color: #ffc107;
}

.feed-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.feed-info .feed-title {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.feed-url {
    font-size: 11px;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.unsubscribe-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    background: #dc3545;
    color: white;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-left: 12px;
}

.unsubscribe-btn:hover {
    background: #c82333;
}

.unsubscribe-icon,
.confirm-icon {
    font-size: 16px;
    font-weight: bold;
    line-height: 1;
}

.confirm-unsubscribe .unsubscribe-btn {
    background: #ffc107;
    color: #333;
}

.confirm-unsubscribe .unsubscribe-btn:hover {
    background: #e0a800;
}

.nav-link {
    color: #007bff;
    text-decoration: none;
    font-size: 14px;
}

.nav-link:hover {
    text-decoration: underline;
}

/* File Section */
.file-section {
    background: white;
    border-radius: 8px;
    padding: 16px;
    margin-top: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.dropzone {
    border: 2px dashed #ccc;
    border-radius: 6px;
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.file-section.has-files .dropzone {
    padding: 12px;
}

.dropzone:hover,
.dropzone.dragover {
    border-color: #007bff;
    background: #f8f9ff;
}

.dropzone p {
    color: #666;
    margin: 0;
}

.file-list {
    margin-top: 12px;
}

.no-files {
    color: #999;
    font-size: 14px;
    text-align: center;
    padding: 8px;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 4px;
    margin-bottom: 4px;
}

.file-item.confirm-delete {
    background: #fff3cd;
}

.file-name {
    font-size: 14px;
    font-family: monospace;
}

.delete-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    font-size: 18px;
    color: #999;
    border-radius: 4px;
}

.delete-btn:hover {
    background: #fee;
    color: #c00;
}

.confirm-delete .delete-btn {
    background: #dc3545;
    color: white;
}

.pipeline-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #eee;
    font-size: 14px;
}

#last-crawl {
    color: #666;
}

.btn-crawl {
    background: #007bff;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.btn-crawl:hover {
    background: #0056b3;
}

.btn-crawl:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Filters */
.filters-section {
    display: flex;
    gap: 16px;
    background: white;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-size: 14px;
    color: #666;
}

.filter-group select,
.filter-group input {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.filter-group input[type="number"] {
    width: 70px;
}

/* Articles */
.articles-section {
    background: white;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.articles-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.articles-header h2 {
    font-size: 18px;
    font-weight: 600;
}

#article-count {
    font-size: 14px;
    color: #666;
}

.no-articles,
.error {
    text-align: center;
    padding: 32px;
    color: #666;
}

.error {
    color: #c00;
}

.article-item {
    display: flex;
    gap: 16px;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 8px;
    text-decoration: none;
    color: inherit;
    transition: background 0.2s;
    position: relative;
}

.article-item:hover {
    background: #f8f9fa;
}

.article-score {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    background: #e8f4fd;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
    color: #007bff;
}

.article-content {
    flex: 1;
    min-width: 0;
}

.article-title {
    font-weight: 500;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.article-meta {
    font-size: 13px;
    color: #666;
    margin-bottom: 4px;
}

.article-ratings {
    font-size: 12px;
    color: #999;
}

.article-actions {
    flex-shrink: 0;
    width: 24px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.debug-icon {
    display: inline-block;
    width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    background: #f0f0f0;
    color: #666;
    text-decoration: none;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s;
    cursor: pointer;
}

.debug-icon:hover {
    background: #e0e0e0;
    color: #333;
}

/* Debug Overlay Modal */
.debug-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.debug-overlay-content {
    background: white;
    border-radius: 12px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
    position: relative;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.debug-overlay-content .close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #f0f0f0;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.debug-overlay-content .close-btn:hover {
    background: #e0e0e0;
}

.debug-overlay-content h2 {
    font-size: 20px;
    margin-bottom: 16px;
    padding-right: 80px;
}

.debug-overlay-content h3 {
    font-size: 16px;
    margin-top: 24px;
    margin-bottom: 12px;
    color: #333;
}

.debug-overlay-content .loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

/* Agent Configuration */
.agent-config-section {
    background: white;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.agent-config-header {
    margin-bottom: 12px;
}

.agent-config-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.agent-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.agent-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 4px;
}

.agent-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.agent-name {
    font-size: 14px;
}

.agent-controls {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.agent-control {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: #666;
}

.agent-control span {
    min-width: 40px;
}

.agent-weight {
    display: flex;
    align-items: center;
    gap: 8px;
}

.agent-weight label {
    font-size: 13px;
    color: #666;
}

.agent-weight input {
    width: 60px;
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.agent-cutoff {
    width: 50px;
    padding: 4px 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
}

.agent-cutoff::placeholder {
    color: #bbb;
}

.btn-configure {
    background: #6c757d;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    margin-left: auto;
}

.btn-configure:hover {
    background: #545b62;
}

/* Newsletter Section */
.newsletter-section {
    margin-top: 16px;
    margin-bottom: 16px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.newsletter-toggle {
    display: flex;
    align-items: center;
}

.toggle-container {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
}

.toggle-container input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #007bff;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.toggle-label select {
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: white;
    cursor: pointer;
}

.toggle-label select:focus {
    outline: none;
    border-color: #007bff;
}

.newsletter-error {
    display: none;
    color: #dc3545;
    font-size: 12px;
    margin-top: 8px;
}

/* ============================================
   MOBILE RESPONSIVE STYLES
   ============================================ */

/* Safe area insets for notched devices (iPhone X+, etc.)
   Required when using viewport-fit=cover */
@supports (padding-top: env(safe-area-inset-top)) {
    body {
        padding-top: env(safe-area-inset-top);
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* Small tablets and large phones (< 600px) */
@media (max-width: 600px) {

    /* Header stacking */
    header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    header h1 {
        text-align: center;
    }

    .header-right {
        align-items: center;
    }

    .header-nav {
        justify-content: center;
        flex-wrap: wrap;
    }

    .user-section {
        justify-content: center;
    }

    /* Reduce container padding */
    .container {
        padding: 16px;
    }

    /* Filters */
    .filters-section {
        flex-direction: column;
    }

    .filter-group {
        justify-content: space-between;
    }

    .agent-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .agent-weight {
        width: 100%;
        justify-content: space-between;
    }
}

/* Mobile phones (< 480px) */
@media (max-width: 480px) {

    /* Further reduce padding */
    .container {
        padding: 12px;
    }

    /* Section padding reduction */
    .file-section,
    .articles-section,
    .agent-config-section {
        padding: 12px;
    }

    .filters-section {
        padding: 10px 12px;
        gap: 12px;
    }

    .login-section {
        padding: 10px 12px;
    }

    .demo-banner {
        padding: 12px;
        gap: 10px;
    }

    /* Filter groups full width */
    .filter-group {
        width: 100%;
    }

    .filter-group select,
    .filter-group input {
        flex: 1;
    }

    .btn-configure {
        width: 100%;
        margin-left: 0;
        margin-top: 4px;
    }

    /* Smaller article score box */
    .article-score {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    /* Article items */
    .article-item {
        padding: 10px;
        gap: 12px;
    }

    .article-title {
        font-size: 14px;
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
    }

    .article-meta {
        font-size: 12px;
    }

    .article-ratings {
        font-size: 11px;
    }

    /* Feed items */
    .user-feed-item {
        padding: 8px 10px;
    }

    .feed-url {
        white-space: normal;
        word-break: break-all;
    }

    /* Login form stacking */
    .login-form {
        flex-direction: column;
    }

    .login-button {
        width: 100%;
    }

    /* Add feed form stacking */
    .add-feed-form {
        flex-direction: column;
    }

    .btn-subscribe {
        width: 100%;
    }

    /* Newsletter section mobile */
    .newsletter-section {
        padding: 12px;
    }

    .toggle-container {
        flex-direction: row;
        align-items: center;
        gap: 8px;
    }

    .toggle-label {
        display: flex;
        align-items: center;
        flex-wrap: nowrap;
        gap: 4px;
    }

    /* Header elements */
    header h1 {
        font-size: 20px;
    }

    .user-email-input {
        width: 160px;
        font-size: 12px;
    }

    /* Agent configuration */
    .agent-item {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .agent-controls {
        justify-content: space-between;
    }

    .agent-cutoff {
        width: 45px;
    }

    /* Dropzone */
    .dropzone {
        padding: 20px;
    }

    .dropzone p {
        font-size: 13px;
    }

    /* Debug overlay */
    .debug-overlay {
        padding: 10px;
    }

    .debug-overlay-content {
        padding: 16px;
    }
}

/* Very small phones (< 360px) */
@media (max-width: 360px) {
    .container {
        padding: 8px;
    }

    .file-section,
    .articles-section {
        padding: 10px;
        border-radius: 6px;
    }

    .article-score {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }

    .user-section {
        flex-direction: column;
        gap: 6px;
    }

    .user-email-input {
        width: 100%;
    }

    .user-button {
        width: 100%;
    }
}

/* Debug Page Styles */
.debug-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.debug-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

.debug-header h1 {
    font-size: 24px;
    font-weight: 600;
}

.back-link {
    color: #007bff;
    text-decoration: none;
}

.back-link:hover {
    text-decoration: underline;
}

.debug-layout {
    display: flex;
    gap: 20px;
    flex: 1;
    min-height: 0;
}

.feeds-sidebar {
    width: 280px;
    flex-shrink: 0;
    background: white;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
}

.feeds-sidebar h2 {
    font-size: 16px;
    margin-bottom: 12px;
}

.feeds-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.feed-item {
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.feed-item:hover {
    background: #f5f5f5;
}

.feed-item.active {
    background: #e8f4fd;
    border-left: 3px solid #007bff;
}

.feed-title {
    font-weight: 500;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.feed-meta {
    font-size: 12px;
    color: #666;
    margin-top: 2px;
}

.debug-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    position: relative;
}

.articles-panel {
    background: white;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    flex: 1;
    overflow-y: auto;
}

.articles-panel h2 {
    font-size: 18px;
    margin-bottom: 16px;
}

.debug-article {
    padding: 12px;
    border-radius: 6px;
    cursor: pointer;
    margin-bottom: 8px;
    border: 1px solid #eee;
    transition: all 0.2s;
}

.debug-article:hover {
    background: #f8f9fa;
    border-color: #007bff;
}

.article-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.debug-article .article-title {
    font-weight: 500;
    flex: 1;
}

.combined-score {
    background: #e8f4fd;
    color: #007bff;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 14px;
}

.no-score {
    color: #999;
    font-size: 12px;
}

.debug-article .article-meta {
    font-size: 12px;
    color: #666;
    margin-top: 4px;
}

.article-ratings {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.rating-badge {
    background: #f0f0f0;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.no-ratings {
    color: #999;
    font-size: 12px;
    font-style: italic;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #eee;
}

.pagination button {
    background: #007bff;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
}

.pagination button:hover {
    background: #0056b3;
}

.page-info {
    color: #666;
    font-size: 14px;
}

/* Article Detail Panel */
.article-detail {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    overflow-y: auto;
    z-index: 10;
}

.close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #f0f0f0;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.close-btn:hover {
    background: #e0e0e0;
}

.article-detail h2 {
    font-size: 20px;
    margin-bottom: 16px;
    padding-right: 80px;
}

.article-detail h3 {
    font-size: 16px;
    margin-top: 24px;
    margin-bottom: 12px;
    color: #333;
}

.detail-meta {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 6px;
    font-size: 14px;
}

.detail-meta p {
    margin: 4px 0;
}

.detail-meta code {
    background: #e8e8e8;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
}

.ratings-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rating-detail {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 6px;
    border-left: 3px solid #007bff;
}

.rating-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.rating-score {
    background: #007bff;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
}

.rating-model {
    font-size: 12px;
    color: #666;
    margin-top: 4px;
}

.rating-reasoning {
    margin-top: 8px;
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
}

.content-box {
    background: #f8f9fa;
    padding: 16px;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 300px;
    overflow-y: auto;
}

.content-full {
    max-height: 500px;
    font-family: monospace;
    font-size: 13px;
}

.placeholder,
.loading,
.error {
    text-align: center;
    padding: 24px;
    color: #666;
}

.error {
    color: #c00;
}

/* Stats Page Styles */
.stats-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

.stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

.stats-header h1 {
    font-size: 24px;
    font-weight: 600;
}

.stats-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
}

.stats-grid.small {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.stat-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.stat-card.highlight {
    background: #fff3cd;
    border: 1px solid #ffc107;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: #007bff;
}

.stat-card.highlight .stat-value {
    color: #856404;
}

.stat-label {
    font-size: 14px;
    color: #666;
    margin-top: 4px;
}

.stats-section {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.stats-section h2 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #333;
}

.progress-bar-container {
    background: #e9ecef;
    border-radius: 4px;
    height: 24px;
    position: relative;
    overflow: hidden;
}

.progress-bar-container.small {
    height: 8px;
}

.progress-bar {
    background: #007bff;
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s;
}

.progress-label {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 13px;
    color: #333;
    white-space: nowrap;
}

.agent-stats-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.agent-stat-item {
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
}

.agent-stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.agent-stat-name {
    font-weight: 500;
}

.agent-stat-counts {
    font-size: 13px;
    color: #666;
}

.date-range {
    font-size: 14px;
}

.date-range p {
    margin: 8px 0;
}

.feeds-table-container {
    overflow-x: auto;
}

.feeds-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.feeds-table th,
.feeds-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.feeds-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
}

.feeds-table tbody tr:hover {
    background: #f8f9fa;
}

.feed-name {
    max-width: 400px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.feed-count {
    text-align: center;
    width: 80px;
}

.feed-date {
    color: #666;
    white-space: nowrap;
}