:root {
  --ink: #231f20;
  --crimson: #bc2249;
  --cyan: #00aeef;
  --bg: #f4f4f6;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Lato', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
}
header.site {
  background: #111;
  color: #fff;
  padding: 18px 28px;
  display: flex;
  align-items: baseline;
  gap: 14px;
}
header.site h1 {
  margin: 0;
  font-family: 'League Spartan', sans-serif;
  font-weight: 900;
  font-size: 26px;
  letter-spacing: .02em;
}
header.site h1 a { color: #fff; text-decoration: none; }
header.site .sub { color: var(--cyan); font-size: 14px; }
main { max-width: 980px; margin: 28px auto 60px; padding: 0 20px; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.card {
  background: #fff;
  border-radius: 12px;
  padding: 22px;
  box-shadow: 0 2px 10px rgba(0,0,0,.07);
  text-decoration: none;
  color: inherit;
  display: block;
  border-top: 6px solid var(--crimson);
}
.card h2 { margin: 0 0 6px; font-family: 'League Spartan', sans-serif; font-weight: 800; }
.card p { margin: 0; color: #555; font-size: 14px; line-height: 1.5; }

form .panel {
  background: #fff;
  border-radius: 12px;
  padding: 22px;
  box-shadow: 0 2px 10px rgba(0,0,0,.07);
  margin-bottom: 18px;
}
form h2 {
  font-family: 'League Spartan', sans-serif;
  font-weight: 800;
  font-size: 18px;
  margin: 0 0 14px;
}
label { display: block; font-weight: 700; font-size: 13px; margin: 12px 0 4px; }
input[type=text], input[type=url], input[type=number], textarea, select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font: inherit;
  background: #fff;
}
textarea { min-height: 110px; resize: vertical; }
.hint { font-size: 12px; color: #777; margin-top: 3px; }
.hint .count.over { color: var(--crimson); font-weight: 700; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.item {
  border: 1px solid #e2e2e6;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 14px;
  position: relative;
  background: #fafafc;
}
.item .item-head { display: flex; justify-content: space-between; align-items: center; }
.item .item-title { font-family: 'League Spartan', sans-serif; font-weight: 800; }
.item button.remove {
  background: none; border: none; color: var(--crimson);
  font-weight: 700; cursor: pointer; font-size: 13px;
}
.thumb { max-width: 160px; max-height: 100px; border-radius: 6px; display: none; margin-top: 8px; }
.thumb.show { display: block; }

button.primary, a.button {
  background: var(--crimson);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 12px 28px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button.primary:disabled { opacity: .5; cursor: default; }
button.add {
  background: #fff;
  color: var(--crimson);
  border: 2px dashed var(--crimson);
  border-radius: 10px;
  padding: 10px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
}
#status { margin-top: 18px; }
#status .note { background: #eef3ff; color: #1d3a6e; border-radius: 8px; padding: 10px 14px; margin: 0 0 10px; font-size: 14px; }
#status .warn {
  background: #fff6e6;
  border: 1px solid #eec97e;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 8px;
  font-size: 14px;
}
#status .err {
  background: #ffeaea;
  border: 1px solid #e59;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  white-space: pre-wrap;
}
#result embed { width: 100%; height: 640px; border-radius: 10px; margin-top: 14px; }
.spinner { color: #666; font-size: 14px; }

/* --- portal chrome (auth, magazines, admin) --- */
header.site .usernav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 14px;
}
header.site .usernav a { color: #fff; text-decoration: underline; }
header.site .usernav .who { color: #aaa; }
header.site .usernav button {
  background: none; border: 1px solid #555; color: #fff;
  border-radius: 999px; padding: 5px 14px; font: inherit; cursor: pointer;
}
header.site .usernav .badge {
  display: inline-block; margin-left: 6px; padding: 1px 7px;
  background: var(--crimson); color: #fff; border-radius: 999px;
  font-size: 12px; font-weight: 700;
}
.pagehead { font-family: 'League Spartan', sans-serif; font-weight: 900; margin: 0 0 16px; }
.pagehead-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.pagehead-row .pagehead, .pagehead-row h2 { margin: 0; }
.sechead {
  font-family: 'League Spartan', sans-serif; font-weight: 800;
  margin: 34px 0 12px; text-transform: uppercase; letter-spacing: .04em;
  font-size: 15px; color: #555;
}
.crumbs { font-size: 13px; color: #777; margin: 0 0 14px; }
.crumbs a { color: var(--crimson); text-decoration: none; }
.empty { color: #888; font-size: 14px; }

.login-box { max-width: 380px; margin: 60px auto; background: #fff; border-radius: 12px; padding: 26px; box-shadow: 0 2px 10px rgba(0,0,0,.07); }
.login-box h2 { font-family: 'League Spartan', sans-serif; font-weight: 800; margin: 0 0 10px; }
.login-box .primary { margin-top: 16px; width: 100%; }
.login-box .err { background: #ffeaea; border: 1px solid #e59; border-radius: 8px; padding: 9px 12px; font-size: 14px; margin-bottom: 8px; }

.column-panel { margin-bottom: 18px; }
.column-panel > .pagehead-row h2 { margin-bottom: 2px; }
.tpl-list { margin-top: 10px; }
.tpl {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  border: 1px solid #e2e2e6; border-radius: 10px; padding: 12px 16px;
  margin-bottom: 10px; background: #fafafc;
}
.tpl-info { display: flex; flex-direction: column; gap: 2px; }
.tpl-actions { display: flex; align-items: center; gap: 10px; }
a.button.small, .tpl-actions a.button { padding: 8px 18px; font-size: 14px; }
a.button.small { padding: 6px 14px; font-size: 13px; }

button.danger {
  background: none; border: 1px solid #d66; color: #c33;
  border-radius: 999px; padding: 6px 14px; font: inherit; font-size: 13px;
  font-weight: 700; cursor: pointer;
}

details.admin-panel { margin: 14px 0; }
details.admin-panel summary {
  cursor: pointer; font-weight: 700; color: var(--crimson); font-size: 14px;
  list-style: none;
}
details.admin-panel[open] summary { margin-bottom: 8px; }
details.admin-panel .inline-form {
  background: #fff; border: 1px solid #e2e2e6; border-radius: 10px;
  padding: 14px 16px; max-width: 520px;
}
details.admin-panel .inline-form .primary { margin-top: 12px; }
details.admin-panel.slim .inline-form { padding: 10px 12px; display: flex; gap: 8px; }
details.admin-panel.slim .inline-form .primary { margin-top: 0; padding: 8px 16px; }

.gen-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.gen-table th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
  color: #888; padding: 6px 10px; border-bottom: 2px solid #eee;
}
.gen-table td { padding: 9px 10px; border-bottom: 1px solid #f0f0f2; }
.status { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.s-done { background: #e2f6e6; color: #1c7a34; }
.s-error { background: #ffeaea; color: #c33; }
.s-pending, .s-rendering { background: #fff6e6; color: #9a6b00; }

/* --- issue builder --- */
button.mini {
  background: #fff; border: 1px solid #ccc; border-radius: 6px;
  padding: 4px 10px; font: inherit; font-size: 13px; cursor: pointer;
}
button.mini:disabled { opacity: .35; cursor: default; }
button.mini.add-mini { color: var(--crimson); border-color: var(--crimson); font-weight: 700; }
.okmsg {
  background: #e2f6e6; border: 1px solid #7ec98e; border-radius: 8px;
  padding: 10px 14px; font-size: 14px;
}
.ct-row td { color: #888; font-style: italic; }
.gen-table td form { display: inline; }

/* --- docx import panel --- */
.docx-panel { border-left: 6px solid var(--cyan); }
.docx-panel .primary { margin-top: 14px; }
.docx-or { margin-left: 12px; }

/* --- pipeline --- */
main.wide { max-width: 1280px; }
.month-picker { display: flex; gap: 6px; align-items: center; }
.month-picker input[type=month] { padding: 6px 8px; border: 1px solid #ccc; border-radius: 8px; font: inherit; }
a.button.ghost { background: #fff; color: var(--ink); border: 1px solid #ccc; }
.tabs { display: flex; gap: 4px; margin: 0 0 14px; border-bottom: 2px solid #e4e4e8; }
.tabs a { padding: 8px 16px; text-decoration: none; color: #555; font-weight: 700; border-radius: 8px 8px 0 0; }
.tabs a.on { background: #fff; color: var(--crimson); box-shadow: 0 -2px 0 var(--crimson) inset; }
.warn-banner { background: #fff6e6; color: #7a5500; border-radius: 8px; padding: 10px 14px; margin: 0 0 12px; font-size: 14px; }
.pipe-summary { font-size: 13px; margin: 0 0 12px; }
.stage-chip { font-size: 11px; font-weight: 800; letter-spacing: .03em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 6px; background: #eee; color: #444; white-space: nowrap; }
.st-signal { background: #efe7ff; color: #5b2bb5; }
.st-gladiator { background: #e3f3ff; color: #0a5d8f; }
.st-skylops { background: #fff0e0; color: #9a4f00; }
.st-magd { background: #fde6ee; color: var(--crimson); }
.st-done { background: #e2f6e6; color: #1c7a34; }
.st-none { background: #f0f0f2; color: #888; }
.s-idle { background: #f0f0f2; color: #777; }
.pipe-table td { vertical-align: top; }
.pipe-table .col-name { font-weight: 700; white-space: nowrap; }
.pipe-table .col-title { max-width: 360px; }
.pipe-table .row-detail { max-width: 320px; margin-top: 4px; }
.pipe-table .row-actions { text-align: right; white-space: nowrap; }
.pipe-table tr.tone-idle td { color: #999; }
.cover-tag { font-size: 10px; font-weight: 800; text-transform: uppercase; color: var(--crimson); }
button.primary.small { padding: 6px 14px; font-size: 13px; }
.pipe-dialog { width: min(900px, 94vw); max-height: 92vh; border: none; border-radius: 14px; padding: 22px 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.pipe-dialog::backdrop { background: rgba(0,0,0,.45); }
.card-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.card-head h3 { margin: 2px 0 6px; font-family: 'League Spartan', sans-serif; font-weight: 800; font-size: 20px; }
.card-head .hint { margin: 0; }
.card-detail { font-size: 14px; color: #444; }
.card-sec { border-top: 1px solid #eee; padding-top: 12px; margin-top: 14px; }
.card-sec h4 { margin: 0 0 8px; font-size: 15px; }
.card-sec .deck { font-style: italic; margin: 0 0 6px; }
.card-sec textarea, .card-sec input[type=text] { width: 100%; padding: 8px 10px; border: 1px solid #ccc;
  border-radius: 8px; font: inherit; font-size: 14px; }
label.radio { font-weight: 400; display: flex; gap: 8px; align-items: baseline; margin: 6px 0; }
.act-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
form.act.inline { display: inline; }
iframe.preview { width: 100%; height: 420px; border: 1px solid #e4e4e8; border-radius: 8px; background: #fff; margin: 8px 0; }
details.lint { font-size: 13px; margin: 6px 0; }
.card-links { font-size: 13px; margin-top: 16px; }
.err { background: #ffeaea; color: #b22; border-radius: 8px; padding: 8px 12px; font-size: 14px; margin: 8px 0; }
.ok { background: #e2f6e6; color: #1c7a34; border-radius: 8px; padding: 8px 12px; font-size: 14px; margin: 8px 0; }
main.wide .panel { background: #fff; border-radius: 12px; padding: 6px 12px; box-shadow: 0 2px 10px rgba(0,0,0,.07); }


/* ---- review page + autobuild panel ---- */
.review-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: start; }
@media (max-width: 960px) { .review-grid { grid-template-columns: 1fr; } }
.review-pdf iframe { width: 100%; height: 78vh; border: 0; border-radius: 6px; background: #eee; }
.review-map { margin-top: 10px; }
.comment-list { list-style: none; margin: 14px 0 0; padding: 0; }
.comment-list li { padding: 10px 0; border-top: 1px solid #e6e8ee; }
.comment-list li b { margin-right: 6px; }
.build-log { margin: 6px 0 0; padding-left: 18px; font-size: 13px; }
.build-log li { margin-bottom: 4px; }
.build-panel .sechead { margin-bottom: 4px; }
.button.ghost { background: transparent; border: 1px solid currentColor; }
