:root {
  --bg: #f4f5f7; --card: #fff; --text: #1f2430; --muted: #6b7280; --line: #e2e5ea; --accent: #1f5fbf;
  --ok: #1a7f37; --warn: #b7791f; --error: #b42318; --ok-bg: #e6f4ea; --warn-bg: #fff4e0; --error-bg: #fde8e6;
}
* { box-sizing: border-box; }
html { font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--text); background: var(--bg); }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; padding: 1rem 1.5rem; max-width: 1500px; width: 100%; margin: 0 auto; }
footer { padding: .6rem 1.5rem; color: var(--muted); font-size: .85em; border-top: 1px solid var(--line); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: .2rem 0 1rem; }
h2 { font-size: 1.1rem; margin: 0 0 .6rem; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
h1 small, h2 small, h3 small { font-weight: normal; font-size: .75em; }
h2 a.muted { font-size: .75em; font-weight: normal; margin-left: .5rem; }
code { background: #eef0f3; padding: 0 .25em; border-radius: 3px; font-size: .92em; }
kbd { font: .8em monospace; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 3px; padding: 0 .3em; background: #fafafa; color: var(--text); }
.muted { color: var(--muted); }
.upper { text-transform: uppercase; }
.num { text-align: right; white-space: nowrap; }
.trunc { max-width: 24rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.narrow { max-width: 28rem; margin: 3rem auto; }

/* header / nav */
.top { display: flex; align-items: center; gap: 1rem; padding: .4rem 1.5rem; background: #1f2430; color: #fff; }
.top .brand { color: #fff; font-weight: bold; font-size: 1.2rem; }
.top nav { display: flex; flex-wrap: wrap; gap: .1rem; align-items: center; }
.top nav a, .top nav button.link { color: #d7dbe3; padding: .35rem .6rem; border-radius: 4px; background: none; border: 0; font: inherit; cursor: pointer; }
.top nav a:hover, .top nav button.link:hover { background: #2f3646; text-decoration: none; color: #fff; }
.top nav a.active { background: var(--accent); color: #fff; }
.badge { display: inline-block; min-width: 1.4em; padding: 0 .4em; border-radius: 1em; background: var(--error); color: #fff; font-size: .8em; text-align: center; }
form.inline { display: inline; }

/* layout */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: .9rem 1rem; margin-bottom: 1rem; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(28rem, 1fr)); gap: 1rem; align-items: start; }
.cards { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: 1rem; }
.card.stat { display: flex; flex-direction: column; min-width: 8rem; margin: 0; padding: .6rem .9rem; }
.card.stat .label { color: var(--muted); font-size: .85em; }
.card.stat .value { font-size: 1.6rem; font-weight: bold; }
.flash { padding: .6rem .9rem; border-radius: 4px; margin-bottom: 1rem; background: var(--ok-bg); color: var(--ok); border: 1px solid currentColor; }
.flash-warn { background: var(--warn-bg); color: var(--warn); }
.flash-error { background: var(--error-bg); color: var(--error); }

/* tables */
table { border-collapse: collapse; width: 100%; margin-bottom: .6rem; }
th, td { padding: .35rem .5rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-weight: 600; background: #f8f9fb; white-space: nowrap; }
tr:hover td { background: #fafbfd; }
tr.total td { font-weight: bold; background: #f3f5f8; }
table.compact th, table.compact td { padding: .2rem .4rem; font-size: .92em; }
table.jobs td { font-size: .9em; white-space: nowrap; }
table.stats td .muted { font-size: .85em; }
.pager { text-align: center; }
.pager a { margin: 0 .8rem; }

/* forms */
label { display: block; margin: .3rem 0; }
input[type=text], input[type=password], input[type=search], input[type=number], input[type=file], select {
  font: inherit; padding: .35rem .5rem; border: 1px solid #c9cdd4; border-radius: 4px; background: #fff; min-width: 12rem; max-width: 100%;
}
input[type=text], input[type=password], input[type=search] { width: 100%; }
.row label input, .row label select, label input.short { width: auto; display: inline-block; }
input.short { min-width: 6rem; width: 7rem; }
fieldset { border: 1px solid var(--line); border-radius: 4px; margin: .5rem 0; padding: .3rem .8rem .6rem; }
legend { color: var(--muted); font-size: .9em; }
.checks { display: flex; flex-wrap: wrap; gap: .2rem 1rem; }
.checks label { margin: 0; white-space: nowrap; }
.row { display: flex; flex-wrap: wrap; gap: .4rem 1rem; align-items: center; }
.row label { margin: 0; }
button, .button { font: inherit; padding: .4rem .9rem; border-radius: 4px; border: 1px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer; display: inline-block; }
button:hover, .button:hover { filter: brightness(1.1); text-decoration: none; }
button.secondary, .button.secondary { background: #fff; color: var(--accent); }
button.ok { background: var(--ok); border-color: var(--ok); }
button.danger { background: var(--error); border-color: var(--error); }
button.small { padding: .15rem .5rem; font-size: .85em; }
.button.active { background: var(--accent); color: #fff; }
.actions { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0; align-items: center; }
.actions form { margin: 0; }
.count { font-size: 1.05em; }

/* chips */
.chip { display: inline-block; padding: 0 .5em; border-radius: 1em; background: #eef0f3; color: #374151; font-size: .85em; white-space: nowrap; margin: .1em .15em; }
.chip.ok, .st-done, .st-accepted, .st-auto_accepted { background: var(--ok-bg); color: var(--ok); }
.chip.warn, .st-needs_review, .st-leased, .st-deferred, .st-proposed { background: var(--warn-bg); color: var(--warn); }
.chip.error, .st-dead, .st-failed, .st-rejected { background: var(--error-bg); color: var(--error); }
.st-cancelled, .st-withdrawn { color: var(--muted); }
.chip.flag { background: #fff4e0; color: #7a4d00; border: 1px solid #f0d9a8; cursor: help; }
.chip.kind { background: #e8eefc; color: #1f3f8f; }

/* review */
.review-head { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; }
.help { background: #fffbe8; }
.review { display: grid; grid-template-columns: minmax(22rem, 1fr) 2fr; gap: 1rem; align-items: start; }
@media (max-width: 60rem) { .review { grid-template-columns: 1fr; } }
.member { position: sticky; top: .5rem; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .15rem .8rem; margin: .5rem 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.candidate { background: var(--card); border: 1px solid var(--line); border-left: 5px solid #c9cdd4; border-radius: 6px; padding: .7rem .9rem; margin-bottom: .8rem; }
.candidate.st-needs_review { border-left-color: var(--warn); }
.candidate.st-accepted, .candidate.st-auto_accepted { border-left-color: var(--ok); }
.candidate.st-rejected { border-left-color: var(--error); opacity: .85; }
.candidate header { display: flex; gap: 1rem; align-items: flex-start; }
.candidate .who { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.candidate .actions { flex-direction: column; margin: 0; }
.score { font-size: 1.8rem; font-weight: bold; min-width: 3.2rem; text-align: center; border-radius: 6px; padding: .2rem .3rem; color: #fff; }
.score-high { background: var(--ok); }
.score-mid { background: var(--warn); }
.score-low { background: #9aa0ab; }
.details { margin-top: .5rem; }
table.breakdown { width: auto; margin: .3rem 0; }
table.breakdown th, table.breakdown td { padding: .1rem .5rem; font-size: .85em; text-align: center; }
.sources, .evidence { margin: .3rem 0; padding-left: 1.2rem; font-size: .92em; }
.hint em { color: var(--muted); font-style: normal; font-size: .9em; }
.batch { border-top: 1px solid var(--line); padding-top: .6rem; margin-top: .6rem; }
.batch h3 { margin-top: 0; }
