/* imgtr: plain, system-font styles. No web fonts, no external resources (CSP default-src 'self'). */
:root {
  --fg: #1d2330;
  --muted: #5d6677;
  --bg: #f5f6f8;
  --card: #ffffff;
  --line: #d9dde4;
  --accent: #2458c6;
  --danger: #b3261e;
  --ok: #1f7a3a;
  --warn-bg: #fff4d6;
  --warn-line: #e3c261;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  color: var(--fg);
  background: var(--bg);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font: 13px ui-monospace, SFMono-Regular, Menlo, monospace; }

.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 10px 24px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 17px; color: var(--fg); }
.nav { display: flex; gap: 16px; flex: 1; }
.who { display: flex; align-items: center; gap: 12px; color: var(--muted); }
.who-name { color: var(--fg); font-weight: 600; }
.role {
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 12px;
  background: #e8edf8;
  color: var(--accent);
}
.role-admin { background: #fbe3e1; color: var(--danger); }

.main { max-width: 1100px; margin: 24px auto; padding: 0 24px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px 24px;
  margin-bottom: 20px;
}
.narrow { max-width: 440px; margin-left: auto; margin-right: auto; }
h1 { font-size: 22px; margin: 0 0 12px; }
h2 { font-size: 17px; margin: 0 0 12px; }
.muted { color: var(--muted); }

form.inline { display: inline; margin: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 13px; }
input[type="text"], input[type="password"], select {
  font: inherit;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  min-width: 180px;
  background: #fff;
}
input.compact, select.compact { min-width: 0; padding: 3px 6px; font-size: 13px; }

button {
  font: inherit;
  padding: 6px 14px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}
button.secondary { background: #fff; color: var(--accent); }
button.danger { background: #fff; color: var(--danger); border-color: var(--danger); }
button.small { padding: 2px 10px; font-size: 13px; }
button.link { border: 0; background: none; color: var(--accent); padding: 0; }

.notice, .error {
  padding: 10px 14px;
  border-radius: 6px;
  margin-bottom: 16px;
}
.notice { background: var(--warn-bg); border: 1px solid var(--warn-line); }
.error { background: #fdecea; border: 1px solid #f1b8b3; color: var(--danger); }
.secret { font: 16px ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; user-select: all; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
td .row { gap: 6px; }
.status-active { color: var(--ok); }
.status-disabled { color: var(--danger); }

/* projects, jobs and /admin/system */
.status { padding: 1px 8px; border-radius: 10px; font-size: 12px; background: #eef0f4; color: var(--muted); }
.status-succeeded { background: #e3f3e8; color: var(--ok); }
.status-failed, .status-crashed { background: #fdecea; color: var(--danger); }
.status-running { background: #e8edf8; color: var(--accent); }
.status-queued { background: var(--warn-bg); color: #7a5b00; }
.wrap { word-break: break-all; }
label.grow { flex: 1; }
label.grow input { width: 100%; }

/* review UI (queue, keep/skip, detail, glossary) */
.main:has(#item) { max-width: 1600px; }
kbd {
  font: 11px ui-monospace, SFMono-Regular, Menlo, monospace;
  padding: 0 4px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: #fafbfc;
  color: var(--muted);
}
.tabs { display: flex; gap: 16px; align-items: center; margin-bottom: 16px; }
.tabs a.active { font-weight: 700; color: var(--fg); }
.tabs .spacer { flex: 1; }
.row.between { justify-content: space-between; align-items: center; }
.filters { align-items: flex-end; }
.pager { display: flex; gap: 16px; align-items: center; margin: 12px 0 0; }
.flag {
  display: inline-block;
  margin: 0 4px 2px 0;
  padding: 0 6px;
  border-radius: 8px;
  font-size: 11px;
  background: var(--warn-bg);
  color: #7a5b00;
}
.flag.bad, .bad { color: var(--danger); }
.ok { color: var(--ok); }
.state { padding: 1px 8px; border-radius: 10px; font-size: 12px; background: #eef0f4; }
.state-NEEDS_REVIEW { background: var(--warn-bg); color: #7a5b00; }
.state-AUTO_OK, .state-ACCEPTED, .state-APPLIED { background: #e3f3e8; color: var(--ok); }
.state-TO_ARTIST, .state-HANDED_OFF { background: #efe6fb; color: #5b2a9c; }
.state-STALE { background: #fdecea; color: var(--danger); }
table.queue td { vertical-align: top; }
tr.group-head th { background: #eef0f4; color: var(--fg); text-transform: none; }
.thumb-cell { width: 170px; }
img.thumb { max-width: 160px; max-height: 64px; image-rendering: pixelated; border: 1px solid var(--line); }
a.cluster { margin-left: 6px; font-weight: 700; }
.small { font-size: 12px; }
.zh { font-size: 16px; }
.src { font-size: 16px; font-weight: 600; }
ul.plain, ol.plain { list-style: none; padding: 0; margin: 0; }
table.compact th, table.compact td { padding: 3px 6px; font-size: 13px; }
table.dash td.budget { min-width: 200px; }
meter { width: 120px; height: 12px; vertical-align: middle; }

/* detail page: left facts, centre compare, right qa; the action bar spans the bottom */
.item {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 300px;
  grid-template-areas:
    "msg msg msg"
    "left centre right"
    "bar bar bar";
  gap: 16px;
  align-items: start;
}
.item > .conflict, .item > .msg { grid-column: 1 / -1; margin: 0; }
.pane { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; }
.pane.left { grid-area: left; }
.pane.centre { grid-area: centre; }
.pane.right { grid-area: right; }
.pane.actionbar {
  grid-area: bar;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: flex-end;
  position: sticky;
  bottom: 0;
  max-height: 32vh; /* the bar scrolls inside itself so it never hides the staged preview */
  overflow-y: auto;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.08);
}
.pane.actionbar form { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-end; margin: 0; }
.pane.actionbar textarea { font: inherit; min-width: 220px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; }
label.check { flex-direction: row; align-items: center; gap: 6px; font-weight: 400; }
dl.facts { display: grid; grid-template-columns: 80px 1fr; gap: 4px 8px; margin: 0 0 12px; }
dl.facts dt { color: var(--muted); font-size: 12px; }
dl.facts dd { margin: 0; }
.toolbar { gap: 16px; margin-bottom: 10px; font-size: 13px; }
.toolbar button.on { background: var(--accent); color: #fff; }
.compare { display: flex; flex-wrap: wrap; gap: 16px; }
.compare figure { margin: 0; flex: 1 1 320px; min-width: 0; }
.compare figcaption { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.compare img { max-width: 100%; image-rendering: pixelated; border: 1px solid var(--line); cursor: crosshair; }
.compare img.flicker { outline: 3px solid var(--accent); }
ol.cands { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
ol.cands li { border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; font-size: 13px; }
ol.cands li.selected { border-color: var(--accent); background: #e8edf8; }
ol.history li { font-size: 12px; margin-bottom: 2px; }
.conflict { font-weight: 600; }
