:root {
  --paper: #f6f3ec;
  --card: #fffdf8;
  --ink: #1e2330;
  --muted: #6b6f7b;
  --line: #e2dccf;
  --accent: #7b2d26;
  --accent-dark: #5f211c;
  --jim: #1f4e79;
  --imr: #2f6b4f;
  --warn: #a15c00;
  --ok-bg: #e8f1e6;
  --err-bg: #f8e3df;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.5 var(--sans);
}

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 20px; }
main.wrap { padding-top: 28px; padding-bottom: 80px; }

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

h1, h2, .brand { font-family: var(--serif); font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 1.9rem; line-height: 1.2; margin: 0 0 16px; }
h2 { font-size: 1.35rem; margin: 0; }
h3 { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0; }
h4 { font-size: 0.9rem; margin: 18px 0 6px; }

.muted { color: var(--muted); }
.hint { color: var(--muted); font-weight: 400; font-size: 0.85rem; }
code { background: #efe9dc; padding: 1px 5px; border-radius: 4px; font-size: 0.92em; }

/* top bar */
.top { background: var(--ink); color: #fff; }
.top-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 56px; flex-wrap: wrap; }
.brand { color: #fff; font-size: 1.35rem; }
.brand:hover { text-decoration: none; }
.top nav { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.top nav a, .top nav .link { color: #d9dbe3; font-size: 0.95rem; }
.top nav a:hover, .top nav .link:hover { color: #fff; }

/* cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 22px; margin-bottom: 20px; }
.card.narrow { max-width: 420px; margin: 8vh auto 0; }
.card.narrow.left { margin: 0; }
.card.narrow h1 { margin-bottom: 8px; }
.card.narrow h2 { margin: 18px 0 12px; }
.card.empty { text-align: center; color: var(--muted); padding: 40px 22px; }
.card.note { background: #fbf6e6; }
.table-card { padding: 0; overflow: hidden; }
body.bare { background: var(--ink); }

/* forms */
.stack > * + * { margin-top: 16px; }
label { display: block; font-weight: 600; font-size: 0.92rem; }
input[type=text], input[type=password], input[type=date], select, textarea {
  display: block; width: 100%; margin-top: 6px; padding: 10px 12px;
  font: inherit; color: var(--ink); background: #fff;
  border: 1px solid #cfc8b8; border-radius: 7px;
}
textarea { line-height: 1.45; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.row.three { grid-template-columns: repeat(3, 1fr); }
.row.four { grid-template-columns: repeat(4, 1fr); }
.form-wide { max-width: 820px; }
.actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.inline { display: inline; }

.btn {
  display: inline-block; padding: 9px 16px; border-radius: 7px; cursor: pointer;
  font: inherit; font-weight: 600; font-size: 0.93rem; line-height: 1.3;
  border: 1px solid #cfc8b8; background: #fff; color: var(--ink);
}
.btn:hover { background: #f3eee2; text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); }
.btn.small { padding: 5px 11px; font-size: 0.85rem; }
.btn.danger { color: var(--accent); border-color: #d9b3ae; }
.link { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; color: var(--accent); }
.link:hover { text-decoration: underline; }
.link.danger { color: #a33327; font-size: 0.85rem; }
.danger-zone { margin-top: 28px; }
.danger-zone.slim { margin-top: 14px; }

.confidential textarea { background: #fbf3ee; border-color: #dcbfb4; }

/* flash messages */
.flash { padding: 11px 15px; border-radius: 8px; margin: 0 0 18px; font-size: 0.95rem; }
.flash-ok { background: var(--ok-bg); border: 1px solid #c4d9c0; }
.flash-error { background: var(--err-bg); border: 1px solid #e6bdb5; }

/* dashboard */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.page-head h1 { margin: 0; }
.filters { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs a {
  padding: 6px 12px; border-radius: 999px; font-size: 0.9rem; font-weight: 600;
  color: var(--ink); background: #ebe5d7;
}
.tabs a:hover { text-decoration: none; background: #e0d9c8; }
.tabs a.on { background: var(--ink); color: #fff; }
.count { font-weight: 500; opacity: 0.7; margin-left: 2px; }

table.papers { width: 100%; border-collapse: collapse; }
.papers th {
  text-align: left; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--line); background: #faf7ef;
}
.papers td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
.papers tr:last-child td { border-bottom: 0; }
.papers .ms a { display: block; font-weight: 600; color: var(--ink); }
.papers .ms a:hover { color: var(--accent); }
.papers .ms .muted { font-size: 0.85rem; }
.papers .num { text-align: right; white-space: nowrap; }
.stale { color: var(--warn); font-weight: 600; }

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 5px; color: #fff;
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em; background: var(--muted);
}
.badge.j-jim { background: var(--jim); }
.badge.j-imr { background: var(--imr); }

.status {
  display: inline-block; padding: 2px 10px; border-radius: 999px; white-space: nowrap;
  font-size: 0.82rem; font-weight: 600; background: #ebe5d7; color: var(--ink);
}
.s-needs_decision { background: #f6d9a8; color: #5c3900; }
.s-with_reviewers { background: #d8e4f1; color: #173a5c; }
.s-with_authors { background: #e6dff0; color: #40286a; }
.s-accepted, .d-accept { background: #cfe6cb; color: #1d4a1a; }
.s-rejected, .d-reject { background: #f1cfc9; color: #6d1d14; }
.d-major { background: #f6d9a8; color: #5c3900; }
.d-minor { background: #e3ecc3; color: #3d4a10; }
.s-open, .d-none, .s-withdrawn { background: #ebe5d7; color: var(--muted); }

/* paper page */
.crumbs { font-size: 0.88rem; color: var(--muted); margin: 0 0 10px; }
.paper-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 18px; }
.paper-head h1 { margin: 4px 0 6px; }
.paper-head p { margin: 0; }
.kicker { font-size: 0.9rem; color: var(--muted); }
.paper-tools { display: flex; align-items: flex-end; gap: 10px; flex-shrink: 0; }
.status-form select { min-width: 190px; }
.next-round { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; font-size: 0.9rem; }

.round { scroll-margin-top: 16px; }
.round.flash-target { border-color: var(--accent); }
.round-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.round-head .dates { font-size: 0.88rem; margin-left: auto; }
.round-notes { background: #fbf6e6; border-radius: 7px; padding: 10px 14px; margin-bottom: 8px; font-size: 0.93rem; }
.sub-head { display: flex; align-items: center; justify-content: space-between; margin: 24px 0 10px; padding-top: 16px; border-top: 1px solid var(--line); }

details.fold > summary, details.review > summary { cursor: pointer; }
details.fold > summary { font-size: 0.9rem; font-weight: 600; color: var(--accent); }
details.fold[open] > summary { margin-bottom: 14px; }
details.review { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin-bottom: 8px; background: #fff; }
details.review > summary { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 0.93rem; }
details.review > summary::before { content: "▸"; color: var(--muted); }
details.review[open] > summary::before { content: "▾"; }
details.review > summary::-webkit-details-marker { display: none; }
details.review > summary { list-style: none; }
details.review .actions { margin-top: 16px; }

.longtext { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.95rem; }
.confidential-box { background: #fbf3ee; border-left: 3px solid var(--accent); padding: 4px 14px 12px; margin-top: 16px; border-radius: 0 7px 7px 0; }

.docs { list-style: none; margin: 0 0 14px; padding: 0; }
.docs li { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 0.93rem; }
.docs li a { font-weight: 600; }
.docs li .muted { font-size: 0.83rem; }
.docs li form { margin-left: auto; }
.doc-type { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); min-width: 110px; }

.upload { margin-top: 6px; }
.dropzone {
  display: block; text-align: center; padding: 22px 16px; cursor: pointer;
  border: 2px dashed #cfc8b8; border-radius: 9px; background: #faf7ef; font-weight: 600;
}
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone .hint { display: block; margin-top: 2px; }
.dropzone.over { border-color: var(--accent); background: #f6ebe4; }
.dropzone.has-files { border-style: solid; border-color: var(--imr); background: #eef5ee; }
.dropzone:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.paste { margin-top: 10px; }
.upload-row { grid-template-columns: 200px 1fr auto; align-items: end; margin-top: 12px; }

/* small screens */
@media (max-width: 720px) {
  h1 { font-size: 1.55rem; }
  .row, .row.three, .row.four, .upload-row { grid-template-columns: 1fr; }
  .paper-head { flex-direction: column; }
  .paper-tools { width: 100%; }
  .status-form { flex: 1; }
  .round-head .dates { margin-left: 0; width: 100%; }
  .doc-type { min-width: 0; }
  .docs li form { margin-left: 0; }

  table.papers thead { display: none; }
  table.papers, .papers tbody, .papers tr, .papers td { display: block; width: 100%; }
  .papers tr { padding: 12px 16px; border-bottom: 1px solid var(--line); }
  .papers tr:last-child { border-bottom: 0; }
  .papers td { padding: 2px 0; border: 0; display: inline-block; width: auto; margin-right: 10px; }
  .papers td.ms { display: block; margin: 6px 0; }
  .papers td.num { text-align: left; }
  .papers td[data-label=Reviews]::after { content: " reviews"; }
}
