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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f0f2f5;
    color: #1a1a2e;
    min-height: 100vh;
}

header {
    background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
    color: white;
    padding: 14px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

header h1 {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.cache-stats {
    font-size: 12px;
    opacity: 0.9;
    background: rgba(255,255,255,0.12);
    padding: 4px 12px;
    border-radius: 20px;
}

main {
    max-width: 1440px;
    margin: 0 auto;
    padding: 24px;
}

/* Search Panel */
.search-panel {
    background: white;
    border-radius: 12px;
    padding: 28px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    margin-bottom: 20px;
    border: 1px solid #e8eaed;
}

.input-group {
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: #6b7280;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 13px;
    font-family: "SF Mono", "Fira Code", Monaco, Consolas, monospace;
    resize: vertical;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fafbfc;
}

textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
    background: white;
}

select {
    padding: 9px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 13px;
    background: white;
    min-width: 220px;
    cursor: pointer;
    transition: border-color 0.2s;
}

select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.controls-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
}

.button-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

button {
    padding: 9px 20px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    background: #2563eb;
    color: white;
    letter-spacing: 0.2px;
}

button:hover {
    background: #1d4ed8;
    box-shadow: 0 2px 4px rgba(37,99,235,0.3);
    transform: translateY(-1px);
}

button:active {
    transform: translateY(0);
    box-shadow: none;
}

button.secondary {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}

button.secondary:hover {
    background: #e5e7eb;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

button.danger {
    background: #ef4444;
}

button.danger:hover {
    background: #dc2626;
    box-shadow: 0 2px 4px rgba(239,68,68,0.3);
}

button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Progress */
.progress-section {
    background: white;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border: 1px solid #e8eaed;
}

.progress-bar {
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #2563eb, #3b82f6);
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 12px;
    color: #6b7280;
    margin-top: 8px;
    font-weight: 500;
}

/* Results */
.results-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    overflow: hidden;
    border: 1px solid #e8eaed;
    margin-bottom: 20px;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid #f0f0f0;
    background: #fafbfc;
}

.results-header h2 {
    font-size: 14px;
    font-weight: 700;
    color: #1a1a2e;
}

.results-header div {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

th {
    background: #f9fafb;
    padding: 10px 14px;
    text-align: left;
    font-weight: 700;
    color: #6b7280;
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: 0.8px;
    white-space: nowrap;
    border-bottom: 2px solid #e5e7eb;
}

td {
    padding: 10px 14px;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
    color: #374151;
}

tr:hover {
    background: #f8fafc;
}

td a {
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
}

td a:hover {
    text-decoration: underline;
}

td.bio-cell {
    max-width: 250px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #6b7280;
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.badge-cached {
    background: #d1fae5;
    color: #065f46;
}

.badge-fresh {
    background: #dbeafe;
    color: #1e40af;
}

.badge-error {
    background: #fee2e2;
    color: #991b1b;
}

.detail-btn {
    padding: 5px 12px;
    font-size: 12px;
    background: white;
    color: #2563eb;
    border: 1px solid #d1d5db;
    font-weight: 600;
}

.detail-btn:hover {
    background: #eff6ff;
    border-color: #2563eb;
    box-shadow: none;
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(4px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: white;
    border-radius: 16px;
    padding: 32px;
    max-width: 720px;
    width: 92%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.modal-close {
    position: absolute;
    top: 14px;
    right: 18px;
    background: #f3f4f6;
    border: none;
    font-size: 18px;
    color: #6b7280;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 8px;
    line-height: 1;
}

.modal-close:hover {
    color: #1a1a2e;
    background: #e5e7eb;
    transform: none;
    box-shadow: none;
}

.modal h2 {
    margin-bottom: 20px;
    font-size: 18px;
    font-weight: 700;
    color: #1a1a2e;
    padding-right: 40px;
}

.detail-grid {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 10px 16px;
    font-size: 13px;
}

.detail-label {
    font-weight: 700;
    color: #6b7280;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding-top: 2px;
}

.detail-value {
    word-break: break-word;
    color: #1a1a2e;
}

/* No results */
.no-results {
    text-align: center;
    padding: 40px;
    color: #9ca3af;
    font-size: 14px;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}
