body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    max-width: 90%;
    margin: 40px auto;
    padding: 0 20px;
    background: #f5f5f5;
}
h1 {
    color: #333;
    padding-bottom: 10px;
}
h1.blue { border-bottom: 3px solid #007bff; }
h1.orange { border-bottom: 3px solid #e67e22; }
h2 {
    color: #333;
    margin-top: 0;
    padding-bottom: 8px;
}
h2.blue { border-bottom: 2px solid #007bff; }
h2.orange { border-bottom: 2px solid #e67e22; }
.nav { margin-bottom: 20px; }
.nav a {
    color: #007bff;
    text-decoration: none;
    margin-right: 15px;
}
.nav a:hover { text-decoration: underline; }
.form-container {
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 12px;
    margin-bottom: 15px;
}
label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    color: #555;
    font-size: 13px;
}
input, select {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
    height: 34px;
}
button {
    color: white;
    padding: 12px 30px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    margin-top: 10px;
}
button.blue { background: #007bff; }
button.blue:hover { background: #0056b3; }
button.orange { background: #e67e22; }
button.orange:hover { background: #d35400; }
button:disabled {
    background: #ccc !important;
    cursor: not-allowed;
}
.date-range-display {
    margin: 15px 0;
    padding: 10px;
    border-radius: 4px;
    font-weight: 600;
}
.date-range-display.blue { background: #f0f8ff; color: #007bff; }
.date-range-display.orange { background: #fef5e7; color: #e67e22; }
.results {
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}
table {
    width: 100%;
    border-collapse: collapse;
}
th, td {
    padding: 10px 12px;
    text-align: center;
    border: 1px solid #ddd;
}
th {
    color: white;
    font-weight: 600;
}
th.blue { background: #007bff; }
th.orange { background: #e67e22; }
tr:nth-child(even) { background: #f9f9f9; }
tr:hover { background: #f0f0f0; }
.detail-table { font-size: 13px; }
.detail-table th {
    position: sticky;
    top: 0;
    cursor: pointer;
}
.detail-table td:first-child,
.detail-table th:first-child { text-align: left; }
.scroll-container {
    max-height: 600px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
}
.positive { color: #28a745; font-weight: 600; }
.negative { color: #dc3545; font-weight: 600; }
.loading-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(255,255,255,0.92);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}
.loading-overlay.active { display: flex; }
.spinner {
    border: 5px solid #e0e0e0;
    border-top: 5px solid #007bff;
    border-radius: 50%;
    width: 50px; height: 50px;
    animation: spin 0.8s linear infinite;
    margin-bottom: 20px;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
.progress-bar-outer {
    width: 320px;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 15px;
}
.progress-bar-inner {
    height: 100%;
    background: #007bff;
    transition: width 0.3s;
    width: 0%;
}
.loading-text {
    font-size: 16px;
    color: #333;
    margin-bottom: 5px;
}
.error-banner {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 600;
}
.error-banner.red {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}
.combo-row { cursor: pointer; }
.combo-row:hover { background: #fef5e7; }
#comboTable th.blue:hover { background: #0056b3; }
.sort-arrow { color: #ffdd57; font-weight: bold; }
.toggle-cell {
    font-size: 11px;
    color: #e67e22;
    user-select: none;
}
.detail-row { background: #fdf6ec !important; }
.detail-row:hover { background: #fdf6ec !important; }
.detail-row td { padding: 0; border: none; }
.detail-panel { padding: 15px 20px; }
.best-combo-box { border: 2px solid #e67e22; }
.best-combo-info {
    margin: 15px 0;
    padding: 15px 20px;
    background: #fef5e7;
    border-radius: 6px;
    font-size: 16px;
}
.best-label { color: #999; font-size: 14px; }
.best-row {
    background: #fef5e7 !important;
    font-weight: 600;
}
.best-row:hover { background: #fef5e7 !important; }
.scroll-container-wide {
    overflow-x: auto;
}
.scroll-container-wide table {
    min-width: 1200px;
}
.combo-toggle {
    margin-top: 10px;
    padding: 8px 20px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}
.combo-toggle:hover { background: #0056b3; }
.action-cell { white-space: nowrap; }
.action-btn {
    padding: 5px 12px;
    font-size: 13px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    background: #007bff;
    color: white;
    margin: 0 2px;
    margin-top: 0;
}
.action-btn:hover { background: #0056b3; }
.action-btn.danger { background: #dc3545; }
.action-btn.danger:hover { background: #c82333; }
.success-banner {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 600;
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}
.preview-row td { padding: 0; border: none; background: #f0f8ff; }
.preview-row:hover { background: #f0f8ff !important; }
.preview-panel { padding: 12px 16px; }
.mini-table { font-size: 12px; }
.mini-table th { padding: 6px 8px; }
.mini-table td { padding: 6px 8px; text-align: right; }
.mini-table td:first-child,
.mini-table th:first-child { text-align: left; }
.batch-bar {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.batch-hint { font-weight: 600; color: #555; font-size: 14px; }
#dataTable th:first-child,
#dataTable td:first-child { text-align: center; width: 40px; }
#dataTable input[type="checkbox"] { width: auto; height: auto; margin: 0; }
.doc-section {
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 25px;
    line-height: 1.7;
}
.doc-section h2 { margin-top: 0; }
.doc-section h3 {
    color: #007bff;
    margin-top: 25px;
    padding-bottom: 5px;
    border-bottom: 1px solid #e0e0e0;
}
.doc-section h3:first-of-type { margin-top: 0; }
.doc-section ul, .doc-section ol { padding-left: 24px; }
.doc-section li { margin-bottom: 6px; }
.doc-section p { margin: 10px 0; }
.formula-box {
    background: #f0f8ff;
    border: 1px solid #b8d4f0;
    border-radius: 6px;
    padding: 15px 20px;
    margin: 15px 0;
    font-family: "SF Mono", "Menlo", "Consolas", monospace;
    font-size: 14px;
    line-height: 1.8;
}
.formula-box hr { border: none; border-top: 1px solid #b8d4f0; margin: 10px 0; }
.formula-box p { margin: 4px 0; }
.disclaimer {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    padding: 15px 20px;
    color: #856404;
    margin-top: 20px;
}

/* Health status badges */
.health-badge {
    display: inline-block;
    width: 24px;
    height: 24px;
    line-height: 24px;
    text-align: center;
    border-radius: 50%;
    font-weight: bold;
    font-size: 14px;
    cursor: help;
}
.health-healthy {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}
.health-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}
.health-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}
.health-unknown {
    background: #e2e3e5;
    color: #383d41;
    border: 1px solid #d6d8db;
}

/* Health issues panel */
.health-issues-row {
    background: #fff8e1;
}
.health-issues-panel {
    padding: 12px 20px;
    border-left: 4px solid #ff9800;
    margin: 8px 0;
}
.health-issues-panel strong {
    color: #e65100;
    font-size: 14px;
    display: block;
    margin-bottom: 8px;
}
.health-issues-list {
    margin: 0;
    padding-left: 20px;
    color: #bf360c;
    font-size: 13px;
    line-height: 1.6;
}
.health-issues-list li {
    margin-bottom: 4px;
}

/* Nav right alignment */
.nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}
.nav-right {
    margin-left: auto;
}
.nav-right a {
    margin-right: 0;
    margin-left: 15px;
}

/* Login page */
.login-container {
    max-width: 400px;
    margin: 80px auto;
    text-align: center;
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.login-hint {
    color: #666;
    margin-bottom: 30px;
}
.oauth-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.oauth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 24px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 16px;
    font-weight: 600;
    transition: opacity 0.2s;
}
.oauth-btn:hover {
    opacity: 0.9;
    text-decoration: none;
}
.oauth-google {
    background: #4285f4;
    color: white;
}
.oauth-github {
    background: #24292e;
    color: white;
}

/* Profile page */
.profile-container {
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}
.profile-info {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    padding: 15px;
    background: #f0f8ff;
    border-radius: 6px;
}
.profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
}
.profile-details p {
    margin: 4px 0;
    font-size: 15px;
}
.history-table {
    font-size: 14px;
}
.empty-hint {
    color: #999;
    font-style: italic;
    padding: 20px;
    text-align: center;
}
