:root {
    --bg: #f4f6f9;
    --card: #ffffff;
    --ink: #1f2933;
    --muted: #6b7684;
    --line: #e2e7ee;
    --brand: #2563eb;
    --brand-dark: #1d4ed8;
    --green: #15803d;
    --green-bg: #e7f6ec;
    --amber: #b45309;
    --amber-bg: #fdf0d9;
    --red: #b91c1c;
    --red-bg: #fde7e7;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--ink);
    font-size: 15px;
    line-height: 1.5;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar { background: #0f172a; color: #fff; }
.topbar-inner {
    max-width: 1100px; margin: 0 auto; padding: 0 20px;
    display: flex; align-items: center; justify-content: space-between; height: 56px;
}
.brand { color: #fff; font-weight: 600; font-size: 16px; }
.brand:hover { text-decoration: none; opacity: .9; }
.topnav { display: flex; align-items: center; gap: 18px; }
.topnav a { color: #cbd5e1; font-size: 14px; }
.topnav a:hover { color: #fff; text-decoration: none; }
.who { color: #94a3b8; font-size: 13px; }
.inline-form { display: inline; margin: 0; }
.link-btn {
    background: none; border: none; color: #cbd5e1; cursor: pointer;
    font: inherit; font-size: 14px; padding: 0;
}
.link-btn:hover { color: #fff; text-decoration: underline; }

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

h1 { font-size: 24px; margin: 0 0 6px; }
h2 { font-size: 18px; margin: 24px 0 10px; }
.subtitle { color: var(--muted); margin: 0 0 20px; }

.card {
    background: var(--card); border: 1px solid var(--line); border-radius: 10px;
    padding: 22px; margin-bottom: 18px;
}

.auth-wrap { max-width: 400px; margin: 60px auto; }
.auth-wrap .card { padding: 28px; }

label { display: block; font-weight: 600; font-size: 13px; margin: 14px 0 5px; }
input[type=text], input[type=password], input[type=email], input[type=number], textarea, select {
    width: 100%; padding: 9px 11px; border: 1px solid #cbd3dd; border-radius: 7px;
    font: inherit; background: #fff; color: var(--ink);
}
textarea { resize: vertical; }
.code-area {
    font-family: Consolas, "Courier New", monospace; font-size: 13.5px;
    line-height: 1.5; min-height: 340px; white-space: pre; tab-size: 4;
}

.btn {
    display: inline-block; background: var(--brand); color: #fff; border: none;
    padding: 10px 18px; border-radius: 7px; font: inherit; font-weight: 600;
    cursor: pointer;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn-secondary { background: #e5eaf1; color: var(--ink); }
.btn-secondary:hover { background: #d7dee8; }
.btn-success { background: var(--green); }
.btn-success:hover { background: #126c34; }
.btn-row { margin-top: 18px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.flash { padding: 11px 15px; border-radius: 8px; margin-bottom: 18px; font-size: 14px; }
.flash-success { background: var(--green-bg); color: var(--green); border: 1px solid #bfe3cb; }
.error { background: var(--red-bg); color: var(--red); border: 1px solid #f3c2c2; padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 14px; }
.notice { background: #eef4ff; color: #1e3a8a; border: 1px solid #cfe0ff; padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; }

table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 10px; overflow: hidden; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: top; }
th { background: #f1f4f9; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
tr:last-child td { border-bottom: none; }
.table-wrap { border: 1px solid var(--line); border-radius: 10px; overflow-x: auto; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.status-NotStarted { background: #eef1f5; color: #64748b; }
.status-InProgress { background: #fdf0d9; color: var(--amber); }
.status-Completed { background: var(--green-bg); color: var(--green); }

.band-low { background: var(--green-bg); color: var(--green); }
.band-moderate { background: var(--amber-bg); color: var(--amber); }
.band-high { background: var(--red-bg); color: var(--red); }

.score-pill { display: inline-flex; align-items: center; gap: 7px; }
.score-num { font-weight: 700; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: Consolas, "Courier New", monospace; }

.kv { display: grid; grid-template-columns: 180px 1fr; gap: 6px 16px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.meter { background: #eef1f5; border-radius: 999px; height: 10px; overflow: hidden; width: 160px; display: inline-block; vertical-align: middle; }
.meter > span { display: block; height: 100%; }

.timeline { font-family: Consolas, monospace; font-size: 12.5px; }
.timeline td { padding: 5px 10px; }

pre.code-block {
    background: #0f172a; color: #e2e8f0; padding: 16px; border-radius: 8px;
    overflow: auto; font-size: 13px; line-height: 1.5;
}

.task-desc { white-space: pre-wrap; background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 14px; font-size: 14px; }

.landing-cards { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 20px; }
.landing-cards .card { flex: 1; min-width: 260px; }
.autosave { font-size: 12px; color: var(--muted); }
.disclaimer { font-size: 12.5px; color: var(--muted); border-left: 3px solid var(--line); padding-left: 12px; margin-top: 8px; }
.component-list { margin: 0; padding: 0; list-style: none; }
.component-list li { padding: 8px 0; border-bottom: 1px dashed var(--line); }
.component-list li:last-child { border-bottom: none; }
.pts { font-weight: 700; color: var(--ink); }

.run-panel { margin-top: 14px; border: 1px solid var(--line); border-radius: 8px; padding: 14px; background: #fff; }
.run-panel.run-ok { border-color: #bfe3cb; background: var(--green-bg); }
.run-panel.run-bad { border-color: #f3c2c2; background: #fff6f6; }
.run-head { font-weight: 600; margin-bottom: 8px; }
.run-cols { display: flex; gap: 16px; flex-wrap: wrap; }
.run-cols > div { flex: 1; min-width: 220px; }
.run-sec { margin-top: 10px; }
.run-panel pre { background: #0f172a; color: #e2e8f0; padding: 10px; border-radius: 6px; overflow: auto; font-size: 12.5px; white-space: pre-wrap; margin: 6px 0 0; }
.run-panel strong { font-size: 13px; }

/* CodeMirror editor (candidate workspace) */
.CodeMirror {
    height: 380px; border: 1px solid #cbd3dd; border-radius: 7px;
    font-family: Consolas, "Courier New", monospace; font-size: 13.5px; line-height: 1.5;
}
.CodeMirror-focused { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.CodeMirror-gutters { background: #f6f8fb; border-right: 1px solid var(--line); border-radius: 7px 0 0 7px; }
.CodeMirror-linenumber { color: #94a3b8; }

/* Task timer */
.timer {
    background: #eef4ff; color: #1e3a8a; border: 1px solid #cfe0ff; border-radius: 8px;
    padding: 10px 14px; margin-bottom: 16px; font-size: 14px;
}
.timer strong { font-family: Consolas, "Courier New", monospace; font-size: 16px; }
.timer.timer-low { background: var(--red-bg); color: var(--red); border-color: #f3c2c2; }
.flash-warn { background: var(--amber-bg); color: var(--amber); border: 1px solid #f1d7a8; }

/* Reviewer tools: report, compare, analytics */
.report-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.report-head .btn { margin-left: 10px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.stat-num { font-size: 22px; font-weight: 700; }
.stat-label { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.stars { color: #d97706; letter-spacing: 1px; font-size: 15px; white-space: nowrap; }
.rating-options, .decision-options { display: flex; gap: 16px; flex-wrap: wrap; margin: 4px 0 6px; }
.rating-options label, .decision-options label { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; margin: 0; cursor: pointer; }
.notes-cell { white-space: pre-wrap; font-size: 13px; max-width: 280px; }
.compare-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.compare-col { margin-bottom: 0; display: flex; flex-direction: column; }
.compare-code { max-height: 360px; flex: 1; font-size: 12.5px; margin: 0; }
.kv.kv-tight { grid-template-columns: 90px 1fr; gap: 4px 10px; font-size: 13.5px; margin: 0 0 10px; }
.meter > span.fill-good { background: var(--green); }
.meter > span.fill-warn { background: #d97706; }
.meter > span.fill-bad { background: var(--red); }
.hint-row td { background: #fffbeb; }
.hints { margin: 0; padding-left: 18px; font-size: 13px; color: var(--amber); }

/* Operations: system page, audit log */
pre.log-tail { max-height: 420px; font-size: 12px; white-space: pre-wrap; word-break: break-word; margin: 0; }
pre.log-detail { max-height: 320px; font-size: 11.5px; white-space: pre-wrap; word-break: break-word; margin: 8px 0 0; }
details summary { cursor: pointer; }
tr.error-row td { border-bottom: none; padding-bottom: 4px; }
td.error-msg { min-width: 280px; }
td.detail-cell { padding-top: 0; }
td.detail-cell summary { color: var(--brand); }
.filter-bar { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; padding: 14px 18px; }
.filter-bar > div { min-width: 170px; }
.filter-bar label { margin-top: 0; }
.filter-actions { display: flex; gap: 8px; }
.actor-admin { background: #e0e7ff; color: #3730a3; }
.actor-candidate { background: var(--green-bg); color: var(--green); }
.actor-anonymous { background: #eef1f5; color: #64748b; }
.actor-system { background: var(--amber-bg); color: var(--amber); }

/* Printing (candidate report): hide navigation, forms and buttons; show print-only blocks */
.print-only { display: none; }
@media print {
    .topbar, .site-footer, .no-print, form, .btn, .flash { display: none !important; }
    .print-only { display: block !important; }
    body { background: #fff; font-size: 12px; }
    .container { margin: 0; max-width: none; padding: 0; }
    .card, .stat, tr { break-inside: avoid; }
    .card, .stat, .table-wrap { border-color: #bbb; }
    .table-wrap { overflow: visible; }
    a { color: inherit; text-decoration: none; }
}
