/* ============================================================================
   Guideline → Schema → Data — demo UI
   Light theme, offline: no external fonts, no CDN, no network CSS.
   ========================================================================== */

:root {
  /* type */
  --ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto,
        "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
          "Liberation Mono", "Courier New", monospace;

  /* ground + surfaces */
  --ground: #f5f6f8;
  --ground-2: #eef0f4;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --surface-3: #f3f5f8;

  /* ink */
  --ink: #16202e;
  --ink-2: #3c4a5c;
  --muted: #5f6d80;
  --faint: #8b97a7;

  /* lines */
  --line: #e4e7ec;
  --line-2: #d3d9e1;

  /* accent: deep teal */
  --accent: #0e6a62;
  --accent-2: #0a544d;
  --accent-3: #073c37;
  --accent-soft: #e7f2f1;
  --accent-soft-2: #d3e8e6;
  --ring: rgba(14, 106, 98, .16);

  /* status */
  --ok: #16794a;         --ok-bg: #e7f4ed;   --ok-line: #bfe0cd;
  --warn: #96620a;       --warn-bg: #fcf2df;  --warn-line: #ecd6a8;
  --err: #b02a20;        --err-bg: #fdeceb;   --err-line: #f2c4c0;
  --grey: #64708035;     --grey-fg: #64707f;  --grey-bg: #eff1f4;  --grey-line: #dde1e7;
  --info: #1e5fa8;       --info-bg: #e8f0fa;  --info-line: #c3d8ef;

  /* elevation */
  --sh-1: 0 1px 2px rgba(16, 24, 40, .05);
  --sh-2: 0 1px 3px rgba(16, 24, 40, .07), 0 8px 20px -12px rgba(16, 24, 40, .18);
  --sh-3: 0 18px 48px -16px rgba(16, 24, 40, .34), 0 2px 6px rgba(16, 24, 40, .08);

  /* geometry */
  --r-s: 6px;
  --r-m: 9px;
  --r-l: 13px;
  --hdr-h: 58px;
  --rail-w: 236px;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

[hidden] { display: none !important; }

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #c8cfd8; border-radius: 8px; border: 3px solid var(--ground);
}
::-webkit-scrollbar-thumb:hover { background: #aeb8c4; }

.mono { font-family: var(--mono); font-size: 12px; }
.grow { flex: 1 1 auto; }
.nowrap { white-space: nowrap; }

/* ============================================================ header ====== */

.hdr {
  height: var(--hdr-h);
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 40;
}

.hdr-brand { display: flex; align-items: center; gap: 11px; min-width: 0; }

.logo {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(150deg, var(--accent) 8%, var(--accent-3) 100%);
  display: grid; place-items: center; color: #fff;
  box-shadow: 0 2px 6px rgba(7, 60, 55, .3);
  flex: none;
}
.logo svg { width: 17px; height: 17px; display: block; }

.hdr-title {
  font-size: 14px; font-weight: 650; letter-spacing: -.015em; line-height: 1.2;
}
.hdr-title .arw { color: var(--faint); font-weight: 400; margin: 0 1px; }
.hdr-sub { font-size: 11px; color: var(--faint); line-height: 1.35; }

.hdr-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

/* status pill */
.pill {
  position: relative;
  display: inline-flex; align-items: center; gap: 7px;
  height: 28px; padding: 0 11px;
  border-radius: 999px; border: 1px solid var(--line-2);
  background: var(--surface-2);
  font-size: 12px; font-weight: 500; color: var(--ink-2);
  cursor: default; white-space: nowrap;
}
.pill .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex: none;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, .04);
}
.pill.ok    { border-color: var(--ok-line);   background: var(--ok-bg);   color: var(--ok); }
.pill.ok .dot   { background: #1f9d5f; box-shadow: 0 0 0 3px rgba(31, 157, 95, .16); }
.pill.warn  { border-color: var(--warn-line); background: var(--warn-bg); color: var(--warn); }
.pill.warn .dot { background: #d99114; box-shadow: 0 0 0 3px rgba(217, 145, 20, .18); }
.pill.err   { border-color: var(--err-line);  background: var(--err-bg);  color: var(--err); }
.pill.err .dot  { background: #d4453a; box-shadow: 0 0 0 3px rgba(212, 69, 58, .16); }

.tip {
  position: absolute; top: calc(100% + 8px); right: 0;
  min-width: 250px; padding: 10px 12px;
  background: #1d2634; color: #dfe5ec;
  border-radius: var(--r-m); box-shadow: var(--sh-3);
  font-size: 11.5px; font-weight: 400; line-height: 1.65;
  opacity: 0; visibility: hidden; transform: translateY(-3px);
  transition: opacity .13s ease, transform .13s ease, visibility .13s;
  z-index: 60; pointer-events: none; text-align: left;
}
.pill:hover .tip { opacity: 1; visibility: visible; transform: translateY(0); }
.pill:focus-visible .tip { opacity: 1; visibility: visible; transform: translateY(0); }
.tip b { color: #fff; font-weight: 600; }
.tip .tr { display: flex; justify-content: space-between; gap: 18px; }
.tip .tr span:first-child { color: #93a1b3; }

/* segmented control */
.seg {
  display: inline-flex; padding: 2px; gap: 2px;
  background: var(--ground-2); border-radius: 8px; border: 1px solid var(--line);
}
.seg button {
  border: 0; background: transparent; cursor: pointer;
  padding: 4px 11px; border-radius: 6px;
  font-size: 12px; font-weight: 500; color: var(--muted);
  transition: background .12s, color .12s, box-shadow .12s;
}
.seg button:hover { color: var(--ink); }
.seg button.on {
  background: var(--surface); color: var(--accent);
  font-weight: 600; box-shadow: var(--sh-1);
}

/* ============================================================== shell ===== */

.shell {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  height: calc(100vh - var(--hdr-h));
}

/* rail */
.rail {
  border-right: 1px solid var(--line);
  background: var(--surface);
  padding: 20px 14px 14px;
  display: flex; flex-direction: column;
  overflow-y: auto;
}

.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }

.step {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 10px 10px; border-radius: var(--r-m);
  cursor: pointer; position: relative;
  transition: background .12s;
}
.step:hover { background: var(--surface-3); }
.step .num {
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  font-size: 11.5px; font-weight: 650;
  background: var(--ground-2); color: var(--muted);
  border: 1px solid var(--line-2);
  transition: all .14s;
}
.step .name { font-size: 13px; font-weight: 550; color: var(--ink-2); line-height: 1.6; }
.step .sum {
  font-size: 11px; color: var(--faint); line-height: 1.4;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 160px;
}
.step.done .num { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-soft-2); }
.step.active { background: var(--accent-soft); }
.step.active .num {
  background: var(--accent); color: #fff; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}
.step.active .name { color: var(--accent-3); font-weight: 650; }
.step.active .sum { color: var(--accent-2); opacity: .8; }
.step.locked { cursor: not-allowed; opacity: .55; }
.step.locked:hover { background: transparent; }

.step-line {
  height: 12px; width: 1px; background: var(--line-2);
  margin-left: 21px; flex: none;
}

.rail-foot { margin-top: auto; padding-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.rail-note {
  font-size: 10.5px; color: var(--faint); line-height: 1.5;
  border-top: 1px solid var(--line); padding-top: 10px;
}
.rail-note .k { color: var(--muted); font-weight: 550; }

/* stage */
.stage { overflow-y: auto; padding: 24px 28px 72px; }
.pane { max-width: 1180px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }

.pane-head { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.pane-head h1 { font-size: 20px; letter-spacing: -.02em; }
.pane-head p { font-size: 12.5px; color: var(--muted); max-width: 640px; }
.pane-head .grow { min-width: 8px; }

/* ============================================================== cards ===== */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-l);
  box-shadow: var(--sh-1);
  overflow: hidden;
}
.card-hd {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(var(--surface), var(--surface-2));
}
.card-hd h2 { font-size: 13.5px; font-weight: 620; }
.card-hd .sub { font-size: 11.5px; color: var(--faint); }
.card-bd { padding: 16px; }
.card-bd.flush { padding: 0; }
.card-bd.tight { padding: 10px; }
.card-ft {
  padding: 10px 16px; border-top: 1px solid var(--line);
  background: var(--surface-2); font-size: 11.5px; color: var(--muted);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 18px; align-items: start; }

/* ============================================================= buttons ==== */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 13px;
  border-radius: 8px; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink-2);
  font-size: 12.5px; font-weight: 550; cursor: pointer;
  box-shadow: var(--sh-1);
  transition: background .12s, border-color .12s, color .12s, box-shadow .12s, transform .06s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-3); border-color: #c2cad4; }
.btn:active { transform: translateY(.5px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn svg { width: 14px; height: 14px; flex: none; }

.btn.primary {
  background: linear-gradient(var(--accent), var(--accent-2));
  border-color: var(--accent-2); color: #fff;
  box-shadow: 0 1px 2px rgba(7, 60, 55, .28);
}
.btn.primary:hover { background: linear-gradient(var(--accent-2), var(--accent-3)); border-color: var(--accent-3); }

.btn.ghost { background: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--surface-3); }

.btn.sm { height: 26px; padding: 0 9px; font-size: 11.5px; border-radius: 6px; }
.btn.sm svg { width: 12px; height: 12px; }
.btn.lg { height: 36px; padding: 0 17px; font-size: 13px; }
.btn.block { width: 100%; }
.btn.danger:hover { color: var(--err); border-color: var(--err-line); background: var(--err-bg); }

.btn[disabled] {
  opacity: .48; cursor: not-allowed; pointer-events: none;
  filter: saturate(.6);
}

.spinner {
  width: 13px; height: 13px; flex: none;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff; border-radius: 50%;
  animation: spin .7s linear infinite;
}
.spinner.dark { border-color: rgba(14, 106, 98, .25); border-top-color: var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }

/* =============================================================== tabs ===== */

.tabs { display: inline-flex; gap: 2px; padding: 2px; background: var(--ground-2); border-radius: 8px; }
.tabs button {
  border: 0; background: transparent; cursor: pointer;
  padding: 4px 12px; border-radius: 6px;
  font-size: 12px; font-weight: 550; color: var(--muted);
  transition: background .12s, color .12s, box-shadow .12s;
}
.tabs button:hover { color: var(--ink); }
.tabs button.on { background: var(--surface); color: var(--accent); box-shadow: var(--sh-1); }
.tabs .cnt {
  font-size: 10px; margin-left: 5px; padding: 0 4px; border-radius: 4px;
  background: var(--ground-2); color: var(--muted); font-weight: 600;
}
.tabs button.on .cnt { background: var(--accent-soft); color: var(--accent); }

/* =========================================================== drop zones === */

.drops { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.drop {
  border: 1.5px dashed var(--line-2);
  border-radius: var(--r-m);
  background: var(--surface-2);
  padding: 18px 14px;
  text-align: center; cursor: pointer;
  transition: border-color .14s, background .14s, box-shadow .14s;
  position: relative;
}
.drop:hover { border-color: var(--accent); background: var(--accent-soft); }
.drop.over {
  border-color: var(--accent); background: var(--accent-soft);
  box-shadow: 0 0 0 4px var(--ring);
}
.drop.filled { border-style: solid; border-color: var(--accent-soft-2); background: var(--accent-soft); text-align: left; }
.drop.tall { padding: 30px 16px; }

.drop .ic {
  width: 30px; height: 30px; margin: 0 auto 8px;
  border-radius: 8px; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--accent);
}
.drop.filled .ic { margin: 0; }
.drop .ic svg { width: 15px; height: 15px; }
.drop .t { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.drop .s { font-size: 11px; color: var(--faint); margin-top: 2px; }
.drop .req { color: var(--err); font-weight: 600; }
.drop .opt { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--faint); }
.drop-filled-row { display: flex; align-items: center; gap: 10px; }
.drop-filled-row .nm {
  font-family: var(--mono); font-size: 11.5px; font-weight: 600; color: var(--accent-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.drop-filled-row .sz { font-size: 10.5px; color: var(--accent-2); opacity: .75; }
.x-btn {
  margin-left: auto; border: 0; background: transparent; cursor: pointer;
  color: var(--muted); width: 22px; height: 22px; border-radius: 5px;
  display: grid; place-items: center; flex: none;
}
.x-btn:hover { background: rgba(0, 0, 0, .06); color: var(--err); }
.x-btn svg { width: 12px; height: 12px; }

/* ============================================================== forms ===== */

.field { display: block; margin-top: 14px; }
.field > span {
  display: block; font-size: 11.5px; font-weight: 600; color: var(--ink-2);
  margin-bottom: 5px;
}
.field input, .inp {
  width: 100%; height: 32px; padding: 0 10px;
  border: 1px solid var(--line-2); border-radius: 7px;
  background: var(--surface); font-size: 12.5px;
  transition: border-color .12s, box-shadow .12s;
}
.field input:focus, .inp:focus {
  outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring);
}
.field input::placeholder, .inp::placeholder { color: #a9b3c0; }

.check {
  display: flex; align-items: center; gap: 7px; margin-top: 12px;
  font-size: 12px; color: var(--ink-2); cursor: pointer;
}
.check input { width: 14px; height: 14px; accent-color: var(--accent); cursor: pointer; }

/* the "read it again from scratch" option, sitting inline in an action row */
.check.inline {
  margin-top: 0; padding: 7px 10px; border: 1px solid var(--line);
  border-radius: var(--r-m); background: var(--surface-2); white-space: nowrap;
}
.check.inline:hover { border-color: var(--accent); }

.hint { font-size: 11px; color: var(--faint); margin-top: 9px; line-height: 1.55; }

/* guideline build panel (the build outlives the request) */
.gen-panel {
  margin-top: 14px; padding: 12px 13px; border-radius: var(--r-m);
  border: 1px solid var(--accent-soft-2); background: var(--accent-soft);
}
.gen-panel.failed { border-color: var(--err-line); background: var(--err-bg); }
.gen-panel.reused { border-color: var(--ok-line); background: var(--ok-bg); }
.gen-panel.waiting { border-color: var(--warn-line); background: var(--warn-bg); }
.gen-panel .gp-row { display: flex; align-items: flex-start; gap: 10px; }
.gen-panel .gp-txt { flex: 1 1 auto; min-width: 0; }
.gen-panel .gp-txt b { font-size: 12.5px; color: var(--ink); font-weight: 620; }
.gen-panel .gp-sub { font-size: 12px; color: var(--ink-2); line-height: 1.5; margin-top: 2px; }
.gen-panel.failed .gp-sub { color: var(--err); }
.gen-panel .gp-el {
  flex: none; font-family: var(--mono); font-size: 12px; font-weight: 650;
  color: var(--accent-2); font-variant-numeric: tabular-nums;
}
.gen-panel .bar { margin-top: 10px; background: rgba(255, 255, 255, .65); }
.gen-panel .gp-note { margin-top: 8px; font-size: 11.5px; color: var(--muted); line-height: 1.5; }
.gen-panel .gp-acts { display: flex; gap: 8px; margin-top: 10px; }
.row-end { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.row-between { display: flex; align-items: center; gap: 10px; }

.gen-status { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.gen-status .el { font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--accent); font-weight: 600; }

/* ============================================================== badges ==== */

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  height: 19px; padding: 0 7px; border-radius: 5px;
  font-size: 10.5px; font-weight: 650; letter-spacing: .01em;
  background: var(--grey-bg); color: var(--grey-fg); border: 1px solid var(--grey-line);
  white-space: nowrap;
}
.badge.ok   { background: var(--ok-bg);   color: var(--ok);   border-color: var(--ok-line); }
.badge.warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }
.badge.err  { background: var(--err-bg);  color: var(--err);  border-color: var(--err-line); }
.badge.info { background: var(--info-bg); color: var(--info); border-color: var(--info-line); }
.badge.acc  { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-soft-2); }
.badge.req  { background: #f6eefb; color: #6f3a96; border-color: #e3d1ef; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 8px; border-radius: 999px;
  background: var(--surface-3); border: 1px solid var(--line);
  font-size: 11px; color: var(--muted); white-space: nowrap;
}
.chip.mono { font-family: var(--mono); font-size: 10.5px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.count {
  font-size: 11px; color: var(--muted); background: var(--ground-2);
  padding: 1px 7px; border-radius: 999px; font-weight: 600;
}

.meta { font-size: 11.5px; color: var(--faint); font-family: var(--mono); }

/* ============================================================== tables ==== */

.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
table.tbl th {
  text-align: left; font-size: 10.5px; font-weight: 650; letter-spacing: .04em;
  text-transform: uppercase; color: var(--faint);
  padding: 8px 12px; border-bottom: 1px solid var(--line);
  background: var(--surface-2); position: sticky; top: 0; z-index: 1;
  white-space: nowrap;
}
table.tbl td {
  padding: 8px 12px; border-bottom: 1px solid var(--line);
  vertical-align: top; color: var(--ink-2);
}
table.tbl tbody tr:last-child td { border-bottom: 0; }
table.tbl tbody tr:hover { background: var(--surface-2); }
table.tbl tr.grp td {
  background: var(--surface-3); font-weight: 620; color: var(--accent-3);
  font-size: 12px; border-bottom: 1px solid var(--line-2);
}
table.tbl tr.grp:hover td { background: var(--surface-3); }
table.tbl tr.grp .tblname { font-family: var(--mono); font-size: 12px; }
table.tbl td.k { font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--ink); white-space: nowrap; }
table.tbl td.k.ind { padding-left: 28px; position: relative; }
table.tbl td.k.ind::before {
  content: ""; position: absolute; left: 16px; top: 0; bottom: 0; width: 1px; background: var(--line-2);
}
table.tbl td.desc { color: var(--muted); font-size: 12px; min-width: 190px; max-width: 420px; line-height: 1.5; }
table.tbl td.ty { font-family: var(--mono); font-size: 12px; color: var(--info); }
table.tbl.compact th, table.tbl.compact td { padding-left: 9px; padding-right: 9px; }
table.tbl.compact td.vc { min-width: 88px; }
table.tbl td.vc { min-width: 104px; }
table.tbl td.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 12px; }

/* ======================================================== guideline list == */

.gl-card {
  border: 1px solid var(--line); border-radius: var(--r-m);
  padding: 11px 12px; margin-bottom: 8px; background: var(--surface);
  cursor: pointer; transition: border-color .13s, box-shadow .13s, background .13s;
  position: relative;
}
.gl-card:last-child { margin-bottom: 0; }
.gl-card:hover { border-color: var(--line-2); box-shadow: var(--sh-1); }
.gl-card.sel {
  border-color: var(--accent); background: var(--accent-soft);
  box-shadow: 0 0 0 3px var(--ring);
}
.gl-top { display: flex; align-items: center; gap: 8px; }
.gl-name { font-size: 12.5px; font-weight: 620; color: var(--ink); }
.gl-id { font-family: var(--mono); font-size: 10.5px; color: var(--faint); }
.gl-meta { font-size: 11px; color: var(--muted); margin-top: 5px; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.gl-acts { display: flex; gap: 6px; margin-top: 9px; }
/* a guideline nobody has registered any more, kept because jobs still validate against it */
.gl-kept { color: var(--warn); font-weight: 600; cursor: help; }
.gl-check {
  margin-left: auto; width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); color: #fff; display: grid; place-items: center; flex: none;
}
.gl-check svg { width: 9px; height: 9px; }

/* =============================================================== jobs ===== */

.jobs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(430px, 1fr)); gap: 14px; }

.job {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-l); padding: 14px; box-shadow: var(--sh-1);
  border-left: 3px solid var(--line-2);
  transition: border-color .2s, box-shadow .2s;
}
.job.st-running { border-left-color: var(--accent); }
.job.st-queued { border-left-color: var(--line-2); }
.job.st-ok { border-left-color: #1f9d5f; }
.job.st-needs_review { border-left-color: #d99114; }
.job.st-failed { border-left-color: #d4453a; background: linear-gradient(var(--surface), #fdf7f7); }
.job.st-not_ci { border-left-color: #9aa5b2; background: var(--surface-2); }

.job-top { display: flex; align-items: center; gap: 8px; }
.job-name {
  font-family: var(--mono); font-size: 12px; font-weight: 620; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.job-sub { font-size: 11px; color: var(--faint); margin-top: 2px; display: flex; gap: 10px; }

.stages { display: flex; gap: 4px; margin: 12px 0 9px; }
.stg {
  flex: 1 1 0; min-width: 0;
  font-size: 9px; font-weight: 650; letter-spacing: .01em; text-transform: uppercase;
  text-align: center; padding: 3px 2px; border-radius: 5px;
  background: var(--ground-2); color: #9aa5b2;
  border: 1px solid transparent;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: background .2s, color .2s, border-color .2s;
}
.stg.done { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-soft-2); }
.stg.cur {
  background: var(--accent); color: #fff; border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--ring);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .78; } }

.bar { height: 5px; border-radius: 3px; background: var(--ground-2); overflow: hidden; }
.bar > i {
  display: block; height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), #16948a);
  transition: width .45s cubic-bezier(.4, 0, .2, 1);
}
.bar.ok > i { background: linear-gradient(90deg, #1f9d5f, #35b877); }
.bar.warn > i { background: linear-gradient(90deg, #d99114, #eaa833); }
.bar.err > i { background: linear-gradient(90deg, #d4453a, #e26258); }
.bar.grey > i { background: #b6bfca; }

.job-msg {
  margin-top: 9px; font-size: 11px; color: var(--muted);
  display: flex; align-items: center; gap: 8px; min-height: 17px;
}
.job-msg .txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-msg .el { margin-left: auto; font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--faint); flex: none; }

.job-err {
  margin-top: 10px; padding: 8px 10px; border-radius: var(--r-s);
  background: var(--err-bg); border: 1px solid var(--err-line);
  color: var(--err); font-size: 11.5px; line-height: 1.5;
}
.job-note {
  margin-top: 10px; padding: 8px 10px; border-radius: var(--r-s);
  background: var(--grey-bg); border: 1px solid var(--grey-line);
  color: var(--grey-fg); font-size: 11.5px;
}
.job-done { margin-top: 10px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* run bar */
.runbar {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px; border-radius: var(--r-l);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--sh-1);
}
.runbar .rb-t { font-size: 12.5px; font-weight: 600; }
.runbar .rb-s { font-size: 11.5px; color: var(--muted); }

/* ============================================================== chips ===== */

.fchip {
  display: inline-flex; align-items: center; gap: 7px;
  height: 27px; padding: 0 4px 0 9px; border-radius: 7px;
  background: var(--surface); border: 1px solid var(--line-2);
  font-size: 11.5px; box-shadow: var(--sh-1);
}
.fchip .nm { font-family: var(--mono); font-size: 11px; color: var(--ink-2); max-width: 250px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fchip .src {
  font-size: 9px; text-transform: uppercase; letter-spacing: .05em; font-weight: 700;
  padding: 1px 4px; border-radius: 3px;
}
.fchip .src.upload { background: var(--info-bg); color: var(--info); }
.fchip .src.corpus { background: var(--accent-soft); color: var(--accent); }

/* ============================================================ batch bar === */

.batchbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 12px 16px; border-radius: var(--r-l);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--sh-1);
}
.stats { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 0; }
.stat {
  display: flex; flex-direction: column; gap: 1px;
  padding: 2px 14px 2px 0; margin-right: 6px;
  border-right: 1px solid var(--line);
}
.stat:last-of-type { border-right: 0; }
.stat .v { font-size: 17px; font-weight: 650; line-height: 1.15; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); font-weight: 600; }
.stat.ok .v { color: var(--ok); }
.stat.warn .v { color: var(--warn); }
.stat.err .v { color: var(--err); }
.stat.grey .v { color: var(--grey-fg); }
.stat.zero .v { color: var(--faint); opacity: .55; }

/* ============================================================= results ==== */

.results { display: grid; grid-template-columns: 244px minmax(0, 1fr); gap: 16px; align-items: start; }

.filelist {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-l); box-shadow: var(--sh-1); overflow: hidden;
  position: sticky; top: 0;
}
.fl-hd {
  padding: 10px 12px; border-bottom: 1px solid var(--line);
  font-size: 10.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--faint);
  background: var(--surface-2);
}
.fl-body { max-height: calc(100vh - 260px); overflow-y: auto; padding: 6px; }
.fl-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 9px; border-radius: 7px; cursor: pointer;
  transition: background .12s;
}
.fl-item:hover { background: var(--surface-3); }
.fl-item.sel { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-soft-2); }
.fl-item .sdot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex: none; }
.fl-item .sdot.ok { background: #1f9d5f; }
.fl-item .sdot.warn { background: #d99114; }
.fl-item .sdot.err { background: #d4453a; }
.fl-item .sdot.grey { background: #9aa5b2; }
.fl-item .nm {
  font-family: var(--mono); font-size: 11px; color: var(--ink-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.fl-item.sel .nm { color: var(--accent-3); font-weight: 600; }
.fl-item .n2 { font-size: 10px; color: var(--faint); margin-left: auto; flex: none; font-variant-numeric: tabular-nums; }

/* JSON viewer */
.json-wrap {
  background: #fbfcfd; border: 1px solid var(--line); border-radius: var(--r-m);
  max-height: 60vh; overflow: auto;
}
pre.json {
  margin: 0; padding: 14px 16px;
  font-family: var(--mono); font-size: 11.5px; line-height: 1.65;
  color: var(--ink-2); white-space: pre; tab-size: 2;
}
.j-key { color: #7a3ea3; font-weight: 600; }
.j-str { color: #1a6b3c; }
.j-num { color: #b4501a; font-variant-numeric: tabular-nums; }
.j-bool { color: #1e5fa8; font-weight: 600; }
.j-null { color: #98a2b0; font-style: italic; }
.j-punc { color: #9aa5b2; }

/* ---- collapsible JSON tree ---------------------------------------------- */

.jsonv { border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface); overflow: hidden; }
.jv-info {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 9px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2);
}
.jv-info .t { font-size: 12px; color: var(--muted); }
.jv-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2);
}
.jv-searchwrap {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 9px; flex: 0 1 200px; min-width: 130px;
  border: 1px solid var(--line-2); border-radius: 7px; background: var(--surface);
  color: var(--faint); transition: border-color .12s, box-shadow .12s;
}
.jv-searchwrap:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); color: var(--accent); }
.jv-searchwrap svg { width: 13px; height: 13px; flex: none; }
.jv-q {
  border: 0; outline: 0; background: transparent; width: 100%; min-width: 0;
  font-size: 12px; color: var(--ink);
}
.jv-q::-webkit-search-cancel-button { cursor: pointer; }
.jv-hits { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.jv-seg { height: 28px; }
.jv-seg button { font-size: 12px; padding: 0 10px; }

.jv-tree { max-height: 60vh; overflow: auto; padding: 4px 0 6px; }
.jv-raw .json-wrap { border: 0; border-radius: 0; max-height: 60vh; }

.jt-none { padding: 14px 16px; font-size: 12px; color: var(--faint); font-style: italic; }
.jt-node > .jt-kids { display: none; }
.jt-node.open > .jt-kids { display: block; }
.jt-node.hide { display: none; }

.jt-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 3px 12px 3px 0; min-height: 22px;
  border-bottom: 1px solid transparent;
}
.jt-row.alt { background: var(--surface-2); }
.jt-row:hover { background: var(--accent-soft); }
.jt-row.br { cursor: pointer; user-select: none; }
.jt-row.ent {
  background: var(--surface-3); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding-top: 6px; padding-bottom: 6px; margin-top: 2px;
}
.jt-row.ent:hover { background: var(--accent-soft); }

.jt-kc {
  flex: 0 0 250px; display: flex; align-items: center; gap: 5px; min-width: 0;
  padding-right: 8px;
}
.jt-tw { width: 12px; flex: none; display: inline-flex; align-items: center; justify-content: center; color: var(--faint); }
.jt-tw svg { width: 10px; height: 10px; transition: transform .12s; }
.jt-node.open > .jt-row .jt-tw svg { transform: rotate(90deg); }
.jt-k {
  font-family: var(--mono); font-size: 12px; font-weight: 600; color: #6f3a95;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.jt-row.ent .jt-k { font-family: var(--ui); color: var(--accent-3); font-weight: 650; }
.jt-cnt { font-size: 11px; font-weight: 650; color: var(--faint); flex: none; font-variant-numeric: tabular-nums; }

.jt-vc { flex: 1 1 auto; min-width: 0; display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; }
.jt-v { font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; }
.jt-v.t-string { color: #1a6b3c; }
.jt-v.t-number { color: #b4501a; font-variant-numeric: tabular-nums; }
.jt-v.t-boolean { color: #1e5fa8; font-weight: 600; }
.jt-v.t-null { color: #98a2b0; font-style: italic; }
.jt-hdr { font-size: 12px; color: var(--ink-2); font-weight: 550; }
.jt-rev {
  flex: none; font-size: 10px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
  padding: 1px 6px; border-radius: 4px;
  background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn-line);
}
.jt-rev.error { background: var(--err-bg); color: var(--err); border-color: var(--err-line); }
.jt-rev.info { background: var(--info-bg); color: var(--info); border-color: var(--info-line); }
.jt-row mark { background: #ffe9a8; color: inherit; border-radius: 2px; padding: 0 1px; }
.jt-node.hit > .jt-row { background: #fffbef; }

/* ---- image load failures ------------------------------------------------ */

.img-err {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
  padding: 6px; font-size: 10.5px; line-height: 1.35; color: var(--muted);
  background: repeating-linear-gradient(45deg, #f2f4f7 0 6px, #eaeef3 6px 12px);
}

.toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 11px; flex-wrap: wrap; }
.toolbar .t { font-size: 11.5px; color: var(--muted); }

/* review table */
.sev {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 7px; border-radius: 4px;
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
}
.sev.error { background: var(--err-bg); color: var(--err); }
.sev.warning { background: var(--warn-bg); color: var(--warn); }
.sev.info { background: var(--info-bg); color: var(--info); }

.pglink {
  border: 0; background: var(--accent-soft); color: var(--accent);
  font-family: var(--mono); font-size: 10.5px; font-weight: 650;
  padding: 2px 7px; border-radius: 5px; cursor: pointer; white-space: nowrap;
  transition: background .12s;
}
.pglink:hover { background: var(--accent-soft-2); }

.val { font-family: var(--mono); font-size: 12px; color: var(--ink); overflow-wrap: anywhere; }
/* `.empty` is also the big empty-state block, whose 40px/24px padding and centring
   were landing on every null value: the padding squeezed the Value column until
   `overflow-wrap: anywhere` split the word across lines as "nul/l". */
.val.empty {
  color: var(--faint); font-style: italic;
  padding: 0; text-align: left;
  overflow-wrap: normal; white-space: nowrap;
}
.sugg { font-size: 11.5px; color: var(--muted); margin-top: 3px; font-style: italic; }

/* report */
.entry {
  border: 1px solid var(--line); border-radius: var(--r-m);
  margin-bottom: 12px; overflow: hidden; background: var(--surface);
}
.entry-hd {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 13px; background: var(--surface-2); border-bottom: 1px solid var(--line);
}
.entry-hd .ix {
  width: 20px; height: 20px; border-radius: 5px; flex: none;
  background: var(--accent); color: #fff; display: grid; place-items: center;
  font-size: 10.5px; font-weight: 700;
}
.entry-hd .inv { font-family: var(--mono); font-size: 12.5px; font-weight: 650; color: var(--ink); }

.kv {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  background: var(--surface); margin-left: -1px;   /* clip the leftmost rule */
}
.kv > div {
  padding: 9px 13px;
  border-top: 1px solid var(--line); border-left: 1px solid var(--line);
}
.kv .kk { font-size: 10px; text-transform: uppercase; letter-spacing: .045em; color: var(--faint); font-weight: 650; }
.kv .vv { font-size: 12.5px; font-family: var(--mono); color: var(--ink); margin-top: 2px; word-break: break-word; }
.kv .vv.null { color: var(--faint); font-style: italic; font-family: var(--ui); }

.conf { padding: 10px 13px; display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--line); }
.conf .conf-lbl { font-size: 10.5px; text-transform: uppercase; letter-spacing: .045em; color: var(--faint); font-weight: 650; flex: none; }
.conf .track { flex: 1 1 auto; height: 6px; border-radius: 3px; background: var(--ground-2); overflow: hidden; }
.conf .track > i { display: block; height: 100%; border-radius: 3px; }
.conf .pc { font-family: var(--mono); font-size: 11.5px; font-weight: 650; flex: none; font-variant-numeric: tabular-nums; }

details.fields-det { border-top: 1px solid var(--line); }
details.fields-det > summary {
  padding: 8px 13px; cursor: pointer; font-size: 11.5px; color: var(--muted);
  font-weight: 550; list-style: none; user-select: none;
}
details.fields-det > summary::-webkit-details-marker { display: none; }
details.fields-det > summary::before { content: "▸ "; color: var(--faint); }
details.fields-det[open] > summary::before { content: "▾ "; }
details.fields-det > summary:hover { background: var(--surface-2); color: var(--ink-2); }

.lcbox {
  border: 1px solid var(--accent-soft-2); background: var(--accent-soft);
  border-radius: var(--r-m); overflow: hidden; margin-bottom: 12px;
}
.lcbox .lc-hd {
  padding: 9px 13px; font-size: 11.5px; font-weight: 650; color: var(--accent-3);
  border-bottom: 1px solid var(--accent-soft-2);
  display: flex; align-items: center; gap: 8px;
}
.lcbox .kv { background: #f4faf9; }
.lcbox .kv > div { border-color: var(--accent-soft-2); }

.usage-line {
  display: flex; flex-wrap: wrap; gap: 6px 16px;
  padding: 10px 13px; border-radius: var(--r-m);
  background: var(--surface-3); border: 1px solid var(--line);
  font-size: 11px; color: var(--muted);
}
.usage-line b { color: var(--ink-2); font-family: var(--mono); font-weight: 650; }

.sec-h {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--faint); margin: 18px 0 9px;
  display: flex; align-items: center; gap: 8px;
}
.sec-h::after { content: ""; flex: 1 1 auto; height: 1px; background: var(--line); }
.sec-h:first-child { margin-top: 0; }

.rule-row {
  display: flex; align-items: flex-start; gap: 9px; padding: 7px 0;
  border-bottom: 1px solid var(--line); font-size: 11.5px;
}
.rule-row:last-child { border-bottom: 0; }
.rule-row .rid { font-size: 12px; color: var(--ink-2); font-weight: 600; flex: 0 0 190px; }
.rule-row .rmsg { color: var(--muted); }

/* pages */
.pages-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 12px; }
.pg { cursor: pointer; }
.pg .frame {
  border: 1px solid var(--line-2); border-radius: var(--r-s); overflow: hidden;
  background: var(--surface-3); aspect-ratio: 3 / 4;
  display: grid; place-items: center; position: relative;
  transition: border-color .13s, box-shadow .13s, transform .13s;
}
.pg:hover .frame { border-color: var(--accent); box-shadow: 0 4px 14px -4px rgba(14, 106, 98, .3); transform: translateY(-1px); }
.pg .frame img { width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block; }
.pg.dim .frame { opacity: .42; filter: grayscale(1); }
.pg .num {
  position: absolute; top: 4px; left: 4px;
  background: rgba(22, 32, 46, .78); color: #fff;
  font-family: var(--mono); font-size: 9.5px; font-weight: 650;
  padding: 1px 5px; border-radius: 4px;
}
.pg .lbl {
  margin-top: 5px; font-size: 10px; text-align: center; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pg .lbl.ci { color: var(--accent); font-weight: 650; }
.pg .lbl.off { color: var(--faint); }
.pg .flag {
  position: absolute; bottom: 4px; left: 4px; right: 4px;
  background: rgba(22, 32, 46, .72); color: #fff;
  font-size: 9px; text-transform: uppercase; letter-spacing: .04em; font-weight: 650;
  padding: 1px 4px; border-radius: 3px; text-align: center;
}

/* =================================================== model activity ====== */

.rescol { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.act { margin-top: 11px; border-top: 1px solid var(--line); }
#genActivity:empty { display: none; }
#genActivity .act {
  margin-top: 12px; border: 1px solid var(--line); border-radius: var(--r-l);
  background: var(--surface); overflow: hidden;
}
#genActivity .act-tog { padding: 10px 12px; background: var(--surface-2); border-bottom: 1px solid transparent; }
#genActivity .act.open .act-tog { border-bottom-color: var(--line); }
#genActivity .act-body { border: 0; border-radius: 0; margin-bottom: 0; grid-template-columns: 190px minmax(0, 1fr); }
#genActivity .act-list, #genActivity .act-pane { max-height: 260px; }
#resActivity .act {
  margin-top: 0; border: 1px solid var(--line); border-radius: var(--r-l);
  background: var(--surface); box-shadow: var(--sh-1); overflow: hidden;
}

.act-tog {
  display: flex; align-items: center; gap: 7px; width: 100%;
  border: 0; background: transparent; cursor: pointer; text-align: left;
  padding: 9px 2px; font-size: 11.5px; font-weight: 600; color: var(--muted);
  transition: color .12s;
}
#resActivity .act-tog { padding: 11px 14px; background: var(--surface-2); border-bottom: 1px solid transparent; }
#resActivity .act.open .act-tog { border-bottom-color: var(--line); }
.act-tog:hover { color: var(--ink-2); }
.act-tog .chev { display: grid; place-items: center; transition: transform .16s ease; color: var(--faint); }
.act-tog .chev svg { width: 12px; height: 12px; display: block; }
.act.open .act-tog .chev { transform: rotate(90deg); color: var(--accent); }
.act.open .act-tog { color: var(--accent-3); }
.act-n { font-size: 10.5px; font-weight: 600; color: var(--faint); background: var(--ground-2); padding: 0 6px; border-radius: 999px; }

.act-run { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 600; color: var(--accent); }
.act-run .pip {
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
  animation: pulse 1.1s ease-in-out infinite;
}

.act-body {
  display: grid; grid-template-columns: 172px minmax(0, 1fr);
  gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: var(--r-m);
  overflow: hidden; margin-bottom: 12px;
}
#resActivity .act-body { border: 0; border-radius: 0; margin-bottom: 0; }
#resActivity .act-body { grid-template-columns: 210px minmax(0, 1fr); }

.act-list { background: var(--surface-2); padding: 5px; max-height: 260px; overflow-y: auto; }
#resActivity .act-list { max-height: 330px; }

.act-item {
  padding: 6px 8px; border-radius: 6px; cursor: pointer;
  transition: background .12s;
}
.act-item:hover { background: var(--surface-3); }
.act-item.sel { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-soft-2); }
.act-item .r1 { display: flex; align-items: center; gap: 6px; }
.act-item .r2 {
  display: flex; align-items: center; gap: 6px; margin-top: 2px; padding-left: 13px;
  font-family: var(--mono); font-size: 9.5px; color: var(--faint);
}
.act-item .cdot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: #9aa5b2; }
.act-item .cdot.ok { background: #1f9d5f; }
.act-item .cdot.err { background: #d4453a; }
.act-item .cdot.run { background: var(--accent); animation: pulse 1.1s ease-in-out infinite; }
.act-item .sq { font-family: var(--mono); font-size: 10px; color: var(--faint); font-weight: 650; }
.act-item .tg { font-size: 11px; font-weight: 600; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-item.sel .tg { color: var(--accent-3); }
.act-item .badge { height: 15px; font-size: 9px; padding: 0 4px; }
.act-item .pin { color: var(--accent); font-size: 8px; line-height: 1; margin-left: 3px; }
.act-multi { height: 16px; font-size: 9.5px; padding: 0 5px; }

.act-none { padding: 16px 10px; font-size: 11px; color: var(--faint); text-align: center; line-height: 1.5; }

.act-pane {
  background: #fbfcfd; padding: 0; max-height: 260px; overflow-y: auto;
  scroll-behavior: auto;
}
#resActivity .act-pane { max-height: 330px; }

.act-sec { border-bottom: 1px solid var(--line); }
.act-sec:last-child { border-bottom: 0; }
.act-h {
  position: sticky; top: 0; z-index: 1;
  padding: 5px 12px; font-size: 9.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; color: var(--faint);
  background: var(--surface-3); border-bottom: 1px solid var(--line);
}
.act-r .act-txt { color: var(--faint); font-style: italic; }
.act-txt {
  margin: 0; padding: 10px 12px;
  font-family: var(--mono); font-size: 11px; line-height: 1.6;
  color: var(--ink-2); white-space: pre-wrap; word-break: break-word;
}

/* ========================================================= empty states === */

.empty {
  padding: 40px 24px; text-align: center; color: var(--muted);
}
.empty .ic {
  width: 40px; height: 40px; margin: 0 auto 12px; border-radius: 11px;
  background: var(--surface-3); border: 1px solid var(--line);
  display: grid; place-items: center; color: var(--faint);
}
.empty .ic svg { width: 19px; height: 19px; }
.empty .t { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.empty .s { font-size: 12px; color: var(--faint); margin-top: 4px; max-width: 380px; margin-left: auto; margin-right: auto; line-height: 1.55; }
.empty .act { margin-top: 14px; }
.empty.sm { padding: 26px 18px; }

.loading { padding: 32px; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); font-size: 12px; }

/* ============================================================= modals ===== */

.modal {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(19, 27, 38, .45);
  display: flex; align-items: center; justify-content: center;
  padding: 40px 24px;
  animation: fade .13s ease;
}
@keyframes fade { from { opacity: 0; } }

.modal-card {
  background: var(--surface); border-radius: var(--r-l);
  box-shadow: var(--sh-3); width: 100%; max-width: 660px;
  max-height: 100%; display: flex; flex-direction: column; overflow: hidden;
  animation: rise .16s cubic-bezier(.2, .8, .3, 1);
}
@keyframes rise { from { transform: translateY(8px) scale(.99); opacity: 0; } }
.modal-card.wide { max-width: 860px; }

.modal-hd {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
}
.modal-hd h3 { font-size: 14px; font-weight: 620; }
.modal-bd { padding: 14px 16px; overflow-y: auto; flex: 1 1 auto; }
.modal-bd.flush { padding: 0; }
.modal-ft {
  padding: 12px 16px; border-top: 1px solid var(--line);
  background: var(--surface-2); display: flex; align-items: center; gap: 10px;
}

.crow {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 16px; border-bottom: 1px solid var(--line); cursor: pointer;
  font-size: 12px;
}
.crow:hover { background: var(--surface-2); }
.crow input { width: 14px; height: 14px; accent-color: var(--accent); flex: none; cursor: pointer; }
.crow .nm { font-family: var(--mono); font-size: 11.5px; color: var(--ink-2); }
.crow .mt { margin-left: auto; font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; display: flex; gap: 14px; flex: none; }
.crow.on { background: var(--accent-soft); }
.crow.on .nm { color: var(--accent-3); font-weight: 600; }

.jrow {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px; border-bottom: 1px solid var(--line); font-size: 12px;
}
.jrow:hover { background: var(--surface-2); }
.jrow .nm { font-family: var(--mono); font-size: 11.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============================================================ lightbox ==== */

.lb {
  position: fixed; inset: 0; z-index: 120;
  background: rgba(14, 20, 29, .88);
  display: flex; flex-direction: column;
  animation: fade .13s ease;
}
.lb-hd {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px; color: #e6ebf1; flex: none;
}
.lb-hd .t { font-family: var(--mono); font-size: 12.5px; font-weight: 600; }
.lb-hd .s { font-size: 11.5px; color: #93a1b3; }
.lb-body { flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 0 18px 18px; gap: 14px; }
.lb-body img {
  max-width: 100%; max-height: 100%; object-fit: contain;
  border-radius: var(--r-s); background: #fff; box-shadow: 0 20px 60px -20px rgba(0, 0, 0, .7);
}
.lb-msg {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 20px; border-radius: var(--r-m);
  background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .16);
  color: #dfe6ee; font-size: 12.5px; max-width: 460px; text-align: center;
}
.lb-msg.err { background: rgba(212, 69, 58, .16); border-color: rgba(212, 69, 58, .5); color: #ffd9d5; }

.lb-nav {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  border: 1px solid rgba(255, 255, 255, .2); background: rgba(255, 255, 255, .08);
  color: #fff; cursor: pointer; display: grid; place-items: center;
  transition: background .12s;
}
.lb-nav:hover { background: rgba(255, 255, 255, .18); }
.lb-nav[disabled] { opacity: .25; cursor: not-allowed; }
.lb-nav svg { width: 16px; height: 16px; }
.lb-x {
  margin-left: auto; width: 30px; height: 30px; border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, .2); background: rgba(255, 255, 255, .08);
  color: #fff; cursor: pointer; display: grid; place-items: center;
}
.lb-x:hover { background: rgba(255, 255, 255, .18); }
.lb-x svg { width: 13px; height: 13px; }

/* ============================================================== toasts ==== */

#toasts {
  position: fixed; right: 20px; bottom: 20px; z-index: 200;
  display: flex; flex-direction: column; gap: 9px; align-items: flex-end;
  pointer-events: none;
}
.toast {
  display: flex; align-items: flex-start; gap: 9px;
  min-width: 260px; max-width: 400px;
  padding: 11px 13px; border-radius: var(--r-m);
  background: var(--surface); border: 1px solid var(--line-2);
  box-shadow: var(--sh-3); font-size: 12px; color: var(--ink-2);
  pointer-events: auto;
  animation: toastin .2s cubic-bezier(.2, .8, .3, 1);
  border-left: 3px solid var(--faint);
}
@keyframes toastin { from { transform: translateX(14px); opacity: 0; } }
.toast.err { border-left-color: #d4453a; }
.toast.ok { border-left-color: #1f9d5f; }
.toast.info { border-left-color: var(--accent); }
.toast.warn { border-left-color: #d99114; }
.toast .ta { margin-top: 8px; }
.toast .tt { font-weight: 620; color: var(--ink); }
.toast .tm { color: var(--muted); line-height: 1.5; word-break: break-word; }
.toast .x { margin-left: auto; }

/* ========================================================== responsive ==== */

@media (max-width: 1420px) {
  .pane { max-width: 100%; }
}
@media (max-width: 1180px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .results { grid-template-columns: minmax(0, 1fr); }
  .filelist { position: static; }
  .fl-body { max-height: 220px; }
}

/* ======================================================== job actions ===== */

.job-acts { display: flex; gap: 6px; margin-top: 9px; flex-wrap: wrap; align-items: center; }

/* ======================================================== batch notes ===== */

.batch-note {
  flex-basis: 100%;
  padding: 8px 12px; border-radius: var(--r-s);
  background: var(--warn-bg); border: 1px solid var(--warn-line);
  color: var(--warn); font-size: 12px; font-weight: 550; line-height: 1.5;
}
.batch-warn {
  flex-basis: 100%;
  padding: 8px 12px; border-radius: var(--r-s);
  background: var(--warn-bg); border: 1px solid var(--warn-line);
  color: var(--warn); font-size: 11.5px; line-height: 1.5;
}
.batch-warn div { margin: 1px 0; }
.bar-foot {
  flex-basis: 100%; order: 99;
  margin-top: 2px; font-size: 10.5px; color: var(--faint);
  letter-spacing: .01em;
}
.bar-foot .mono { color: var(--faint); }

/* earlier sign-offs, directly under the one in force: one line until an auditor opens it */
.so-hist { flex-basis: 100%; }
.so-hist-t {
  display: flex; align-items: center; gap: 6px;
  padding: 3px 0; border: 0; background: none; cursor: pointer; font: inherit;
  font-size: 11.5px; font-weight: 550; color: var(--ink-2);
}
.so-hist-t:hover { color: var(--accent); }
.so-hist-t .chev { display: grid; place-items: center; color: var(--faint); transition: transform .16s ease; }
.so-hist-t .chev svg { width: 11px; height: 11px; display: block; }
.so-hist.open .so-hist-t .chev { transform: rotate(90deg); color: var(--accent); }
.so-hist-s { color: var(--faint); font-weight: 500; font-size: 10.5px; }
.so-hist-l {
  list-style: none; margin: 3px 0 2px; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: var(--r-s); background: var(--surface-2);
}
.so-hist-l li + li { margin-top: 9px; padding-top: 9px; border-top: 1px solid var(--line); }
.so-hist-h { font-size: 11.5px; color: var(--ink-2); line-height: 1.55; }
.so-hist-h b { font-weight: 620; color: var(--ink); }
.so-hist-h .mono { font-size: 10.5px; color: var(--faint); }
.so-hist-h.rev { color: var(--err); margin-top: 3px; }
.so-hist-h.rev b { color: var(--err); }
.so-hist-n { font-size: 11px; line-height: 1.55; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }

/* ==================================================== report agreement ===== */

.agree {
  padding: 7px 13px; border-top: 1px solid var(--line);
  font-size: 11.5px; color: var(--muted);
}
.agree::before { content: "↔ "; color: var(--faint); }

details.tech-det { border-top: 0; margin-top: 0; }
details.tech-det > summary {
  padding: 6px 13px; cursor: pointer; font-size: 11px; color: var(--muted);
  font-weight: 550; list-style: none; user-select: none;
}
details.tech-det > summary::-webkit-details-marker { display: none; }
details.tech-det > summary::before { content: "▸ "; color: var(--faint); }
details.tech-det[open] > summary::before { content: "▾ "; }
details.tech-det > summary:hover { color: var(--ink-2); }

/* ================================================= inline field edit ===== */

.fval { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.fval .val { min-width: 0; overflow-wrap: anywhere; }
.fedit { height: 20px; padding: 0 6px; font-size: 10px; }
.fval-edit { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.fval-edit .inp { width: auto; min-width: 130px; height: 26px; font-size: 11.5px; padding: 0 8px; }

/* ==================================== recorded feedback + output edits ===== */

/* the reason row: four chips and a note, on one line under whatever is being changed */
.why {
  display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
  flex-basis: 100%; width: 100%; margin-top: 7px;
}
.why-q {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--faint);
}
.why-q i {
  font-style: normal; font-weight: 500; text-transform: none; letter-spacing: 0;
  margin-left: 4px; opacity: .85;
}
.why-chip {
  height: 22px; padding: 0 9px; border-radius: 999px; cursor: pointer; font: inherit;
  font-size: 11px; line-height: 1; white-space: nowrap;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2);
}
.why-chip:hover { border-color: var(--accent-soft-2); background: var(--accent-soft); color: var(--accent); }
.why-chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.why-note {
  width: auto; min-width: 140px; flex: 1 1 140px; height: 24px; font-size: 11.5px; padding: 0 8px;
}
.badge.why { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-soft-2); }
.btn.danger.solid { background: var(--err); border-color: var(--err); color: #fff; }
.btn.danger.solid:hover { background: var(--err); border-color: var(--err); color: #fff; filter: brightness(1.08); }
.tbl tr.why-tr > td { padding: 0 10px 10px; background: var(--surface-2); }
.why-tr .why { margin-top: 0; }
.why-tr .why-note { max-width: 320px; }

/* add / remove an invoice or a goods line */
.ent-acts { display: flex; gap: 6px; margin-left: 6px; }
.row-acts { display: flex; justify-content: flex-end; padding: 0 0 8px; }
.sec-h .grow { flex: 1 1 auto; }
.sec-h.acts { border-bottom: 1px solid var(--line); padding-bottom: 9px; }
.sec-h.acts::after { display: none; }

.ed-note { font-size: 12.5px; color: var(--ink-2); line-height: 1.55; margin-bottom: 12px; }
.ed-note.bad { color: var(--err); }
.ed-note b { font-family: var(--mono); }
#edBody .kv { margin-bottom: 2px; }

/* the correction log */
.fb-bar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 10px 18px; border-bottom: 1px solid var(--line); background: var(--surface-2);
}
.fb-f { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); }
.fb-f .inp { width: auto; height: 26px; font-size: 11.5px; padding: 0 6px; }
.fb-loading { padding: 26px; text-align: center; color: var(--muted); font-size: 12.5px; }
.fb-loading.bad { color: var(--err); }
/* Seven columns of log have to fit a 1280-wide screen, and the reason is the whole point of the
   log, so it is the column that must not be squeezed. The panel takes the width the viewport
   actually offers, the mono value columns are capped so they cannot crowd the rest out, the
   reason column only has to hold its chip on one line — and the note, which runs to 500
   characters, drops to a full-width row underneath, the way `why-tr` already does. */
#fbModal .modal-card { max-width: 1180px; }
.fb-v {
  font-family: var(--mono); font-size: 11px; overflow-wrap: anywhere;
  min-width: 96px; max-width: 168px;
}
.fb-where { min-width: 130px; }
.fb-reason { min-width: 116px; }
.tbl tr.fb-noted > td { border-bottom: 0; }             /* the note row below closes the block */
.tbl tr.fb-note-tr > td { padding: 0 9px 9px; background: var(--surface-2); }
.tbl tbody tr.fb-note-tr:hover > td { background: var(--surface-2); }
.fb-note { font-size: 11px; line-height: 1.55; color: var(--muted); overflow-wrap: anywhere; }
.fb-note b {
  font-size: 9.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--faint); margin-right: 7px;
}
#fbBody { max-height: 62vh; overflow: auto; }

/* ============================================================== print ===== */

@media print {
  .hdr, .rail, .pane-head, #resTabs, #batchBar, .filelist, #resActivity,
  #toasts, #lightbox, .modal, .toolbar, .btn, .x-btn, .fedit, .fval-edit,
  .why, .ent-acts, .row-acts {
    display: none !important;
  }
  html, body { height: auto; background: #fff !important; }
  body { font-size: 11px; }
  .shell { display: block; height: auto; }
  .stage { overflow: visible; padding: 0; }
  .pane { max-width: 100%; gap: 10px; }
  .results { display: block; }
  .rescol { display: block; }
  .card { box-shadow: none; border: 1px solid #ccc; page-break-inside: avoid; }
  .card-bd { padding: 8px; }
  table.tbl { font-size: 9.5px; }
  table.tbl th, table.tbl td { padding: 4px 6px; }
  .val, .mono { font-size: 9.5px; }
  .pglink { background: #eee; color: #333; }
}

/* ============================================================== auth ===== */

.auth-view {
  position: fixed; inset: 0; z-index: 150;
  background: var(--ground);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.auth-card {
  width: 100%; max-width: 380px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-l); box-shadow: var(--sh-2);
  padding: 28px 26px 24px;
}
.auth-logo {
  width: 40px; height: 40px; border-radius: 11px;
  background: linear-gradient(150deg, var(--accent) 8%, var(--accent-3) 100%);
  display: grid; place-items: center; color: #fff;
  box-shadow: 0 2px 8px rgba(7, 60, 55, .3);
  margin-bottom: 16px;
}
.auth-logo svg { width: 21px; height: 21px; display: block; }
.auth-title { font-size: 18px; letter-spacing: -.02em; }
.auth-sub { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.5; }
.auth-form { margin-top: 18px; }
.auth-form .btn { margin-top: 16px; }
.auth-err {
  margin-top: 12px; padding: 9px 11px; border-radius: var(--r-s);
  background: var(--err-bg); border: 1px solid var(--err-line);
  color: var(--err); font-size: 12px; line-height: 1.5;
}

/* =========================================================== user chip ==== */

.userchip {
  display: inline-flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 10px;
  border: 1px solid var(--line-2); border-radius: 999px;
  background: var(--surface-2);
}
.uc-mail {
  font-size: 12px; font-weight: 550; color: var(--ink-2);
  max-width: 210px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.userchip .badge { height: 16px; font-size: 9.5px; padding: 0 6px; }
.userchip .btn { height: 24px; }

/* ======================================================== user admin ===== */

.user-new { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.user-new .inp { flex: 1 1 170px; min-width: 150px; height: 34px; }
.user-new select.inp { padding: 0 8px; }
.user-new .btn { flex: none; height: 34px; }

/* ================================================ assisted fixes (review) ==== */

.tbl td.fixc { width: 88px; white-space: nowrap; text-align: right; }
.tbl tr.sug-tr > td { padding: 0 10px 10px; background: var(--surface-2); }

.sug-panel {
  border: 1px solid var(--accent-soft-2); border-left: 3px solid var(--accent);
  border-radius: var(--r-m); background: var(--surface);
  padding: 10px 12px; box-shadow: var(--sh-1);
}
.sug-panel.muted { border-color: var(--line-2); border-left-color: var(--faint); }
.sug-panel.bad { border-color: var(--err-line); border-left-color: var(--err); color: var(--err); }
.sug-panel.loading { color: var(--muted); font-size: 12px; font-style: italic; }

.sug-hd { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.sug-method {
  font-size: 10.5px; font-weight: 650; letter-spacing: .03em; text-transform: uppercase;
  color: var(--accent-2);
}
.sug-panel.muted .sug-method { color: var(--muted); }

.sug-main { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.sug-val {
  font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--ink);
  background: var(--accent-soft); border-radius: var(--r-s); padding: 3px 8px;
  word-break: break-all;
}
.sug-val.null { font-style: italic; font-weight: 500; color: var(--muted); background: var(--grey-bg); }
.sug-main .conf { margin: 0; padding: 0; border-top: 0; flex: 0 1 210px; min-width: 160px; }

.sug-ev {
  margin-top: 8px; padding: 6px 9px; border-radius: var(--r-s);
  background: var(--surface-3); border: 1px solid var(--line);
  font-family: var(--mono); font-size: 11px; color: var(--ink-2); line-height: 1.5;
}
.sug-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.sug-note { font-size: 11px; color: var(--muted); }
.sug-why { font-size: 12px; color: var(--ink-2); line-height: 1.55; }
.sug-acts { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

.sug-cands { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; }
.sug-cands-hd {
  font-size: 10.5px; font-weight: 650; letter-spacing: .03em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 6px;
}
.sug-cand {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 5px 8px; margin-bottom: 4px; text-align: left;
  border: 1px solid var(--line-2); border-radius: var(--r-s);
  background: var(--surface-2); cursor: pointer; font: inherit; font-size: 12px;
}
.sug-cand:hover { border-color: var(--accent); background: var(--accent-soft); }
.sug-cand .cv { font-family: var(--mono); font-weight: 650; color: var(--ink); }
.sug-cand .cl { color: var(--muted); flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sug-cand .cs { font-family: var(--mono); font-size: 11px; color: var(--accent-2); }
.chip.learned { background: var(--info-bg); color: var(--info); border-color: var(--info-line); }
.chip.ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-line); }

/* ==================================================== batch sign-off ======== */

.so-counts { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.so-counts .sev.zero { opacity: .45; }
.so-note { font-size: 12.5px; color: var(--ink-2); line-height: 1.6; margin-bottom: 12px; }
.so-force {
  display: flex; align-items: center; gap: 8px; margin-bottom: 12px;
  padding: 8px 10px; border-radius: var(--r-m);
  background: var(--warn-bg); border: 1px solid var(--warn-line);
  font-size: 12.5px; color: var(--warn); cursor: pointer;
}
.so-lbl { display: block; font-size: 11.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
.so-lbl .req { color: var(--err); font-weight: 500; }
#soBody textarea.inp { width: 100%; height: auto; padding: 8px 10px; line-height: 1.5; resize: vertical; }
