:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --bg: #f5f5fa;
    --card-bg: #ffffff;
    --border: #e5e5ef;
    --text: #1a1a2e;
    --muted: #6b7280;
    --critical: #dc2626;
    --warning: #d97706;
    --notice: #6366f1;
    --good: #16a34a;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); font-size: 13px; }

/* --- Nav --- */
.topnav { background: #fff; border-bottom: 1px solid var(--border); }
.topnav-inner { max-width: 1200px; margin: 0 auto; padding: 14px 24px; display: flex; justify-content: space-between; align-items: center; }
.brand { font-weight: 700; font-size: 18px; color: var(--text); }
.topnav-right { display: flex; gap: 16px; align-items: center; }

/* --- Layout --- */
.container { max-width: 1200px; margin: 0 auto; padding: 24px; }
.page-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.actions { display: flex; gap: 10px; }
h1 { font-size: 24px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0 0 14px; }

/* --- Cards --- */
.card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; padding: 20px; margin-bottom: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; } }

.health-card { text-align: center; }
.health-score { font-size: 52px; font-weight: 700; margin: 10px 0; }
.health-good { color: var(--good); }
.health-ok { color: var(--warning); }
.health-bad { color: var(--critical); }

.issue-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid #f2f2f7; }
.issue-row:last-child { border-bottom: none; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.dot-critical { background: var(--critical); }
.dot-warning { background: var(--warning); }
.dot-notice { background: var(--notice); }

.stat { text-align: center; padding: 10px; }
.stat-num { font-size: 26px; font-weight: 700; }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 4px; }
.warn-if-nonzero { color: var(--critical); }

/* --- Table --- */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid #f0f0f5; font-size: 14px; }
.table th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
.table.small td, .table.small th { font-size: 13px; padding: 8px 10px; }
.url-cell { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- Badges --- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; text-transform: capitalize; }
.badge-idle, .badge-queued { background: #e0e7ff; color: #3730a3; }
.badge-crawling { background: #fef3c7; color: #92400e; }
.badge-completed { background: #dcfce7; color: #166534; }
.badge-stopped, .badge-error { background: #fee2e2; color: #991b1b; }
.badge-sev-critical { background: #fee2e2; color: #991b1b; }
.badge-sev-warning { background: #fef3c7; color: #92400e; }
.badge-sev-notice { background: #e0e7ff; color: #3730a3; }

/* --- Forms & buttons --- */
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.inline-form input { padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; flex: 1; min-width: 180px; }
.btn { background: var(--primary); color: #fff; border: none; padding: 10px 18px; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 600; display: inline-block; }
.btn:hover { background: var(--primary-dark); text-decoration: none; }
.btn-secondary { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: #f5f5fa; }
.danger { color: var(--critical); }

.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.alert-error { background: #fee2e2; color: #991b1b; }
.alert-success { background: #dcfce7; color: #166534; }

.pagination { display: flex; gap: 16px; justify-content: center; align-items: center; margin-top: 16px; font-size: 14px; }

/* --- Auth pages --- */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.auth-box { background: #fff; border-radius: 14px; padding: 40px; width: 380px; box-shadow: 0 10px 40px rgba(0,0,0,0.08); }
.auth-box h1 { text-align: center; }
.auth-box h2 { text-align: center; color: var(--muted); font-weight: 400; margin-bottom: 24px; }
.auth-box form { display: flex; flex-direction: column; gap: 10px; }
.auth-box label { font-size: 13px; font-weight: 600; margin-top: 6px; }
.auth-box input { padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; }
.auth-box .btn { margin-top: 14px; text-align: center; }
.auth-box p.muted { text-align: center; margin-top: 16px; }
code { background: #f0f0f5; padding: 2px 6px; border-radius: 4px; font-size: 12px; }
