:root {
  --paper: #f7f9fa; --surface: #ffffff; --ink: #1b2634; --muted: #5c6b7c;
  --line: #d9e1e8; --accent: #1f5c8f; --accent-soft: #e3edf5;
  --pain: #a83a30; --good: #2e7d4f;
  --mono: Consolas, "IBM Plex Mono", monospace;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink);
  font: 15px/1.5 system-ui, "Segoe UI", sans-serif; }
main { max-width: 1900px; margin: 0 auto; padding: 12px 18px 50px; }

.topbar { display: flex; justify-content: space-between; align-items: center;
  padding: 10px 22px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { color: var(--ink); font-weight: 600; text-decoration: none; }
.lot { font-family: var(--mono); font-size: 11px; color: var(--muted);
  border: 1px solid var(--line); border-radius: 99px; padding: 2px 9px; }

h1 { font-size: 21px; margin: 8px 0; } h2 { font-size: 18px; }
h3 { font-size: 14px; margin: 0 0 8px; display: flex; gap: 8px; align-items: baseline; }
.muted { color: var(--muted); font-weight: 400; font-size: 12.5px; }
.hint { color: var(--muted); margin: 0 0 14px; }
.narrow { max-width: 560px; }
.rowhead { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; align-items: center; }

.btn { background: var(--accent); color: #fff; border: 1px solid var(--accent);
  border-radius: 5px; padding: 6px 14px; font-size: 13.5px; cursor: pointer;
  text-decoration: none; display: inline-block; }
.btn.small { padding: 3px 9px; font-size: 12px; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.danger { background: transparent; color: var(--pain); border-color: var(--line); }
.btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }

.state { font-family: var(--mono); font-size: 11px; border-radius: 99px;
  padding: 2px 9px; border: 1px solid var(--line); }
.state-confirmed { background: #e6f2ea; color: var(--good); }
.state-parsed { background: var(--accent-soft); color: var(--accent); }

.conf { font-family: var(--mono); font-size: 10.5px; border-radius: 99px; padding: 1px 8px; }
.conf-style { background: #e6f2ea; color: var(--good); }
.conf-marker { background: var(--accent-soft); color: var(--accent); }
.conf-position { background: #f7ecd8; color: #8a6116; }
.conf-human { background: var(--ink); color: #fff; }

.workbench { display: grid; grid-template-columns: 1.25fr 1fr; gap: 18px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  padding: 14px 16px; margin-bottom: 16px; }
.panellabel { margin-top: 0; }

textarea, input[type=text], input:not([type]), select {
  width: 100%; border: 1px solid var(--line); border-radius: 5px; padding: 6px 8px;
  font: inherit; background: var(--paper); }
textarea:focus, input:focus, select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
form.stack label { display: block; margin-bottom: 14px; font-weight: 600; }
form.stack select, form.stack input { margin-top: 6px; font-weight: 400; }
#fields form { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
#fields textarea { width: 100%; }

table.list, table.people { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.list td, table.list th, table.people td, table.people th {
  padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
td.grow { width: 60%; }
table.people input { font-size: 13px; padding: 4px 6px; }
.rowbtns { white-space: nowrap; }
.affpick label { display: inline-flex; align-items: center; gap: 2px; margin-right: 7px;
  font-family: var(--mono); font-size: 11.5px; }
.rawline td { border-bottom: 1px dashed var(--line); font-size: 12px; }
.rawblock li, ul.events li { font-size: 12px; color: var(--muted); }

.paras { margin: 0; padding-left: 20px; max-height: 480px; overflow-y: auto; }
.paras li { margin-bottom: 8px; font-size: 12.5px; }
.paras .assign { display: flex; gap: 6px; margin-top: 3px; }
.paras select { width: auto; font-size: 12px; padding: 2px 4px; }
.checks { padding-left: 18px; } .checks li { margin-bottom: 4px; }
.warnings { padding-left: 18px; color: var(--pain); font-size: 12.5px; }
ul.events { padding-left: 18px; max-height: 160px; overflow-y: auto; margin: 0; }

.preview-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 18px; align-items: start; }
.titlepage .tp-title { font-size: 20px; line-height: 1.3; margin: 6px 0 10px; }
.tp-authors { font-size: 14px; } .tp-affs { font-size: 12.5px; color: var(--muted); }
.tp-abstract { font-size: 13.5px; } .tp-keywords { font-size: 13px; }
pre.record { font-family: var(--mono); font-size: 12px; background: var(--paper);
  border: 1px solid var(--line); border-radius: 6px; padding: 12px;
  max-height: 520px; overflow: auto; white-space: pre-wrap; }
.bodyhtml { max-height: 600px; overflow-y: auto; border: 1px solid var(--line);
  border-radius: 6px; padding: 10px 18px; background: var(--surface); }
.bodyhtml img { max-width: 100%; }

/* ---------- stepped flow ---------- */
.stepper { display: flex; gap: 6px; flex-wrap: wrap; margin: 2px 0 12px; }
.stepitem { display: inline-flex; gap: 7px; align-items: center; text-decoration: none;
  color: var(--muted); background: var(--surface); border: 1px solid var(--line);
  border-radius: 99px; padding: 5px 13px; font-size: 13px; }
.stepitem b { font-family: var(--mono); font-size: 11.5px; color: var(--accent); }
.stepitem.current { border-color: var(--accent); color: var(--ink);
  box-shadow: inset 0 -2px 0 var(--accent); }
.stepitem.final b { color: var(--good); }
.steppage .panel h3 { margin-bottom: 10px; }
.stepnav { display: flex; gap: 10px; justify-content: flex-end; margin: 6px 0 0; }
.catgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; }
.catgrid label { font-weight: 600; font-size: 13px; display: block; }
.catgrid select, .catgrid input { margin-top: 4px; font-weight: 400; }
.corrflag { display: flex; flex-direction: column; gap: 8px; }
.corrflag .corr { font-weight: 600; color: var(--ink); font-size: 13px; }
.declgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; }
.declgrid label { font-weight: 600; font-size: 13px; }
.declgrid textarea { margin-top: 4px; font-weight: 400; font-size: 13px; }

/* ---------- the original panel ---------- */
/* Sticky beside the fields: spans exactly one viewport when pinned, so its top and
   bottom stay aligned with the visible stretch of the fields column. */
.workbench aside.side { position: sticky; top: 13px; align-self: start;
  height: calc(100vh - 26px); display: flex; }
aside.side .origpanel { display: flex; flex-direction: column; flex: 1;
  min-height: 0; margin-bottom: 0; }
aside.side .origpanel .origscroll { flex: 1; min-height: 0; max-height: none; }
.origpanel .origscroll { max-height: 60vh; overflow-y: auto;
  border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px;
  background: var(--surface); }
.orig { font-size: 12.5px; margin: 0 0 7px; color: var(--muted); }
.orig[class*=" r-"] { color: var(--ink); border-radius: 4px; padding: 2px 6px; }
.r-title { background: #dcebf7; }
.r-authorline { background: #ece3f6; }
.r-affiliation { background: #f3eef9; }
.r-abstract { background: #e2f1e8; }
.r-keywords { background: #fdf3d7; }
.r-statement { background: #f7e9e7; }
.r-legend { background: #dff2f0; }
.r-reference { background: #eceff2; }
.origgap { text-align: center; color: var(--muted); font-size: 16px; letter-spacing: 4px;
  margin: 10px 0; user-select: none; }
.origlegend { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.olg { font-family: var(--mono); font-size: 10.5px; border-radius: 99px; padding: 1px 8px;
  color: var(--ink); }

/* ---------- author matrix (3 columns: authors / affiliations / source) ---------- */
.workbench3 { display: grid; grid-template-columns: 1.05fr 0.95fr 0.95fr; gap: 14px;
  align-items: start; margin-bottom: 10px; --wb3h: calc(100vh - 190px); }
.workbench3 #matrix { display: contents; }
/* Three independent lifts: each column scrolls on its own. */
.workbench3 .matrix-col { height: var(--wb3h); overflow-y: auto; padding-right: 4px; }
.workbench3 .matrix-col > .colhead { position: sticky; top: 0; z-index: 2;
  background: var(--paper); margin: 0; padding: 2px 0 6px; }
.workbench3 aside.side { height: var(--wb3h); display: flex; flex-direction: column; }
.workbench3 aside.side .colhead { margin: 0 0 6px; }
.cardrow { display: flex; gap: 7px; align-items: stretch; }
.authmain { flex: 1; min-width: 0; }
.vrail { display: flex; flex-direction: column; align-items: center; flex: 0 0 20px; }
.arrow { border: 0; background: transparent; color: var(--muted); cursor: pointer;
  font-size: 8px; line-height: 1.3; padding: 1px 2px; }
.arrow:hover { color: var(--accent); }
.aline { display: flex; gap: 6px; align-items: center; margin-bottom: 4px; }
.w-title { flex: 0 0 110px; }
.w-given { flex: 1 1 auto; }
.w-family { flex: 1 1 auto; font-weight: 600; }
.afflist { display: flex; flex-direction: column; gap: 3px; margin: 5px 0 4px; }
.affline { display: flex; gap: 6px; align-items: center; font-size: 12px;
  color: var(--accent); background: var(--accent-soft); border-radius: 5px; padding: 2px 7px; }
.affline b { font-family: var(--mono); font-size: 11px; }
.affline .afftxt { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; }
.workbench3 .matrix-col, .workbench3 aside.side { min-width: 0; }
select.addaff { width: 100%; font-size: 12px; padding: 3px 5px; color: var(--muted); }
.aline.actions { justify-content: flex-end; margin: 4px 0 0; }
.credmore { flex: 1; }
.credmore summary { list-style: none; display: inline-block; cursor: pointer; }
.credmore summary::-webkit-details-marker { display: none; }
.affcard .cardline { align-items: stretch; }
.affbtns { display: flex; flex-direction: column; justify-content: center; gap: 3px;
  flex: 0 0 44px; }
.affbtns .ordno { text-align: center; }
.affmain { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
textarea.w-afftext { flex: 1 1 200px; font-size: 12px; resize: vertical;
  field-sizing: content; min-height: 30px; }
.colhead { font-size: 15px; margin: 0 0 6px; }
.ordno { cursor: grab; user-select: none; background: var(--chip-bg); border-radius: 4px;
  padding: 1px 5px; font-size: 11px; }
.affcard { background: var(--surface); border: 1px solid var(--line); border-radius: 7px;
  padding: 5px 10px; margin-bottom: 5px; }
.affcard.addcard { border-style: dashed; background: transparent; }
.w-marker { flex: 0 0 36px; } .w-afftext { flex: 1 1 240px; }
.sortable-ghost { opacity: .4; }
.authorcard { background: var(--surface); border: 1px solid var(--line); border-radius: 7px;
  padding: 6px 10px; margin-bottom: 6px; }
.authorcard.addcard { border-style: dashed; background: transparent; }
.cardline { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.workbench3 input, .workbench3 textarea, .workbench3 select { padding: 3px 6px; font-size: 12px; }
.workbench3 .btn.small { padding: 2px 8px; font-size: 11.5px; }
.workbench3 .authorcard { font-size: 12px; }
.btn.mini { padding: 1px 5px; font-size: 10.5px; width: 100%; }
.ordno { font-family: var(--mono); font-size: 12px; color: var(--muted); min-width: 18px; }
.w-given { flex: 1 1 110px; } .w-family { flex: 1 1 120px; }
.w-degrees { flex: 0 1 90px; } .w-orcid { flex: 0 1 185px; font-family: var(--mono); font-size: 12.5px; }
.corr { display: inline-flex; gap: 4px; align-items: center; font-size: 12.5px; color: var(--muted); }
.chips { margin-top: 4px; }
.chip { display: inline-flex; gap: 5px; align-items: center; background: var(--accent-soft);
  color: var(--accent); border-radius: 99px; padding: 1px 5px 1px 9px; font-size: 11.5px; }
.chips .cardmore { width: auto; margin: 0 0 0 auto; }
.chips .cardmore[open] { width: 100%; }
.chips .cardmore summary { cursor: pointer; font-size: 11.5px; }
.chip b { font-family: var(--mono); font-size: 11px; }
.chipx { border: 0; background: transparent; color: var(--pain); cursor: pointer;
  font-size: 13px; padding: 0 3px; }
.chip.addchip { background: transparent; border: 1px dashed var(--line); color: var(--muted); }
.chipselect { width: auto; font-size: 12px; padding: 2px 4px; background: transparent; border: 0; }
.creditgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 3px 12px; margin: 6px 0; }
.creditgrid label { display: flex; gap: 6px; align-items: center; font-size: 12px; }

/* ---------- step 3 / 5 / final ---------- */
.bodypage { max-width: 1560px; }
.statsbar { display: flex; gap: 26px; flex-wrap: wrap; font-size: 13.5px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 7px;
  padding: 8px 16px; margin-bottom: 12px; }
.integritybar { display: flex; flex-direction: column; gap: 3px; font-size: 12.5px;
  color: #8a6116; background: #fdf6e3; border: 1px solid #e6d5a8; border-radius: 7px;
  padding: 7px 14px; margin-bottom: 12px; }
/* Text takes 2/3; illustrations live in the right third at call level. */
.bodyview { font-size: 14.5px; line-height: 1.6; position: relative; padding-right: 34%; }
.bodyview h4 { font-size: 15px; margin: 18px 0 6px; }
.bodyview p { margin: 0 0 10px; }
.bodyill { position: absolute; right: 0; width: 31%; margin: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: 7px;
  padding: 8px 8px 6px; }
.bodyill .expand { position: absolute; top: 4px; right: 4px; z-index: 1;
  border: 1px solid var(--line); background: var(--paper); color: var(--muted);
  border-radius: 5px; cursor: pointer; font-size: 13px; padding: 1px 6px; }
.bodyill .expand:hover { color: var(--accent); border-color: var(--accent); }
#illmodal { border: 1px solid var(--line); border-radius: 10px; padding: 16px 20px;
  max-width: min(92vw, 1500px); }
#illmodal::backdrop { background: rgba(20, 30, 42, .55); }
#illmodal .modalhead { display: flex; justify-content: space-between; gap: 20px;
  align-items: center; margin-bottom: 10px; }
#illmodal img { max-width: 88vw; max-height: 78vh; display: block; }
#illmodal .minitab { font-size: 12.5px; }
#illmodal #illmodal-body { max-height: 78vh; overflow: auto; }
#illmodal #illmodal-caption { max-width: 80ch; }
.bodyill img { width: 100%; border-radius: 4px; display: block; }
.bodyill figcaption { font-size: 11.5px; color: var(--muted); margin-top: 6px;
  line-height: 1.4; }
.minitabwrap { max-height: 230px; overflow: auto; border-radius: 4px; }
.minitab { border-collapse: collapse; width: 100%; font-size: 10.5px; }
.minitab td { border: 1px solid var(--line); padding: 2px 5px; vertical-align: top; }
textarea.refs { font-family: var(--mono); font-size: 12px; }
.tp-decls { font-size: 12.5px; } .tp-decls dt { font-weight: 700; margin-top: 8px; }
.tp-decls dd { margin: 2px 0 0; color: var(--muted); }
.btn.send { background: var(--good); border-color: var(--good); font-size: 15px;
  padding: 9px 18px; margin-top: 12px; }
.btn.send[disabled] { opacity: .5; cursor: not-allowed; }
.state-submitted { background: #e6f2ea; color: var(--good); }
.sentbanner { background: #e6f2ea; color: var(--good); border: 1px solid var(--good);
  border-radius: 6px; padding: 10px 16px; margin-bottom: 16px; font-weight: 600; }
.missingbanner { background: #fdf0ef; color: var(--pain); border: 1px solid var(--pain);
  border-radius: 6px; padding: 10px 16px; margin-bottom: 16px; }

@media (max-width: 980px) {
  .workbench, .preview-grid, .declgrid, .catgrid, .workbench3 { grid-template-columns: 1fr; }
  .workbench3 aside.side, .workbench3 .matrix-col { height: auto; overflow: visible; }
}

/* ------------------------------- Lot 2: editorial ------------------------- */
.topnav { display: flex; gap: 14px; margin-left: 26px; flex: 1; }
.topnav a { color: inherit; text-decoration: none; opacity: .75; font-size: 13.5px; }
.topnav a:hover, .topnav a.here { opacity: 1; border-bottom: 2px solid var(--accent); }
.persona { font-size: 12.5px; display: flex; gap: 8px; align-items: center; }
.personagrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.personabtn { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; }
.deskgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 4px 0; border-bottom: 1px dashed var(--line, #e3e6ea); font-size: 13px; }
.timeline .tstamp { color: var(--muted); font-variant-numeric: tabular-nums; margin-right: 8px; }
.mailrow summary { cursor: pointer; }
.mailbody, .reporttext { white-space: pre-wrap; font-family: inherit; font-size: 13px;
  background: #f7f8fa; border-radius: 6px; padding: 8px 10px; margin: 6px 0; }
.reporttext.confidential { background: #fdf3f3; }
.reportlabel { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); margin: 10px 0 0; }
.reportlabel.confidential { color: #b04a4a; }
.reportcard { margin: 10px 0; }
.screenactions { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.inlineform { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.checklist { margin: 6px 0 2px; padding-left: 18px; font-size: 13px; }
.letterbox { width: 100%; font-family: inherit; font-size: 13.5px; line-height: 1.5;
  margin: 8px 0; box-sizing: border-box; }
.invitecard { border: 1px solid var(--line, #e3e6ea); border-radius: 8px; padding: 10px 12px; margin: 8px 0; }
.coilabel { display: flex; gap: 6px; align-items: center; font-size: 12.5px; max-width: 320px; }
.reviewform label { display: block; margin: 8px 0; font-size: 13px; }
.reviewform textarea, .reviewform select { width: 100%; box-sizing: border-box; }
.reflist { font-size: 13px; line-height: 1.5; }
.settingsform label { display: block; margin: 8px 0; font-size: 13px; }
.state-submitted { background: #fff3d6; }
.state-with_editor, .state-under_review { background: #e3edfb; }
.state-recommended, .state-ratified { background: #efe3fb; }
.state-awaiting_revision, .state-returned { background: #fdeadb; }
.state-accepted, .state-handed_off { background: #ddf3e1; }
.state-rejected, .state-declined, .state-withdrawn, .state-expired { background: #f3dede; }
.state-agreed, .state-invited { background: #e3edfb; }
@media (max-width: 1100px) { .deskgrid { grid-template-columns: 1fr; } }
