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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

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

.header {
    text-align: center;
    padding: 40px 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    margin-bottom: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.header h1 {
    font-size: 3rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
}

.subtitle {
    color: #666;
    font-size: 1.1rem;
}

.byline {
    color: #4f5fd6;
    font-weight: 700;
    white-space: nowrap;
}

.daily-line {
    margin-top: 8px;
    color: #555;
    font-size: 0.98rem;
    line-height: 1.6;
}

.daily-line a {
    color: #4f5fd6;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.daily-line a:hover {
    text-decoration: underline;
}

.search-section {
    background: white;
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.search-form {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-end;
}

.input-group {
    flex: 1;
    min-width: 200px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 600;
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.files-section {
    background: white;
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.files-section h3 {
    margin-bottom: 20px;
    color: #333;
}

.files-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.file-item {
    padding: 10px 20px;
    background: #f0f0f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.file-item:hover {
    background: #667eea;
    color: white;
}

.status-section {
    margin-bottom: 30px;
}

.status-card {
    background: white;
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.status-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

.status-text {
    font-size: 1.2rem;
    color: #555;
}

.tabs-section {
    background: white;
    border-radius: 20px 20px 0 0;
    padding: 20px 30px 0;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.tabs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 0;
}

.tab-btn {
    padding: 12px 20px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 0.95rem;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: -2px;
}

.tab-btn:hover {
    color: #667eea;
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.content-section {
    background: white;
    border-radius: 0 0 20px 20px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.3);
}

.stat-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.95rem;
    opacity: 0.9;
}

.charts-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.chart-container {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
}

.chart-container.full-width {
    grid-column: 1 / -1;
}

.chart-container h4 {
    margin-bottom: 15px;
    color: #333;
}

.chart {
    width: 100%;
    height: 400px;
}

.chart-placeholder {
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    text-align: center;
}

.network-controls {
    margin: -4px 0 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #555;
    font-size: 0.94rem;
}

.network-controls select {
    min-width: 120px;
    padding: 7px 10px;
    border: 1px solid #d7dee8;
    border-radius: 8px;
    background: #ffffff;
    color: #333;
}

.svg-network {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 520px;
}

.svg-network-edge {
    stroke: #7b8794;
    stroke-width: 1.2;
    stroke-opacity: 0.55;
}

.svg-network-edge.directed {
    stroke-opacity: 0.68;
}

.svg-network-circle {
    stroke: #ffffff;
    stroke-width: 2;
    filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.18));
}

.svg-network-label {
    fill: #31413a;
    font-size: 12px;
    font-weight: 600;
    paint-order: stroke;
    stroke: #f8f9fa;
    stroke-width: 3px;
    stroke-linejoin: round;
}

.svg-network-label.inside {
    fill: #ffffff;
    font-size: 9px;
    font-weight: 700;
    paint-order: normal;
    stroke: none;
}

.svg-network-note {
    color: #777;
    font-size: 0.9rem;
    margin-top: 8px;
    text-align: center;
}

.citation-network-details {
    margin-top: 18px;
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(260px, 1fr);
    gap: 18px;
}

.citation-detail-panel {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 16px;
    max-height: 320px;
    overflow: auto;
}

.citation-detail-panel h5 {
    margin: 0 0 12px;
    color: #333;
    font-size: 1rem;
}

.citation-detail-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.citation-detail-item {
    color: #444;
    font-size: 0.92rem;
    line-height: 1.35;
}

.citation-detail-meta {
    color: #777;
    font-size: 0.86rem;
    margin-top: 3px;
}

@media (max-width: 800px) {
    .citation-network-details {
        grid-template-columns: 1fr;
    }
}

.table-container {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
    overflow-x: auto;
}

.table-container h4 {
    margin-bottom: 15px;
    color: #333;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

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

.data-table th {
    background: #667eea;
    color: white;
    font-weight: 600;
}

.data-table tr:hover {
    background: rgba(102, 126, 234, 0.05);
}

.download-section {
    text-align: center;
    padding: 40px;
}

.report-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
}

.report-actions h4 {
    margin: 0;
    color: #333;
}

.report-content {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
}

.report-header {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding-bottom: 18px;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 22px;
}

.report-header h2 {
    margin: 0 0 6px;
    color: #263238;
}

.report-header p,
.report-meta {
    color: #667085;
}

.report-meta {
    text-align: right;
    min-width: 180px;
}

.report-meta span {
    display: block;
    font-size: 0.82rem;
}

.report-section {
    margin: 24px 0;
}

.report-section h3 {
    margin: 0 0 12px;
    color: #263238;
}

.report-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.report-metrics div {
    border: 1px solid #dce3ec;
    border-radius: 8px;
    background: #f8fafc;
    padding: 14px;
}

.report-metrics strong {
    display: block;
    color: #2f5fda;
    font-size: 1.5rem;
}

.report-metrics span,
.report-empty {
    color: #667085;
}

.report-summary-grid {
    margin-top: 16px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 10px 24px;
}

.report-summary-grid p {
    margin: 0;
    color: #3f4d5a;
}

.report-section.two-column {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(260px, 1fr);
    gap: 24px;
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.report-table th,
.report-table td {
    border-bottom: 1px solid #e5eaf0;
    padding: 8px;
    text-align: left;
    vertical-align: top;
}

.report-table th {
    background: #f3f6fb;
    color: #344054;
}

.report-placeholder {
    color: #667085;
    text-align: center;
    padding: 60px 20px;
}

.download-section p {
    margin-bottom: 20px;
    color: #555;
}

.upload-section {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px dashed #e0e0e0;
}

.upload-section h3 {
    margin-bottom: 15px;
    color: #333;
}

.upload-area {
    border: 2px dashed #667eea;
    border-radius: 15px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(102, 126, 234, 0.05);
}

.upload-area:hover {
    background: rgba(102, 126, 234, 0.1);
    border-color: #764ba2;
}

.upload-area.dragover {
    background: rgba(102, 126, 234, 0.2);
    border-color: #764ba2;
    transform: scale(1.02);
}

.upload-area p {
    color: #666;
    font-size: 1.1rem;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.controls-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
}

.select-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.select-group label {
    font-weight: 600;
    color: #555;
}

.select-group select {
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.select-group select:focus {
    outline: none;
    border-color: #667eea;
}

.download-controls {
    text-align: center;
    margin-bottom: 30px;
}

.papers-list-container {
    background: white;
    border-radius: 15px;
    padding: 20px;
    max-height: 600px;
    overflow-y: auto;
}

.papers-list-container h4 {
    margin-bottom: 15px;
    color: #333;
    position: sticky;
    top: 0;
    background: white;
    padding-bottom: 10px;
    z-index: 10;
}

.paper-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
    padding: 15px;
    border-bottom: 1px solid #e0e0e0;
}

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

.paper-info {
    flex: 1;
    text-align: left;
}

.paper-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.paper-authors {
    color: #666;
    font-size: 0.9rem;
}

.paper-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s ease;
}

.paper-btn.download {
    background: #28a745;
    color: white;
}

.paper-btn.download:hover {
    background: #218838;
}

.paper-btn.unavailable {
    background: #6c757d;
    color: white;
    cursor: not-allowed;
    opacity: 0.7;
}

.btn-danger {
    background: #c0392b;
    color: white;
}

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

.btn-small {
    padding: 7px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
}

.papers-workbench {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
    margin-top: 30px;
}

.papers-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-bottom: 18px;
}

.papers-toolbar h4 {
    margin: 0;
}

.papers-actions {
    display: flex;
    gap: 10px;
}

.filters-grid {
    display: grid;
    grid-template-columns: minmax(220px, 2fr) repeat(3, minmax(140px, 1fr)) auto;
    gap: 14px;
    align-items: end;
    margin-bottom: 12px;
}

.paper-filter-summary,
.network-summary,
.modal-status {
    color: #666;
    font-size: 0.95rem;
    margin: 10px 0 14px;
}

.table-scroll {
    width: 100%;
    overflow-x: auto;
    background: white;
    border-radius: 12px;
}

#allPapersTable th:first-child,
#allPapersTable td:first-child {
    width: 42px;
    text-align: center;
}

#allPapersTable th:nth-child(2),
#allPapersTable td:nth-child(2) {
    min-width: 320px;
}

#allPapersTable th:nth-child(3),
#allPapersTable td:nth-child(3) {
    min-width: 240px;
}

#allPapersTable th:nth-child(4),
#allPapersTable td:nth-child(4) {
    min-width: 180px;
}

#allPapersTable th:nth-child(8),
#allPapersTable td:nth-child(8) {
    min-width: 86px;
    white-space: nowrap;
}

.paper-title-cell {
    font-weight: 600;
    color: #333;
}

.muted-cell {
    color: #777;
    font-size: 0.9rem;
}

.add-paper-btn {
    display: block;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    margin: 24px auto 0;
    background: #2e7d59;
    color: white;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 5px 18px rgba(46, 125, 89, 0.25);
    transition: all 0.2s ease;
}

.add-paper-btn:hover {
    transform: translateY(-2px);
    background: #276b4c;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1000;
}

.modal-card {
    width: min(900px, 100%);
    max-height: 90vh;
    overflow-y: auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 24px;
    border-bottom: 1px solid #e0e0e0;
}

.modal-header h3 {
    margin: 0;
}

.modal-body {
    padding: 24px;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: #f0f0f0;
    color: #333;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

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

.add-paper-search {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 12px;
}

.add-paper-search input {
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
}

.title-search-results {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.candidate-paper {
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 14px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
    align-items: center;
}

.candidate-title {
    font-weight: 700;
    margin-bottom: 6px;
}

.candidate-meta {
    color: #666;
    font-size: 0.92rem;
}

.delete-paper-btn {
    white-space: nowrap;
}

@media (max-width: 900px) {
    .filters-grid {
        grid-template-columns: 1fr 1fr;
    }

    .report-section.two-column {
        grid-template-columns: 1fr;
    }

    .add-paper-search {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 620px) {
    .report-actions,
    .report-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .report-meta {
        text-align: left;
    }

    .papers-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .filters-grid {
        grid-template-columns: 1fr;
    }

    .candidate-paper {
        grid-template-columns: 1fr;
    }
}
