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

:root {
    --primary: #1a56db;
    --primary-hover: #1446c0;
    --primary-light: #e8effc;
    --bg: #f4f7fb;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --success: #16a34a;
    --warning: #d97706;
    --error: #dc2626;
    --radius: 8px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

body {
    font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text-main);
    min-height: 100vh;
}

.container {
    max-width: 860px;
    margin: 0 auto;
    padding: 32px 16px 64px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 36px;
}

header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.5px;
}

.subtitle {
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Search bar */
.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
}

#searchInput {
    flex: 1;
    height: 48px;
    padding: 0 16px;
    font-size: 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    background: var(--card-bg);
    color: var(--text-main);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#searchInput:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.12);
}

#searchInput::placeholder {
    color: var(--text-muted);
}

#searchBtn {
    height: 48px;
    padding: 0 24px;
    background: var(--primary);
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, transform 0.1s;
}

#searchBtn:hover {
    background: var(--primary-hover);
}

#searchBtn:active {
    transform: scale(0.98);
}

#searchBtn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* Win rate card */
.predict-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
    padding: 20px 24px;
    margin-bottom: 20px;
}

.predict-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    flex-wrap: wrap;
    gap: 12px;
}

.company-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
}

.win-rate-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
}

.win-rate-bar-track {
    height: 8px;
    background: var(--border);
    border-radius: 99px;
    margin-top: 8px;
    overflow: hidden;
    width: 180px;
}

.win-rate-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #1a56db, #60a5fa);
    border-radius: 99px;
    transition: width 0.5s ease;
}

.predict-stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

.stat-item {
    background: var(--bg);
    border-radius: 6px;
    padding: 12px 14px;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
}

/* Error message */
.error-msg {
    background: #fef2f2;
    color: var(--error);
    border: 1px solid #fecaca;
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

/* Results section */
.results-section {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.results-meta {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    font-size: 0.88rem;
    color: var(--text-muted);
}

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

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 480px;
}

thead {
    background: var(--bg);
}

th {
    padding: 12px 16px;
    text-align: left;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

td {
    padding: 13px 16px;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-main);
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background: var(--primary-light);
}

.empty-cell {
    text-align: center;
    color: var(--text-muted);
    padding: 32px 16px;
    font-size: 0.95rem;
}

.award-id-badge {
    font-size: 0.82rem;
    background: var(--bg);
    padding: 2px 6px;
    border-radius: 4px;
}

.amount-cell {
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.date-cell {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 14px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

.page-btn {
    min-width: 36px;
    height: 36px;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    background: var(--card-bg);
    color: var(--text-main);
    font-size: 0.88rem;
    cursor: pointer;
    padding: 0 10px;
    transition: border-color 0.15s, color 0.15s;
}

.page-btn:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
}

.page-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    cursor: default;
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    z-index: 999;
    backdrop-filter: blur(2px);
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Utility */
.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 600px) {
    .container {
        padding: 20px 12px 48px;
    }

    header h1 {
        font-size: 1.6rem;
    }

    .search-bar {
        flex-direction: column;
    }

    #searchBtn {
        width: 100%;
    }

    .predict-stats {
        grid-template-columns: 1fr 1fr;
    }

    th, td {
        padding: 10px 12px;
    }
}