/* ManuscriptFlow — design system */
:root {
  --font: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --serif: Garamond, "EB Garamond", Georgia, serif;
  --mono: "Cascadia Code", Consolas, "SFMono-Regular", monospace;
  --side: 260px;
  --r-xs: 6px; --r-sm: 9px; --r: 12px; --r-lg: 16px; --r-xl: 22px;
  --accent: #305B91; --accent-hover: #284D7C;   /* the one brand colour, same in light and dark */
  --grad: var(--accent);
  --grad-hover: var(--accent-hover);

  --bg: #F5F7FA;
  --bg-art: linear-gradient(transparent, transparent);
  --surface: #FFFFFF; --surface-2: #F8FAFC; --surface-3: #EEF2F7; --overlay: rgba(255, 255, 255, .86);
  --ink: #142033; --ink-2: #3A4A61; --muted: #66748A; --faint: #A0ABBC;
  --line: #E1E6EE; --line-2: #ECF0F5;
  --brand: #305B91; --brand-ink: #284D7C; --brand-soft: #E9EFF7; --brand-ring: rgba(48, 91, 145, .22);
  --ok: #305B91; --ok-soft: #E9EFF7; --warn: #A86300; --warn-soft: #FFF2DB; --warn-line: #F6DDAE;
  --err: #D23C44; --err-soft: #FDECED; --run: #305B91; --run-soft: #EEF2F7; --stale: #284D7C; --stale-soft: #E9EFF7;
  --shadow-sm: 0 1px 2px rgba(20, 32, 51, .06);
  --shadow: 0 1px 2px rgba(20, 32, 51, .04), 0 10px 30px -12px rgba(20, 32, 51, .12);
  --shadow-lg: 0 30px 70px -20px rgba(20, 32, 51, .35), 0 2px 6px rgba(20, 32, 51, .06);
  --paper: #FFFFFF; --paper-ink: #1E1E24; --paper-line: #E8E8EE;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0B111B;
  --bg-art: linear-gradient(transparent, transparent);
  --surface: #111A27; --surface-2: #152031; --surface-3: #1B283B; --overlay: rgba(17, 26, 39, .86);
  --ink: #E8EDF4; --ink-2: #B9C4D3; --muted: #8594A9; --faint: #566579;
  --line: #223147; --line-2: #1A2638;
  --brand: #7FA6D8; --brand-ink: #9DBBE3; --brand-soft: rgba(48, 91, 145, .28); --brand-ring: rgba(127, 166, 216, .3);
  --ok: #7FA6D8; --ok-soft: rgba(48, 91, 145, .28); --warn: #F2B354; --warn-soft: rgba(242, 179, 84, .13); --warn-line: rgba(242, 179, 84, .3);
  --err: #FF6B72; --err-soft: rgba(255, 107, 114, .13); --run: #7FA6D8; --run-soft: rgba(127, 166, 216, .12); --stale: #9DBBE3; --stale-soft: rgba(48, 91, 145, .28);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px -12px rgba(0, 0, 0, .6);
  --shadow-lg: 0 30px 80px -20px rgba(0, 0, 0, .8);
  --paper: #141D2B; --paper-ink: #E4E9F1; --paper-line: #25344A;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 14px/1.55 var(--font); color: var(--ink); background: var(--bg-art), var(--bg); background-attachment: fixed;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
a { color: var(--brand); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.015em; }
h1 { font-size: 28px; font-weight: 800; line-height: 1.15; letter-spacing: -.03em; }
h2 { font-size: 17px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
p { margin: 0 0 10px; }
code { font-family: var(--mono); font-size: 12px; background: var(--surface-3); padding: 1px 6px; border-radius: 5px; }
kbd { font: 600 11px var(--font); color: var(--muted); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; padding: 1px 6px; background: var(--surface); }
svg.i { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
::selection { background: var(--brand-ring); }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.grow { flex: 1; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ------------------------------------------------------------------ shell */
.app { display: flex; min-height: 100vh; }
.side { width: var(--side); flex: none; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px;
  padding: 18px 14px 14px; background: var(--overlay); backdrop-filter: blur(18px) saturate(1.4); border-right: 1px solid var(--line); z-index: 40; }
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 14px; color: var(--ink); }
.brand b { display: block; font-size: 16.5px; font-weight: 800; letter-spacing: -.02em; }
.brand span { display: block; font-size: 11.5px; color: var(--muted); font-weight: 500; margin-top: -1px; }
.brand .logo { flex: none; }
.brand.sm { padding: 0; gap: 8px; } .brand.sm b { font-size: 15px; }
.cta { margin: 2px 2px 10px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); padding: 14px 12px 6px; }
.nav a { position: relative; display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: var(--r-sm); color: var(--ink-2); font-weight: 600; transition: background .15s, color .15s; }
.nav a:hover { background: var(--surface-3); color: var(--ink); }
.nav a.on { background: var(--brand-soft); color: var(--brand-ink); }
.nav a.on::before { content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--grad); }
.nav a span { flex: 1; }
.nav-count { font-style: normal; font-size: 11.5px; font-weight: 700; min-width: 22px; text-align: center; padding: 1px 7px; border-radius: 20px; background: var(--surface-3); color: var(--muted); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding-top: 12px; border-top: 1px solid var(--line); }
.theme { display: flex; align-items: center; gap: 12px; font: 600 13.5px var(--font); color: var(--ink-2); background: none; border: 0; padding: 9px 12px; border-radius: var(--r-sm); cursor: pointer; text-align: left; }
.theme span { display: flex; align-items: center; gap: 12px; }
.theme:hover { background: var(--surface-3); color: var(--ink); }
.t-dark { display: none !important; }
:root[data-theme="dark"] .t-dark { display: flex !important; } :root[data-theme="dark"] .t-light { display: none !important; }
.ver { font-size: 11.5px; color: var(--faint); padding: 8px 12px 0; }
.main { flex: 1; min-width: 0; }
.mobile-top { display: none; }
.scrim { display: none; }
.page { max-width: 1320px; margin: 0 auto; padding: 12px 40px 120px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 26px; }
.ph-text .sub { color: var(--muted); margin-top: 6px; font-size: 14.5px; }
.eyebrow { font-size: 12.5px; font-weight: 700; color: var(--brand); letter-spacing: .02em; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.ph-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ------------------------------------------------------------------ controls */
.btn { font: 600 13.5px var(--font); display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px;
  border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; white-space: nowrap;
  transition: transform .12s, box-shadow .15s, background .15s, border-color .15s, color .15s; box-shadow: var(--shadow-sm); }
.btn:hover { border-color: var(--faint); }
.btn:active { transform: translateY(1px); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn.primary, .btn.grad { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 1px 2px rgba(20, 32, 51, .14); }
.btn.primary:hover, .btn.grad:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.soft { background: var(--brand-soft); color: var(--brand-ink); border-color: transparent; box-shadow: none; }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--ink); }
.btn.danger { color: var(--err); }
.btn.danger:hover { background: var(--err-soft); border-color: transparent; }
.btn.danger-solid { background: var(--err); color: #fff; border-color: var(--err); }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.btn .cnt { font-size: 11.5px; font-weight: 800; background: rgba(255, 255, 255, .24); padding: 1px 8px; border-radius: 20px; }
.icon-btn { width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 9px; border: 0; background: transparent; color: var(--muted); cursor: pointer; transition: .15s; flex: none; }
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.icon-btn.danger:hover { background: var(--err-soft); color: var(--err); }
.icon-btn svg.i { width: 17px; height: 17px; }

input, select, textarea { font: 500 14px var(--font); color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 0 12px; height: 42px; outline: none; transition: border-color .15s, box-shadow .15s, background .15s; width: 100%; min-width: 0; }
textarea { height: auto; padding: 10px 12px; line-height: 1.6; resize: vertical; }
select { appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236D7290' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 15px; }
input::placeholder, textarea::placeholder { color: var(--faint); font-weight: 400; }
input:hover, select:hover, textarea:hover { border-color: var(--faint); }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-ring); }
input[readonly] { background: var(--surface-2); color: var(--muted); }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; padding: 0; accent-color: var(--brand); cursor: pointer; flex: none; box-shadow: none; }
input[type="date"] { padding-right: 8px; }
input[type="file"] { height: auto; padding: 8px; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field > span { font-size: 12.5px; font-weight: 700; color: var(--ink-2); display: flex; align-items: center; gap: 8px; }
.field > span em { font-style: normal; margin-left: auto; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; } .span3 { grid-column: span 3; } .full { grid-column: 1 / -1; }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 0; border-top: 1px solid var(--line-2); cursor: pointer; }
.switch:first-of-type { border-top: 0; }
.switch b { display: block; font-size: 14px; }
.switch small { color: var(--muted); font-size: 12.5px; }
.switch input { appearance: none; width: 42px; height: 24px; border-radius: 30px; background: var(--surface-3); border: 1px solid var(--line); position: relative; transition: .2s; cursor: pointer; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: .2s; }
.switch input:checked { background: var(--brand); border-color: var(--brand); }
.switch input:checked::after { transform: translateX(18px); }
.toggle-inline { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--ink-2); cursor: pointer; white-space: nowrap; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px 0; }
.card-head .ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex: none; }
.card-head .ico svg { width: 17px; height: 17px; }
.card-head p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.card-body { padding: 18px 22px 22px; }

.status { display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 11px 0 9px; border-radius: 20px; font-size: 12px; font-weight: 700; white-space: nowrap; background: var(--surface-3); color: var(--ink-2); }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.s-new { background: var(--surface-3); color: var(--muted); }
.s-done { background: var(--ok-soft); color: var(--ok); }
.s-stale { background: var(--stale-soft); color: var(--stale); }
.s-error { background: var(--err-soft); color: var(--err); }
.s-queued { background: var(--run-soft); color: var(--run); }
.s-running { background: var(--run-soft); color: var(--run); }
.s-running::before { width: 11px; height: 11px; background: none; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
.s-queued::before { animation: blink 1.2s ease-in-out infinite; }
.badge { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 20px; font-size: 11.5px; font-weight: 700; white-space: nowrap; cursor: default; }
.badge svg.i { width: 13px; height: 13px; }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.soft { background: var(--surface-3); color: var(--muted); }
.jtag { display: inline-flex; align-items: center; height: 21px; padding: 0 8px; border-radius: 6px; font-size: 11px; font-weight: 800; letter-spacing: .04em; background: var(--brand-soft); color: var(--brand-ink); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes blink { 50% { opacity: .25; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes shimmer { to { background-position: -200% 0; } }

.spinner { width: 16px; height: 16px; border: 2px solid rgba(255, 255, 255, .45); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; flex: none; }
.spinner.dark { border-color: var(--line); border-top-color: var(--brand); }

/* ------------------------------------------------------------------ dashboard */
.search { position: relative; display: flex; align-items: center; }
.search svg { position: absolute; left: 13px; width: 16px; height: 16px; color: var(--faint); pointer-events: none; }
.search input { padding-left: 38px; padding-right: 36px; width: 280px; background: var(--surface); box-shadow: var(--shadow-sm); }
.search kbd { position: absolute; right: 10px; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.kpi { position: relative; display: flex; align-items: center; gap: 14px; padding: 18px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow); overflow: hidden; animation: rise .4s both; }
.kpi:nth-child(2) { animation-delay: .04s; } .kpi:nth-child(3) { animation-delay: .08s; } .kpi:nth-child(4) { animation-delay: .12s; }
.kpi-ico { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; color: #fff; flex: none; }
.kpi-ico svg { width: 21px; height: 21px; }
.kpi-ico { background: var(--accent); }
.kpi span { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.kpi b { display: block; font-size: 26px; font-weight: 800; letter-spacing: -.03em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.ring { --p: 0; margin-left: auto; width: 44px; height: 44px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: conic-gradient(var(--ok) calc(var(--p) * 1%), var(--surface-3) 0); }
.ring::after { content: attr(data-label); width: 34px; height: 34px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-size: 10.5px; font-weight: 800; color: var(--ink-2); }

.drop { position: relative; display: flex; align-items: center; gap: 20px; padding: 22px 26px; margin-bottom: 22px; border-radius: var(--r-xl); cursor: pointer;
  background: var(--surface); border: 1.5px dashed color-mix(in srgb, var(--brand) 38%, var(--line)); transition: .2s; overflow: hidden; }
.drop::before { content: ""; position: absolute; inset: 0; background: var(--grad); opacity: .045; transition: .2s; }
.drop:hover, .drop.over { border-color: var(--brand); box-shadow: 0 0 0 5px var(--brand-ring); }
.drop:hover::before, .drop.over::before { opacity: .09; }
.drop > * { position: relative; }
.drop-art { width: 58px; height: 58px; border-radius: 17px; background: var(--grad); color: #fff; display: grid; place-items: center; flex: none;
  transition: transform .25s; }
.drop:hover .drop-art { transform: translateY(-3px) rotate(-4deg); }
.drop-art svg { width: 27px; height: 27px; }
.drop-text { flex: 1; }
.drop-text b { display: block; font-size: 17px; font-weight: 800; letter-spacing: -.02em; }
.drop-text span { color: var(--muted); font-weight: 500; }
.drop-text u { color: var(--brand); text-decoration: none; font-weight: 700; }
.drop-types { display: flex; gap: 6px; }
.drop-types span { font: 700 11.5px var(--mono); padding: 5px 10px; border-radius: 8px; background: var(--surface-3); color: var(--ink-2); }

.list-card { overflow: hidden; }
.list-head { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.seg { display: inline-flex; gap: 3px; padding: 4px; background: var(--surface-3); border-radius: 12px; flex-wrap: wrap; }
.seg button { font: 700 12.5px var(--font); color: var(--muted); background: none; border: 0; padding: 7px 13px; border-radius: 9px; cursor: pointer; display: inline-flex; gap: 7px; align-items: center; transition: .15s; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); }
.seg button i { font-style: normal; font-size: 11px; font-weight: 800; padding: 0 7px; line-height: 18px; border-radius: 20px; background: var(--surface); color: var(--muted); }
.seg button.on i { background: var(--brand-soft); color: var(--brand-ink); }
.check-all { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; }

.rows { display: flex; flex-direction: column; }
.ri { display: grid; grid-template-columns: 22px 46px minmax(0, 1fr) 130px 128px 96px 156px; align-items: center; gap: 16px; padding: 13px 18px;
  border-bottom: 1px solid var(--line-2); transition: background .15s; position: relative; }
.ri:last-child { border-bottom: 0; }
.ri:hover { background: var(--surface-2); }
.ri.sel { background: var(--brand-soft); }
.ri.flash-ok { animation: flashok 1.4s ease; }
@keyframes flashok { 0% { background: var(--ok-soft); } 100% { background: transparent; } }
.thumb { width: 46px; height: 62px; border-radius: 7px; overflow: hidden; background: var(--grad); display: grid; place-items: center; box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); flex: none; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb span { color: #fff; font-size: 9.5px; font-weight: 800; letter-spacing: .04em; writing-mode: vertical-rl; transform: rotate(180deg); }
.ri-main { min-width: 0; color: var(--ink); }
.ri-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-weight: 700; font-size: 14.5px; line-height: 1.4; letter-spacing: -.01em; }
.ri-main:hover .ri-title { color: var(--brand); }
.ri-meta { display: flex; align-items: center; gap: 8px; margin-top: 5px; font-size: 12.5px; color: var(--muted); font-weight: 500; flex-wrap: wrap; }
.ri-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--faint); }
.ri-status { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; }
.ri-msg { font-size: 11.5px; color: var(--err); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ri-pages b { display: block; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.ri-pages small { color: var(--muted); font-size: 12px; }
.ri-acts { display: flex; justify-content: flex-end; gap: 2px; }
.ri-acts .icon-btn[data-gen] { color: var(--brand); }
.ri-acts .icon-btn[data-gen]:hover { background: var(--brand-soft); }
.ri-acts .icon-btn.disabled { opacity: .3; pointer-events: none; }
.ri-bar { position: absolute; left: 0; bottom: -1px; height: 2px; width: 0; opacity: 0; background: var(--grad); transition: width .3s ease, opacity .3s; }
.ri.running .ri-bar { width: 86%; opacity: 1; transition: width 8s cubic-bezier(.1, .7, .2, 1), opacity .3s; }
.no-match { padding: 40px; text-align: center; color: var(--muted); }

.empty { padding: 64px 24px; text-align: center; }
.empty-art { width: 84px; height: 84px; margin: 0 auto 18px; border-radius: 26px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.empty-art svg { width: 36px; height: 36px; }
.empty h3 { font-size: 18px; margin-bottom: 6px; }
.empty p { color: var(--muted); max-width: 380px; margin: 0 auto 18px; }

.bulkbar { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 140%); display: flex; align-items: center; gap: 4px; padding: 7px 8px 7px 18px;
  background: #142033; color: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); z-index: 50; opacity: 0; visibility: hidden; transition: transform .3s cubic-bezier(.2, .9, .3, 1.2), opacity .2s, visibility .2s; }
:root[data-theme="dark"] .bulkbar { background: #1B283B; border: 1px solid #2A3B55; }
.bulkbar.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; }
.bulkbar b { font-size: 13px; margin-right: 10px; white-space: nowrap; }
.bulkbar button { font: 600 13px var(--font); color: #E3E9F2; background: none; border: 0; height: 38px; padding: 0 12px; border-radius: 10px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.bulkbar button:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.bulkbar button.danger:hover { background: rgba(255, 107, 114, .2); color: #FFB3B7; }
.bulkbar button.hl { background: var(--grad); color: #fff; }
.bulkbar .sep { width: 1px; height: 22px; background: rgba(255, 255, 255, .15); margin: 0 4px; }
.bulkbar svg.i { width: 16px; height: 16px; }

/* activity panel: uploads + PDF generation progress */
.activity { position: fixed; right: 24px; bottom: 24px; width: 360px; max-width: calc(100vw - 32px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg); z-index: 55; overflow: hidden; animation: rise .3s both; }
.act-head { display: flex; align-items: center; gap: 12px; padding: 16px 16px 12px; }
.act-ico { width: 38px; height: 38px; border-radius: 11px; background: var(--grad); color: #fff; display: grid; place-items: center; flex: none; }
.act-ico.ok { background: var(--accent); }
.act-head b { display: block; font-size: 14px; }
.act-head small { color: var(--muted); font-size: 12.5px; }
.act-bar { height: 6px; margin: 0 16px 14px; border-radius: 10px; background: var(--surface-3); overflow: hidden; }
.act-bar i { display: block; height: 100%; width: 0; background: var(--grad); border-radius: 10px; transition: width .4s ease; }
.act-list { max-height: 196px; overflow: auto; border-top: 1px solid var(--line-2); padding: 6px 8px 8px; }
.act-item { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; font-size: 12.5px; }
.act-item span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.act-item small { color: var(--muted); white-space: nowrap; font-weight: 600; }
.act-item .st { width: 16px; height: 16px; flex: none; display: grid; place-items: center; }
.act-item .st svg { width: 15px; height: 15px; }
.act-item.ok .st { color: var(--ok); } .act-item.err .st { color: var(--err); } .act-item.err small { color: var(--err); }
.act-item.wait .st::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }

/* full-page drop overlay */
.drop-overlay { position: fixed; inset: 0; z-index: 90; display: none; place-items: center; background: rgba(20, 32, 51, .45); backdrop-filter: blur(6px); }
.drop-overlay.show { display: grid; }
.do-card { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 46px 70px; border-radius: 28px; background: var(--surface); border: 2px dashed var(--brand); box-shadow: var(--shadow-lg); animation: rise .2s; }
.do-card svg { width: 52px; height: 52px; color: var(--brand); }
.do-card b { font-size: 20px; } .do-card span { color: var(--muted); font-family: var(--mono); font-size: 12.5px; }

/* toasts */
.toasts { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 11px 16px 11px 12px; border-radius: 12px; background: #142033; color: #fff; font-weight: 600; font-size: 13.5px;
  box-shadow: var(--shadow-lg); animation: rise .25s both; pointer-events: auto; max-width: min(560px, calc(100vw - 32px)); }
:root[data-theme="dark"] .toast { background: #1B283B; }
.toast .ti { width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; flex: none; background: rgba(127, 166, 216, .22); color: #A9C4E8; }
.toast.err .ti { background: rgba(255, 107, 114, .2); color: #FF9CA1; }
.toast.warn .ti { background: rgba(242, 179, 84, .2); color: #FFCB7A; }
.toast .ti svg { width: 15px; height: 15px; }
.toast.out { opacity: 0; transform: translateY(-8px); transition: .25s; }

/* modal */
.modal { position: fixed; inset: 0; z-index: 80; display: none; align-items: flex-start; justify-content: center; padding: 8vh 16px 16px; background: rgba(10, 12, 24, .5); backdrop-filter: blur(4px); overflow: auto; }
.modal.show { display: flex; }
.sheet { width: 640px; max-width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); animation: rise .22s both; overflow: hidden; }
.sheet.sm { width: 440px; } .sheet.lg { width: 820px; }
.sheet header { display: flex; align-items: center; gap: 12px; padding: 20px 24px 6px; }
.sheet header h2 { flex: 1; font-size: 19px; }
.sheet header .sub { color: var(--muted); font-size: 13px; font-weight: 600; }
.sheet .body { padding: 18px 24px 22px; }
.sheet footer { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 24px; background: var(--surface-2); border-top: 1px solid var(--line); flex-wrap: wrap; }
.confirm { display: flex; gap: 16px; padding-top: 26px !important; }
.confirm h3 { font-size: 17px; margin-bottom: 6px; }
.confirm p { color: var(--muted); margin: 0; }
.confirm-ico { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex: none; }
.confirm-ico.danger { background: var(--err-soft); color: var(--err); }

/* ------------------------------------------------------------------ editor */
.ed-top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; padding: 12px 28px; background: var(--overlay); backdrop-filter: blur(18px) saturate(1.4); border-bottom: 1px solid var(--line); }
.ed-top .thumb { width: 34px; height: 46px; border-radius: 5px; }
.ed-title { flex: 1; min-width: 0; }
.ed-title b { display: block; font-size: 16px; font-weight: 800; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-title .ri-meta { margin-top: 3px; }
.ed-acts, .ed-chips, .ed-btns { display: flex; align-items: center; gap: 14px; }
.savestate { display: inline-flex; align-items: center; gap: 6px; }
.savestate::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.savestate.dirty { color: var(--warn); } .savestate.dirty::before { background: var(--warn); }
.ed { display: grid; grid-template-columns: minmax(0, 1fr) minmax(400px, 44%); gap: 22px; padding: 22px 28px 60px; align-items: start; max-width: 1760px; margin: 0 auto; }
.ed-left { min-width: 0; }
.ed-tabs { display: flex; margin-bottom: 18px; }
.ed-tabs .seg { width: 100%; display: grid; grid-template-columns: repeat(4, 1fr); }
.ed-tabs .seg button { justify-content: center; padding: 9px 10px; font-size: 13px; }
.ed-tabs .seg button svg { width: 16px; height: 16px; }
.pane { display: none; animation: rise .25s both; } .pane.on { display: block; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.header-preview { display: flex; align-items: center; gap: 10px; margin-top: 16px; padding: 12px 14px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line-2); font-size: 13px; color: var(--ink-2); }
.header-preview svg { color: var(--brand); width: 16px; height: 16px; }
.header-preview i { font-family: var(--serif); font-size: 15px; color: var(--ink); }
.header-preview.bad { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn); }
.cover-box { display: flex; gap: 20px; align-items: flex-start; }
.cover-prev { width: 132px; aspect-ratio: 210 / 297; border-radius: 10px; overflow: hidden; flex: none; display: grid; place-items: center; text-align: center;
  background: var(--surface-3); border: 1.5px dashed var(--line); color: var(--faint); font-size: 12px; font-weight: 600; box-shadow: var(--shadow-sm); }
.cover-prev img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-prev.has { border-style: solid; border-color: var(--line); }
.cover-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.cover-side .radio { display: flex; flex-direction: column; gap: 8px; }
.cover-side .radio label { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 13.5px; cursor: pointer; }
.wc { font-size: 11.5px; font-weight: 700; padding: 2px 9px; border-radius: 20px; background: var(--surface-3); color: var(--muted); }
.wc.over { background: var(--warn-soft); color: var(--warn); }

.blocks-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); font-weight: 600; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.blocks { display: flex; flex-direction: column; gap: 4px; padding: 26px 30px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.blk { position: relative; border-radius: 10px; padding: 6px 10px 6px 16px; transition: background .15s, box-shadow .15s; }
.blk::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--rc, transparent); opacity: .85; }
.blk:hover { background: var(--surface-2); }
.blk.focus { background: var(--surface-2); box-shadow: 0 0 0 2px var(--brand-ring); }
.bh { display: flex; align-items: center; gap: 6px; min-height: 20px; position: relative; z-index: 2; }
.bh select.role { height: 20px; width: auto; border: 0; border-radius: 5px; background-color: transparent; box-shadow: none; padding: 0 18px 0 0;
  font: 800 10.5px var(--font); letter-spacing: .07em; text-transform: uppercase; color: var(--lc, var(--rc)); background-position: right 1px center; background-size: 11px; }
.bh select.role:hover { background-color: var(--surface-3); padding-left: 5px; }
.bh select.role option { text-transform: none; font-weight: 600; letter-spacing: 0; color: var(--ink); background: var(--surface); }
.r-body .bh, .r-ref .bh, .r-list .bh { position: absolute; left: 16px; right: 8px; top: -11px; }
.r-body .bh select.role, .r-ref .bh select.role, .r-list .bh select.role { opacity: 0; background-color: var(--surface); padding-left: 5px; }
.r-body:hover .bh select.role, .r-body.focus .bh select.role, .r-ref:hover .bh select.role, .r-ref.focus .bh select.role, .r-list:hover .bh select.role, .r-list.focus .bh select.role { opacity: 1; }
.bh .tools { margin-left: auto; display: flex; gap: 2px; opacity: 0; transition: opacity .15s; background: var(--surface); border-radius: 8px; box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); padding: 1px; }
.blk:hover .tools, .blk.focus .tools { opacity: 1; }
.bh .tools button { border: 0; background: none; width: 28px; height: 24px; border-radius: 6px; cursor: pointer; color: var(--muted); display: grid; place-items: center; }
.bh .tools button:hover { background: var(--surface-3); color: var(--ink); }
.bh .tools button.del:hover { background: var(--err-soft); color: var(--err); }
.bh .tools svg { width: 14px; height: 14px; }
.ce { outline: none; min-height: 1.5em; font-family: var(--serif); font-size: 16.5px; line-height: 1.55; color: var(--paper-ink); text-align: justify; }
.ce:empty::before { content: "Type here…"; color: var(--faint); }
.r-h1 { --rc: #305B91; } .r-h2, .r-h3 { --rc: #6A8FBE; } .r-ref_head { --rc: #305B91; }
.r-caption_table, .r-caption_figure { --rc: #4A76AD; } .r-note { --rc: #4A76AD; }
.r-table, .r-figure, .r-equation, .r-quote { --rc: #9DB8DA; } .r-list { --rc: #B9CBE2; } .r-ref { --rc: #A0ABBC; } .r-skip { --rc: #E5484D; } .r-body { --rc: transparent; --lc: var(--faint); }
.r-h1 .ce, .r-ref_head .ce { font-weight: 700; text-transform: uppercase; text-align: left; }
.r-h2 .ce { font-weight: 700; text-align: left; } .r-h3 .ce { font-weight: 700; font-style: italic; text-align: left; }
.r-h1, .r-h2, .r-h3, .r-ref_head { margin-top: 10px; }
.r-h1 + .r-h2, .r-h1 + .r-h3, .r-h2 + .r-h3, .r-h2 + .r-h2 { margin-top: 0; }
.r-caption_table .ce, .r-caption_figure .ce { font-weight: 600; text-align: left; }
.r-note .ce { font-style: italic; font-size: 14.5px; }
.r-ref .ce { padding-left: 22px; text-indent: -22px; font-size: 15px; text-align: left; }
.r-skip { opacity: .45; } .r-skip .ce { text-decoration: line-through; }
.r-list .ce { padding-left: 14px; }
.eqchip, .picchip { display: inline-flex; align-items: center; font: 700 11px var(--font); background: var(--run-soft); color: var(--run); border-radius: 6px; padding: 1px 7px; margin: 0 1px; user-select: none; text-indent: 0; }
.brkchip { display: inline-flex; align-items: center; font: 700 10px var(--font); letter-spacing: .02em; text-transform: uppercase; color: var(--run); border: 1px dashed currentColor; border-radius: 6px; padding: 0 6px; margin: 0 2px; user-select: none; text-indent: 0; vertical-align: 1px; }
.brkchip::before { content: "\21B5"; margin-right: 4px; font-size: 11px; }
.etable { border-collapse: collapse; width: 100%; font-family: var(--serif); font-size: 15px; color: var(--paper-ink); }
.etable td { border: 1px solid var(--paper-line); padding: 4px 8px; vertical-align: top; min-width: 30px; outline: none; }
.etable td:focus { background: var(--brand-soft); box-shadow: inset 0 0 0 2px var(--brand); }
.etable tr:first-child td { font-weight: 700; background: var(--surface-2); }
.tablewrap { overflow-x: auto; border-radius: 8px; }
.tbl-tools { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.tbl-tools .tbl-size { margin-left: auto; width: auto; height: 32px; font-size: 12.5px; font-weight: 600; border-radius: 8px; }
.tbl-tools .lay-opts { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.fig .lay-opts { display: grid; gap: 10px; }
.tbl-tools .lay-opts select { width: auto; height: 32px; font-size: 12.5px; font-weight: 600; border-radius: 8px; }
/* a paragraph's layout set by hand (E-Palli) */
.lay-pop { position: absolute; top: calc(100% + 6px); right: 6px; width: 440px; max-width: calc(100vw - 32px); z-index: 30; display: grid; gap: 10px; padding: 10px 14px 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); font: 500 13px var(--font); color: var(--ink); }
.lay-pop[hidden] { display: none; }
.lay-pop .lp-h { display: flex; align-items: center; justify-content: space-between; }
.lay-pop .lp-row, .pv-lay .lp-row { display: grid; grid-template-columns: 96px 1fr; align-items: center; gap: 8px; }
.lay-pop .lp-row > span, .pv-lay .lp-row > span { color: var(--muted); font-weight: 700; font-size: 12px; }
.lay-pop .seg button, .pv-lay .seg button { height: auto; min-width: 0; padding: 6px 10px; font-size: 12px; display: inline-flex; }
.lay-pop .lp-step, .pv-lay .lp-step { display: flex; align-items: center; gap: 6px; }
.lay-pop .lp-step button, .pv-lay .lp-step button { height: 30px; padding: 0 10px; font-size: 12.5px; font-weight: 700; background: var(--surface-3); display: inline-flex; align-items: center; }
.lay-pop .lp-step b, .pv-lay .lp-step b { min-width: 64px; text-align: center; font-size: 12.5px; }
.lay-pop .lp-hint, .pv-lay .lp-hint { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.lay-pop .lp-foot { display: flex; justify-content: flex-end; }
/* the page view: the PDF's pages, a click finds the block, changed beside them (E-Palli) */
.pv { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.pv[hidden] { display: none; }
.pv-pages { display: grid; gap: 16px; min-width: 0; }
.pv-page { position: relative; background: #fff; box-shadow: var(--shadow); border-radius: 4px; overflow: hidden; cursor: default; }
.pv-page img { display: block; width: 100%; height: 100%; user-select: none; -webkit-user-drag: none; }
.pv-pages { --pvz: 1; overflow-x: auto; }
.pv-page { width: calc(var(--pvz) * 100%); justify-self: center; }
.pv-tools { position: sticky; top: calc(var(--edtop, 71px) + 4px); z-index: 6; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; min-width: 0;
  padding: 6px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-sm); font: 600 12px var(--font); }
.pv-tline { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; min-width: 0; }
.pv-tline > button, .pv-tline > b { flex: none; }
.pv-tline button { height: 28px; min-width: 32px; padding: 0 10px; border-radius: 8px; background: var(--surface-3); font: 700 13px var(--font); }
.pv-tline b { min-width: 46px; text-align: center; }
.pv-tools .muted { font-weight: 500; }
.pv-live { margin-left: auto; color: var(--muted); font-weight: 600; white-space: nowrap; }
.pv-live.on::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--brand); animation: pvblink 1s ease-in-out infinite; }
.pv-live.dirty { color: #b45309; }
@keyframes pvblink { 50% { opacity: .25; } }
.pv-tline button .i { width: 16px; height: 16px; vertical-align: -3px; }
.pv-tline .pv-tsep { width: 1px; height: 20px; margin: 0 4px; background: var(--line); }
.pv-tline .pv-save { display: inline-flex; align-items: center; gap: 6px; flex: none; }
.pv-tline .pv-rbt { min-width: 28px; padding: 0 6px; flex: none; }
.pv-what { margin-left: 4px; font-weight: 500; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.pv-ctl[hidden] { display: none; }
.pv-ctl .pv-hint { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
.pv-tline .pv-save.on { background: var(--brand); color: #fff; }
/* the pages' scroll bar at the window's foot, with arrows (their own is under the last page) */
.pv-hs { position: sticky; bottom: 0; z-index: 6; display: flex; align-items: center; gap: 4px; padding: 3px; margin-top: -10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-sm); }
.pv-hs[hidden] { display: none; }
.pv-hs button { flex: none; width: 26px; height: 20px; border-radius: 5px; background: var(--surface-3); font-size: 10px; line-height: 1; color: var(--ink-2); }
.pv-hs-track { flex: 1; min-width: 0; overflow-x: scroll; overflow-y: hidden; height: 18px; }
.pv-hs-track > div { height: 1px; }
body.pv-hand .pv-pages, body.pv-hand .pv-page { cursor: grab !important; }
body.pv-grab, body.pv-grab * { cursor: grabbing !important; user-select: none; }
/* the ribbon (as Word's): groups of settings, each with its name under it */
.rb { display: flex; flex-wrap: nowrap; min-width: 0; max-width: 100%; align-items: stretch; overflow-x: auto; scrollbar-width: thin; padding-bottom: 2px; }
.rb-g { display: flex; flex-direction: column; justify-content: space-between; gap: 4px; padding: 0 12px; border-right: 1px solid var(--line); }
.rb-g:first-child { padding-left: 2px; }
.rb-g:last-of-type { border-right: 0; }
.rb-c { display: flex; align-items: center; gap: 6px; min-height: 28px; white-space: nowrap; }
.rb-n { font: 600 10.5px var(--font); color: var(--muted); text-align: center; letter-spacing: .02em; }
.rb-f { display: inline-flex; align-items: center; gap: 4px; }
.rb-f > span { font-size: 11.5px; color: var(--muted); font-weight: 700; display: inline-flex; }
.rb-f > span .i { width: 16px; height: 16px; stroke-width: 2; }
.pv-ctl .rb select { width: auto; max-width: 190px; height: 28px; font-size: 12px; padding-top: 0; padding-bottom: 0; }
.rb-b { height: 28px; min-width: 30px; padding: 0 7px; border-radius: 7px; background: var(--surface-3); font: 600 14px var(--serif); }
.rb-b:hover, .rb-reset:hover { background: var(--line); }
.rb .seg button { padding: 4px 8px; font-size: 11.5px; min-width: 0; height: auto; display: inline-flex; }
.rb .seg button .i { width: 15px; height: 15px; stroke-width: 2; }
.rb-chk { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); cursor: pointer; }
.rb-reset { height: 26px; padding: 0 10px; border-radius: 7px; background: var(--surface-3); font: 700 11.5px var(--font); }
.rb-hint { align-self: center; padding-left: 10px; font-size: 12px; }
/* the bar over the pages (InDesign's control panel): what is selected and its settings, in one or two lines */
.pv-ctl { display: flex; align-items: center; gap: 6px 14px; flex-wrap: wrap; min-height: 30px; min-width: 0; padding-top: 6px; border-top: 1px solid var(--line); font-size: 12px; }
.pv-ctl-h { white-space: nowrap; font-size: 12.5px; }
.pv-ctl .pv-lay { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.pv-ctl .pv-lay .lp-row { display: flex; align-items: center; gap: 6px; }
.pv-ctl .pv-lay .lp-row > span { font-size: 11.5px; white-space: nowrap; }
.pv-ctl .pv-sub, .pv-ctl .lp-hint { display: none; }
.pv-ctl .lp-x { display: none !important; }
.pv-ctl.more .lp-x { display: flex !important; }
.pv-ctl .pv-lay .lp-step button { height: 26px; padding: 0 8px; }
.pv-ctl .pv-lay .lp-step b { min-width: 44px; font-size: 12px; }
.pv-ctl .pv-lay .seg button { padding: 4px 8px; font-size: 11.5px; }
.pv-ctl .pv-lay .seg button .i { width: 15px; height: 15px; stroke-width: 2; }
.pv-ctl select, .pv-ctl .pv-lay select[data-role] { width: auto; height: 28px; font-size: 12px; padding-top: 0; padding-bottom: 0; }
.pv-ctl .lp-chk { white-space: nowrap; }
.pv-ctl .btn.sm { height: 28px; }
.pv-more { height: 26px; padding: 0 10px; border-radius: 8px; background: var(--surface-3); font: 700 12px var(--font); }
/* the selected frame, as InDesign draws it: its edge, eight (or two) handles, a text frame's in and out ports */
.pv-sel { position: absolute; box-sizing: border-box; border: 1px solid #1a73e8; pointer-events: none; z-index: 3; }
.pv-sel-figure, .pv-sel-table { pointer-events: auto; cursor: move; background: rgba(26, 115, 232, .07); touch-action: none; }
.pv-sel.pv-moving { opacity: .8; }
.pv-sel.pv-sel-x { pointer-events: none; background: rgba(26, 115, 232, .05); border-style: dashed; }   /* one of several selected (Shift + click) */
.pv-hd { position: absolute; width: 9px; height: 9px; box-sizing: border-box; background: #fff; border: 1px solid #1a73e8; pointer-events: auto; transform: translate(-50%, -50%); touch-action: none; }
.pv-hd-nw { left: 0; top: 0; cursor: nwse-resize; }
.pv-hd-n { left: 50%; top: 0; cursor: ns-resize; }
.pv-hd-ne { left: 100%; top: 0; cursor: nesw-resize; }
.pv-hd-e { left: 100%; top: 50%; cursor: ew-resize; }
.pv-hd-se { left: 100%; top: 100%; cursor: nwse-resize; }
.pv-hd-s { left: 50%; top: 100%; cursor: ns-resize; }
.pv-hd-sw { left: 0; top: 100%; cursor: nesw-resize; }
.pv-hd-w { left: 0; top: 50%; cursor: ew-resize; }
.pv-sel-text .pv-hd { width: 13px; height: 9px; }
.pv-sel-text .pv-hd-nw, .pv-sel-text .pv-hd-ne, .pv-sel-text .pv-hd-se, .pv-sel-text .pv-hd-sw { width: 9px; }
.pv-sel-text .pv-hd-e, .pv-sel-text .pv-hd-w, .pv-sel-caption .pv-hd-e, .pv-sel-caption .pv-hd-w { width: 9px; height: 13px; }
.pv-port { position: absolute; width: 10px; height: 10px; box-sizing: border-box; background: #fff; border: 1px solid #1a73e8; display: grid; place-items: center; }
.pv-port.pv-in { left: -5px; top: 12px; }
.pv-port.pv-out { right: -5px; bottom: 12px; }
.pv-port.th::after { content: ""; border-left: 5px solid #1a73e8; border-top: 3px solid transparent; border-bottom: 3px solid transparent; }
.pv-tip, .pv-drop span { position: absolute; left: 0; top: -24px; background: #1a73e8; color: #fff; font: 600 11px var(--font); padding: 3px 7px; border-radius: 5px; white-space: nowrap; pointer-events: none; z-index: 2; }
.pv-tip[hidden] { display: none; }
.pv-drop { position: absolute; height: 0 !important; border-top: 2px solid #1a73e8; pointer-events: none; z-index: 4; }
.pv-threads .pv-fr-text { border-color: rgba(26, 115, 232, .9); }
.pv-fr-notes { border-color: rgba(13, 148, 136, .75); }
/* typing in a frame: its words in the page's type, over the page */
.pv-story { position: absolute; z-index: 5; box-sizing: border-box; background: #fff; color: #111; outline: 1px solid #1a73e8; outline-offset: 0; cursor: text;
  hyphens: auto; -webkit-hyphens: auto; overflow-wrap: break-word; padding: 0; font-kerning: normal; }
.pv-story p { margin: 0; }
/* its lines as the page breaks them (frozen: no wrapping; justified ones filled out), until typed in */
.pv-story .pv-ln { display: block; white-space: nowrap; text-indent: 0; }
.pv-story .pv-ln.j { text-align-last: justify; }
.pv-story .pv-ln.j.end { text-align-last: auto; }
.pv-story .pv-ln.ed { white-space: normal; }
.pv-story .pv-ln.hy::after { content: "-"; }
.pv-story .pv-obj { text-align: center; font-style: italic; text-align-last: auto; cursor: default; user-select: none; }
.pv-story .r-h1, .pv-story .r-h2, .pv-story .r-h3, .pv-story .r-ref_head { font-weight: 700; text-align: left; hyphens: manual; }
.pv-story.up .r-h1, .pv-story.up .r-ref_head { text-transform: uppercase; }
.pv-page { background-size: 100% 100%; }
body.pv-wait, body.pv-wait * { cursor: progress !important; }
.pv-textw { display: grid; gap: 4px; }
/* InDesign-like frame edges over the page: the article text (one story through the columns), pictures, their titles, tables */
.pv-fr { position: absolute; pointer-events: none; box-sizing: border-box; border: 1px solid rgba(59, 130, 246, .55); }
.pv-fr-text { border-style: solid; border-color: rgba(59, 130, 246, .45); }
.pv-fr-figure { border-color: rgba(220, 38, 38, .6); }
.pv-fr-caption { border-color: rgba(22, 163, 74, .7); }
.pv-fr-table { border-color: rgba(147, 51, 234, .65); }
.pv-fr-eq { border-color: rgba(234, 88, 12, .6); }
.pv-noframes .pv-fr { display: none; }
.pv-tools button.on { background: var(--brand); color: #fff; }
.pv-inline { position: absolute; z-index: 2; box-sizing: border-box; padding: 0 1px; background: rgba(255, 255, 255, .97); color: #111;
  outline: 2px solid var(--brand); border-radius: 2px; font-family: var(--serif); line-height: 1.3; text-align: justify; cursor: text; }
.pv-fmt { display: flex; gap: 4px; }
.pv-fmt button { height: 28px; min-width: 32px; padding: 0 8px; border-radius: 7px; background: var(--surface-3); font: 600 13px var(--serif); }
.pv-lay select[data-role] { width: 100%; height: 32px; }
.pv-lay .lp-chk { display: flex; gap: 8px; align-items: flex-start; color: var(--ink-2); font-size: 12px; cursor: pointer; }
.pv-lay .lp-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pv-hl { position: absolute; border: 2px solid var(--brand); background: rgba(48, 91, 145, .10); border-radius: 3px; pointer-events: none; }
.pv-hl[hidden] { display: none; }
.pv-no { position: absolute; right: 8px; bottom: 6px; font: 700 11px var(--font); color: var(--muted); background: var(--surface); padding: 1px 7px; border-radius: 6px; }
/* the panel of the selected block: a drawer over the right of the page, so the page keeps the whole width */
.pv-side { position: fixed; right: 18px; top: calc(var(--edtop, 71px) + 10px); width: min(380px, calc(100vw - 36px)); z-index: 30;
  max-height: calc(100vh - var(--edtop, 71px) - 28px); overflow: auto; display: none; gap: 12px;
  padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-sm); font: 500 13px var(--font); }
.pv-side.open { display: grid; box-shadow: var(--shadow); }
.pv-h { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.pv-h .pv-close { margin-left: auto; width: 28px; height: 28px; border-radius: 8px; background: var(--surface-3); font: 700 16px var(--font); line-height: 1; }
.pv-pages.pv-zoomed .pv-page { justify-self: start; }
.pv-sub { font: 800 10px var(--font); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.pv-empty, .pv-note { color: var(--muted); font-size: 13px; padding: 18px 6px; text-align: center; }
.pv-note { padding: 8px; background: var(--surface-3); border-radius: 8px; }
.pv-text { font-family: var(--serif); font-size: 15px; line-height: 1.55; color: var(--paper-ink); background: var(--paper); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; outline: none; max-height: 42vh; overflow: auto; text-align: left; }
.pv-text:focus { border-color: var(--brand); }
.pv-lay { display: grid; gap: 10px; }
.pv-go { justify-self: start; }
.pv-side .fig { display: grid; gap: 10px; }
.pv-side .fig img { max-width: 100%; }
@media (max-width: 700px) { .pv-side { left: 12px; right: 12px; width: auto; top: auto; bottom: 12px; max-height: 60vh; } }
.docv > p[data-lay]::after { content: attr(data-lay); position: absolute; right: calc(100% + 16px); top: 2.1em; width: 118px; text-align: right; pointer-events: none; user-select: none;
  font: 700 9px/1.3 var(--font); color: var(--brand); text-indent: 0; font-style: normal; text-transform: none; letter-spacing: 0; }
.fig { display: flex; gap: 18px; align-items: flex-start; }
.fig img { max-width: 240px; max-height: 180px; border-radius: 10px; background: #fff; box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); }
.fig .field { min-width: 180px; }
.eqsrc { font-family: var(--mono) !important; font-size: 12.5px !important; }
.ins { position: relative; height: 4px; }
.ins .add { position: absolute; left: 50%; top: -11px; transform: translateX(-50%); display: flex; gap: 4px; opacity: 0; transition: .15s; z-index: 3; }
.ins:hover .add { opacity: 1; }
.ins .add button { font: 700 11px var(--font); border: 1px solid var(--line); background: var(--surface); color: var(--brand); border-radius: 20px; padding: 2px 10px; cursor: pointer; box-shadow: var(--shadow-sm); }
.ins .add button:hover { background: var(--brand); color: #fff; border-color: var(--brand); }
.fmtbar { position: fixed; z-index: 70; display: none; gap: 2px; background: #142033; padding: 4px; border-radius: 11px; box-shadow: var(--shadow-lg); }
.fmtbar button { border: 0; background: none; color: #fff; font: 600 13px var(--font); min-width: 30px; height: 30px; border-radius: 8px; cursor: pointer; }
.fmtbar button:hover { background: rgba(255, 255, 255, .14); }

.checks { display: flex; flex-direction: column; gap: 14px; }
.check-card { border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface); padding: 18px 20px; box-shadow: var(--shadow-sm); }
.check-card h3 { display: flex; align-items: center; gap: 10px; font-size: 14.5px; }
.check-card h3 .tag { margin-left: auto; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 20px; background: var(--surface-3); color: var(--muted); }
.check-card ul { margin: 10px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.check-card li { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: var(--ink-2); }
.check-card li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; margin-top: 8px; background: currentColor; flex: none; opacity: .6; }
.check-card.warn { background: var(--warn-soft); border-color: var(--warn-line); } .check-card.warn h3 { color: var(--warn); }
.check-card.miss h3 { color: var(--stale); } .check-card.miss li { color: var(--ink); }
.check-card.ok { background: var(--ok-soft); border-color: transparent; } .check-card.ok h3 { color: var(--ok); }
.check-card.err { background: var(--err-soft); border-color: transparent; } .check-card.err h3 { color: var(--err); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chips span { font-size: 12.5px; font-weight: 700; padding: 5px 11px; border-radius: 20px; background: var(--stale-soft); color: var(--stale); cursor: pointer; }
.chips span:hover { filter: brightness(.96); }

.dl-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.dl { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface); color: var(--ink); transition: .15s; box-shadow: var(--shadow-sm); }
.dl:hover { border-color: var(--brand); transform: translateY(-2px); box-shadow: var(--shadow); }
.dl .dl-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.dl b { font-size: 14px; } .dl small { color: var(--muted); font-size: 12px; margin-top: -6px; }
.dl.off { opacity: .45; pointer-events: none; }
.tools-row { display: flex; gap: 10px; flex-wrap: wrap; }

.preview { position: sticky; top: 92px; display: flex; flex-direction: column; height: calc(100vh - 112px); overflow: hidden; border-radius: var(--r-xl); }
.pv-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px 12px 18px; border-bottom: 1px solid var(--line); }
.pv-head b { font-size: 14px; }
.versions { display: flex; gap: 4px; flex-wrap: wrap; }
.versions a { font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 20px; background: var(--surface-3); color: var(--muted); }
.versions a.on { background: var(--brand); color: #fff; }
.preview iframe { flex: 1; width: 100%; border: 0; background: #525659; }
.pv-empty { flex: 1; display: grid; place-items: center; text-align: center; padding: 30px; background: var(--surface-2); }
.pv-paper { width: 150px; aspect-ratio: 210 / 297; margin: 0 auto 22px; border-radius: 8px; background: var(--paper); box-shadow: var(--shadow); padding: 16px 14px; display: flex; flex-direction: column; gap: 7px; }
.pv-paper i { display: block; height: 6px; border-radius: 4px; background: linear-gradient(90deg, var(--surface-3) 25%, var(--line) 50%, var(--surface-3) 75%); background-size: 200% 100%; animation: shimmer 2s linear infinite; }
.pv-paper i:first-child { height: 14px; background: var(--grad); opacity: .5; margin-bottom: 6px; }
.pv-paper i:nth-child(3n) { width: 70%; }
.pv-empty h3 { font-size: 17px; margin-bottom: 6px; }
.pv-empty p { color: var(--muted); }
.pv-foot { display: flex; align-items: center; gap: 10px; padding: 11px 18px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.pv-foot b { color: var(--ink); }

/* ------------------------------------------------------------------ journals */
.jgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 20px; }
.jcard { display: flex; flex-direction: column; cursor: pointer; overflow: hidden; transition: transform .2s, box-shadow .2s, border-color .2s; animation: rise .35s both; }
.jcard:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: transparent; }
.jcover { position: relative; aspect-ratio: 3 / 3.4; overflow: hidden; background: var(--grad); display: grid; place-items: center; }
.jcover img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; transition: transform .4s; }
.jcard:hover .jcover img { transform: scale(1.04); }
.jcover .jtag { position: absolute; top: 12px; left: 12px; background: rgba(20, 32, 51, .78); color: #fff; backdrop-filter: blur(6px); }
.jcover .nocov { color: #fff; text-align: center; font-weight: 800; font-size: 22px; letter-spacing: .04em; opacity: .9; }
.jcover .nocov small { display: block; font-size: 11.5px; font-weight: 600; opacity: .8; letter-spacing: 0; margin-top: 4px; }
.jbody { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.jbody b { font-size: 14px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.jbody .meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; padding-top: 6px; }
.jbody .meta span { font-size: 11.5px; font-weight: 700; padding: 3px 8px; border-radius: 6px; background: var(--surface-3); color: var(--ink-2); }
.jbody .abbr { font-family: var(--serif); font-style: italic; color: var(--muted); font-size: 14px; }
.cover-drop { display: flex; gap: 16px; align-items: center; padding: 14px; border-radius: var(--r); border: 1.5px dashed var(--line); cursor: pointer; transition: .15s; }
.cover-drop:hover { border-color: var(--brand); background: var(--brand-soft); }
.cover-drop .cover-prev { width: 78px; }
.cover-drop b { display: block; } .cover-drop span { color: var(--muted); font-size: 12.5px; }

/* ------------------------------------------------------------------ recycle bin */
.bin-row { display: grid; grid-template-columns: 46px minmax(0, 1fr) 150px 90px auto; align-items: center; gap: 16px; padding: 14px 20px; border-bottom: 1px solid var(--line-2); animation: rise .3s both; }
.bin-row:last-child { border-bottom: 0; }
.bin-row .thumb { filter: grayscale(.6); opacity: .85; }
.bin-row small { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.bin-row .acts { display: flex; gap: 6px; justify-content: flex-end; }
.bin-row.gone { animation: none; opacity: 0; transform: translateX(20px); transition: .3s; }

/* ------------------------------------------------------------------ settings / guide */
.settings-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.engine-opt { display: flex; gap: 14px; align-items: flex-start; padding: 16px; border-radius: var(--r); border: 1.5px solid var(--line); cursor: pointer; transition: .15s; }
.engine-opt + .engine-opt { margin-top: 10px; }
.engine-opt:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.engine-opt input { margin-top: 2px; }
.engine-opt b { display: block; }
.engine-opt small { color: var(--muted); font-size: 12.5px; }
.engine-opt.off { opacity: .5; cursor: not-allowed; }
.save-bar { position: sticky; bottom: 20px; display: flex; justify-content: flex-end; margin-top: 20px; }

.steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.step { padding: 22px; position: relative; overflow: hidden; }
.step .n { width: 40px; height: 40px; border-radius: 12px; background: var(--grad); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 16px; margin-bottom: 14px; }
.step h3 { margin-bottom: 6px; } .step p { color: var(--muted); font-size: 13.5px; margin: 0; }
.guide-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.guide-list li { display: flex; gap: 12px; align-items: flex-start; font-size: 13.5px; color: var(--ink-2); }
.guide-list li svg { color: var(--ok); width: 17px; height: 17px; margin-top: 2px; }
.style-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.style-table td { padding: 10px 0; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.style-table td:first-child { width: 42%; font-weight: 700; padding-right: 14px; }
.style-table tr:last-child td { border-bottom: 0; }

/* ------------------------------------------------------------------ sign-in */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { position: relative; overflow: hidden; background: #14243B; color: #fff; padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between; }
.login-art::before { content: ""; position: absolute; inset: -20%; background: radial-gradient(640px 420px at 20% 18%, rgba(48, 91, 145, .9), transparent 62%), radial-gradient(560px 380px at 88% 78%, rgba(48, 91, 145, .55), transparent 60%); filter: blur(10px); }
.login-art > * { position: relative; }
.login-art .brand { color: #fff; padding: 0; } .login-art .brand span { color: rgba(255, 255, 255, .7); }
.login-art h2 { font-size: 42px; font-weight: 800; line-height: 1.08; letter-spacing: -.035em; max-width: 480px; }
.login-art h2 em { font-style: normal; color: #A9C4E8; }
.pages-art { position: relative; height: 270px; margin: 10px 0 34px; }
.pages-art div { position: absolute; width: 150px; aspect-ratio: 210 / 297; border-radius: 10px; background: rgba(255, 255, 255, .95); box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .6); padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.pages-art div i { display: block; height: 5px; border-radius: 3px; background: #E1E6EE; }
.pages-art div i:first-child { height: 12px; background: #305B91; margin-bottom: 5px; }
.pages-art div i:nth-child(4n) { width: 65%; }
.pages-art .p1 { left: 0; top: 30px; transform: rotate(-8deg); opacity: .7; }
.pages-art .p2 { left: 120px; top: 0; transform: rotate(3deg); z-index: 2; }
.pages-art .p3 { left: 250px; top: 40px; transform: rotate(10deg); opacity: .8; }
.login-art .foot { color: rgba(255, 255, 255, .6); font-size: 13px; }
.login-form { display: grid; place-items: center; padding: 40px 24px; background: var(--surface); }
.login-form form { width: 360px; max-width: 100%; }
.login-form h1 { font-size: 30px; margin-bottom: 6px; }
.login-form .sub { color: var(--muted); margin-bottom: 28px; }
.login-form .err { display: flex; gap: 10px; align-items: center; padding: 11px 14px; border-radius: 12px; background: var(--err-soft); color: var(--err); font-weight: 600; font-size: 13.5px; margin-bottom: 16px; }
.pw { position: relative; }
.pw svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 17px; color: var(--faint); }
.pw input { padding-left: 40px; height: 48px; }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1280px) { .ri { grid-template-columns: 22px 46px minmax(0, 1fr) 120px 118px 84px 140px; gap: 12px; } }
@media (max-width: 1150px) {
  .ed { grid-template-columns: minmax(0, 1fr); } .preview { position: static; height: 82vh; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ri { grid-template-columns: 22px 46px minmax(0, 1fr) 118px 120px; } .ri-missing, .ri-pages { display: none; }
  .settings-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .side { position: fixed; left: 0; top: 0; transform: translateX(-105%); transition: transform .25s; box-shadow: var(--shadow-lg); background: var(--surface); }
  .side.open { transform: none; }
  .scrim.show { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(10, 12, 24, .4); }
  .mobile-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; position: sticky; top: 0; z-index: 30; background: var(--overlay); backdrop-filter: blur(16px); border-bottom: 1px solid var(--line); }
  .page { padding: 22px 16px 120px; }
  h1 { font-size: 24px; }
  .search input { width: 100%; } .search { flex: 1; } .ph-actions { width: 100%; }
  .drop-types { display: none; }
  .ri { grid-template-columns: 22px 40px minmax(0, 1fr); gap: 10px; padding: 12px 14px; }
  .ri .thumb { width: 40px; height: 54px; }
  .ri-status { grid-column: 3; flex-direction: row; align-items: center; }
  .ri-acts { grid-column: 1 / -1; justify-content: flex-start; padding-left: 72px; margin-top: -6px; }
  .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ed-top { padding: 10px 14px; top: 57px; flex-wrap: wrap; } .ed { padding: 16px 14px 60px; }
  .ed-top .thumb { display: none; }
  .ed-tabs .seg { grid-template-columns: repeat(2, 1fr); }
  .dl-tiles { grid-template-columns: minmax(0, 1fr); }
  .cover-box { flex-direction: column; }
  .bin-row { grid-template-columns: 40px minmax(0, 1fr); } .bin-row > small { display: none; } .bin-row .acts { grid-column: 1 / -1; justify-content: flex-start; }
  .login-wrap { grid-template-columns: minmax(0, 1fr); } .login-art { display: none; }
  .bulkbar { left: 12px; right: 12px; transform: translateY(140%); overflow-x: auto; } .bulkbar.show { transform: none; }
  .steps { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 520px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .kpi { padding: 14px; gap: 10px; }
  .kpi-ico { width: 38px; height: 38px; border-radius: 11px; } .kpi-ico svg { width: 18px; height: 18px; } .kpi b { font-size: 22px; } .ring { display: none; }
  .drop { padding: 16px; gap: 14px; border-radius: var(--r-lg); } .drop-art { width: 46px; height: 46px; border-radius: 14px; } .drop-text b { font-size: 15px; }
  .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); } .span2, .span3 { grid-column: auto; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* input with a small control inside it (start page + Auto) */
.inp-wrap { position: relative; }
.inp-wrap input:not([type="checkbox"]) { padding-right: 78px; }
.inp-suffix { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 9px;
  border-radius: 7px; background: var(--surface-3); font-size: 12px; font-weight: 700; color: var(--ink-2); cursor: pointer; }
.inp-suffix input { width: 15px; height: 15px; }
.inp-suffix:has(input:checked) { background: var(--brand-soft); color: var(--brand-ink); }
.legend { font-size: 11.5px; gap: 10px; }

/* phone: editor top bar = title row, then status chips on the left and buttons on the right
   (the buttons drop to their own line, as a group, when they do not fit next to the chips) */
@media (max-width: 860px) {
  .ed-top { gap: 8px 10px; }
  .bare .ed-top { top: 0; }   /* the author proof has no phone header above it */
  .ed-top .ed-title .ri-meta { flex-wrap: nowrap; white-space: nowrap; overflow: hidden; }
  .ed-acts { flex: 1 0 100%; flex-wrap: wrap; gap: 8px; }
  .ed-chips { flex-wrap: wrap; gap: 6px; margin-right: auto; }
  .ed-chips:not(:has(> :not([hidden]))) { display: none; }
  .ed-btns { flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-left: auto; }
}
@media (max-width: 520px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g4 .span2 { grid-column: span 2; }
  .ed-top #btnSave { padding: 0 12px; } .ed-top #btnSave .lbl { display: none; }
}

/* KPI cards are shortcuts to the list */
.kpi[data-f] { cursor: pointer; transition: transform .18s, box-shadow .18s, border-color .18s; user-select: none; }
.kpi[data-f]:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: transparent; }
.kpi[data-f]:active { transform: translateY(-1px); }
.kpi.on { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring), var(--shadow); }
.kpi-go { position: absolute; right: 14px; top: 12px; width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center;
  color: var(--brand); background: var(--brand-soft); opacity: 0; transform: translateX(-4px); transition: .18s; }
.kpi-go svg.i { width: 14px; height: 14px; }
.kpi[data-f]:hover .kpi-go, .kpi.on .kpi-go { opacity: 1; transform: none; }
.kpi .ring + .kpi-go { display: none; }
.list-card { scroll-margin-top: 20px; }
.list-card.pulse { animation: listpulse 1.1s ease; }
@keyframes listpulse { 0% { box-shadow: 0 0 0 0 var(--brand-ring), var(--shadow); } 40% { box-shadow: 0 0 0 6px var(--brand-ring), var(--shadow); } 100% { box-shadow: var(--shadow); } }

/* when each manuscript was formatted */
.ri-date { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.ri-date svg.i { width: 12px; height: 12px; }
.ri-date.up { color: var(--faint); }
.sort-by { margin-left: auto; position: relative; display: inline-flex; align-items: center; }
.sort-by svg.i { position: absolute; left: 11px; width: 14px; height: 14px; color: var(--muted); pointer-events: none; }
.sort-by select { height: 34px; width: auto; padding-left: 32px; font-size: 12.5px; font-weight: 700; color: var(--ink-2); border-radius: 10px; background-color: var(--surface); }
.sort-by + .check-all { margin-left: 6px; }

/* public demo notice */
.demo-bar { display: flex; align-items: center; gap: 10px; padding: 9px 22px; font-size: 13px; color: var(--ink-2);
  background: var(--brand-soft); border-bottom: 1px solid var(--line); }
.demo-bar svg.i { width: 15px; height: 15px; color: var(--brand); }
.demo-bar span { flex: 1; min-width: 0; }
.demo-bar a { font-weight: 700; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.demo-bar a svg.i { width: 14px; height: 14px; }
@media (max-width: 860px) { .demo-bar span { font-size: 12px; } .demo-bar a { display: none; } }

/* backups list */
.backups td { vertical-align: middle; padding: 8px 0; }
.backups td:first-child { width: auto; font-weight: 600; }

/* publisher settings */
.logo-prev { width: 64px !important; aspect-ratio: 1 !important; background: #fff; }
.logo-prev img { object-fit: contain !important; padding: 6px; }
.color-in { padding: 4px; height: 42px; cursor: pointer; }

.sample-link { font-weight: 700; color: var(--brand); position: relative; z-index: 2; }
.sample-link:hover { text-decoration: underline; }
.try-card { margin-bottom: 20px; background: var(--brand-soft); }

/* super admin */
.kpi b small.unit { font-size: 14px; font-weight: 700; color: var(--muted); letter-spacing: 0; }
.acct-list { display: flex; flex-direction: column; }
.acct-row { display: grid; grid-template-columns: minmax(0, 2.2fr) 52px 150px 100px 70px 90px 140px 170px; align-items: center; gap: 14px;
  padding: 13px 20px; border-bottom: 1px solid var(--line-2); }
.acct-row:last-child { border-bottom: 0; }
.acct-row:not(.head):hover { background: var(--surface-2); }
.acct-row.head { padding-top: 14px; padding-bottom: 10px; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.acct-row .num { font-weight: 700; font-variant-numeric: tabular-nums; }
.acct-row .num small, .usage-grid b small { color: var(--muted); font-weight: 600; }
.acct-row .acts { display: flex; justify-content: flex-end; gap: 6px; }
.acct-row .acts form { margin: 0; }
.acct-name { display: flex; align-items: center; gap: 12px; min-width: 0; color: var(--ink); }
.acct-name:hover b { color: var(--brand); }
.acct-id { display: flex; flex-direction: column; min-width: 0; }
.acct-id b { font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acct-id small { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar { width: 38px; height: 38px; border-radius: 11px; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 15px; flex: none; }
.avatar.sm { width: 32px; height: 32px; border-radius: 9px; font-size: 13px; }
.grid.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.creds { margin-bottom: 20px; border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }
.creds-box { display: grid; gap: 8px; padding: 14px 16px; margin-bottom: 14px; border-radius: var(--r); background: var(--brand-soft); }
.creds-box div { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 10px; align-items: baseline; }
.creds-box span { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.creds-box b { font-family: var(--mono); font-size: 14px; word-break: break-all; }
.user-list { display: flex; flex-direction: column; margin: -4px 0 16px; }
.user-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.user-row .acct-id { flex: 1; }
.user-row form { margin: 0; }
.user-row.off { opacity: .55; }
.add-user { padding-top: 4px; }
.usage-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.usage-grid div { padding: 12px 14px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line-2); }
.usage-grid span { display: block; font-size: 12px; font-weight: 700; color: var(--muted); }
.usage-grid b { display: block; font-size: 22px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.usage-grid b.sm { font-size: 14.5px; letter-spacing: 0; word-break: break-all; }
.usage-last { display: flex; align-items: center; gap: 7px; margin: 14px 0 0; font-size: 13px; }
.usage-last svg.i { width: 15px; height: 15px; }
.access-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.access-row > div:first-child { display: flex; flex-direction: column; }
.access-row small { color: var(--muted); font-size: 12.5px; }
.access-row form { margin: 0; }
.danger-card .card-head .ico { background: var(--err-soft); color: var(--err); }
.eyebrow a { display: inline-flex; align-items: center; gap: 6px; }
.ph-actions form { margin: 0; }
.inside-bar { background: var(--accent); color: #fff; border-bottom-color: transparent; }
.inside-bar svg.i, .inside-bar a { color: #fff; }
.side-foot .theme .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot .theme.on { background: var(--brand-soft); color: var(--brand-ink); }
.blocked { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.blocked-card { max-width: 480px; padding: 34px 32px; text-align: center; }
.blocked-card .brand { justify-content: center; padding: 0 0 22px; }
.blocked-card h1 { font-size: 24px; margin-bottom: 10px; }
.blocked-card .ph-actions { justify-content: center; margin-top: 20px; }
@media (max-width: 1100px) {
  .acct-row { grid-template-columns: minmax(0, 1fr) 52px 140px 90px 150px; }
  .acct-row > :nth-child(5), .acct-row > :nth-child(6), .acct-row > :nth-child(7) { display: none; }
}
@media (max-width: 700px) {
  .acct-row { grid-template-columns: minmax(0, 1fr) auto auto; }
  .acct-row > :nth-child(4), .acct-row.head { display: none; }
  .acct-row .acts { grid-column: 1 / -1; justify-content: flex-start; }
  .grid.g3 { grid-template-columns: 1fr; }
}
.row-switch { display: inline-flex; cursor: pointer; }
.row-switch input { appearance: none; width: 38px; height: 22px; border-radius: 30px; background: var(--surface-3); border: 1px solid var(--line); position: relative; transition: .2s; cursor: pointer; margin: 0; }
.row-switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: .2s; }
.row-switch input:checked { background: var(--brand); border-color: var(--brand); }
.row-switch input:checked::after { transform: translateX(16px); }
.row-switch input:disabled { opacity: .5; }
.acct-row.is-off .acct-name, .acct-row.is-off .num { opacity: .55; }
.admin-list { display: flex; flex-direction: column; margin: -4px 0 16px; }
.login-alt { margin: 18px 0 0; text-align: center; font-size: 13.5px; color: var(--muted); }
.login-alt a { font-weight: 700; }
.nav-count.new { background: var(--accent); color: #fff; }
.pending-card { margin-bottom: 20px; border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }.req { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line-2); flex-wrap: wrap; }
.req:first-child { border-top: 0; padding-top: 0; }
.req-who { display: flex; align-items: flex-start; gap: 12px; min-width: 0; flex: 1 1 240px; }   /* (own line on phones) */
.req-who .acct-id small { white-space: normal; }
.req-msg { display: block; margin-top: 4px; font-size: 13px; color: var(--ink-2); font-style: italic; }
.req-acts { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0; }
.req-acts select, .req-acts input { height: 32px; width: auto; font-size: 12.5px; border-radius: 8px; }
.req-acts input[type=number] { width: 70px; }
.signup-form { width: 100%; max-width: 420px; }
.signup-form .grid { gap: 12px; }
.signup-done { text-align: center; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* top bar: notifications, dark mode, user menu */
.topbar { display: flex; justify-content: flex-end; align-items: center; max-width: 1320px; margin: 0 auto; padding: 14px 40px 0; position: relative; z-index: 45; }
.tb-right { display: flex; align-items: center; gap: 6px; }
.tb-menu { position: relative; }
.tb-icon { position: relative; width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 12px; background: transparent; color: var(--ink-2); cursor: pointer; transition: background .15s, color .15s; }
.tb-icon:hover, .tb-icon.open { background: var(--surface-3); color: var(--ink); }
.tb-icon svg.i { width: 20px; height: 20px; }
.tb-icon .t-dark { display: none; } :root[data-theme="dark"] .tb-icon .t-light { display: none; } :root[data-theme="dark"] .tb-icon .t-dark { display: inline; }
.tb-icon .t-light, .tb-icon .t-dark { line-height: 0; }
.tb-badge { position: absolute; top: 4px; right: 3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 20px; background: var(--err); color: #fff; font: 800 10.5px/18px var(--font); font-style: normal; text-align: center; box-shadow: 0 0 0 2px var(--bg); }
.tb-user { display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 10px 0 6px; margin-left: 6px; border: 0; border-radius: 14px; background: transparent; color: var(--ink); cursor: pointer; text-align: left; transition: background .15s; }
.tb-user:hover, .tb-user.open { background: var(--surface-3); }
.tb-user .avatar { width: 36px; height: 36px; border-radius: 50%; font-size: 13.5px; }
.tb-who { display: flex; flex-direction: column; line-height: 1.25; max-width: 200px; }
.tb-who b { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-who small { font-size: 12px; color: var(--muted); font-weight: 600; }
.tb-user svg.i { width: 16px; height: 16px; color: var(--muted); transition: transform .2s; }
.tb-user.open svg.i { transform: rotate(180deg); }
.tb-pop { position: absolute; right: 0; top: calc(100% + 8px); width: 260px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: 6px; animation: rise .16s both; }
.notes-pop { width: 330px; }
.tb-pop-head { display: flex; flex-direction: column; padding: 10px 12px 8px; border-bottom: 1px solid var(--line-2); margin-bottom: 4px; }
.tb-pop-head b { font-size: 14px; } .tb-pop-head small { color: var(--muted); font-size: 12.5px; word-break: break-all; }
.tb-pop > a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: var(--ink-2); font-weight: 600; font-size: 13.5px; }
.tb-pop > a:hover { background: var(--surface-3); color: var(--ink); }
.tb-pop > a.danger { color: var(--err); } .tb-pop > a.danger:hover { background: var(--err-soft); }
.tb-pop > a svg.i { width: 16px; height: 16px; }
.note-item { align-items: flex-start !important; line-height: 1.4; }
.note-ico { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex: none; }
.note-empty { display: flex; align-items: center; gap: 8px; padding: 14px 12px; color: var(--muted); font-size: 13.5px; }
.note-empty svg.i { width: 16px; height: 16px; color: var(--brand); }
.note-txt small { display: flex; align-items: center; gap: 5px; margin-top: 3px; color: var(--brand); font-size: 12.5px; font-weight: 700; }
.note-txt small svg.i { width: 13px; height: 13px; }
.side-only, .demo-bar.phone-only { display: none !important; }
@media (max-width: 860px) {
  .topbar { display: none; }
  .side-only, .demo-bar.phone-only { display: flex !important; }
}
/* house style: the publisher's own rules */
.own-rules { margin-top: 6px; padding-top: 14px; border-top: 1px solid var(--line-2); }
.own-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.own-head b { display: block; font-size: 14px; } .own-head small { color: var(--muted); font-size: 12.5px; }
.rule-list { display: flex; flex-direction: column; gap: 6px; }
.rule-row { display: flex; align-items: center; gap: 8px; padding: 9px 10px 9px 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); }
.rule-row.off .rule-desc { opacity: .5; }
.rule-desc { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rule-desc b { font-size: 13.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rule-desc small { color: var(--muted); font-size: 12px; }
.rule-empty { color: var(--muted); font-size: 13px; padding: 4px 0; }
.rule-opts { display: flex; gap: 18px; flex-wrap: wrap; }
.rule-preview { min-height: 22px; font-size: 13.5px; line-height: 1.5; }
.rule-preview span { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 2px; }
.rule-preview mark { background: var(--brand-soft); color: var(--brand-ink); border-radius: 4px; padding: 0 2px; }
.rule-preview .rule-row { margin-top: 6px; background: var(--brand-soft); border-color: transparent; }
.rule-err { padding: 10px 12px; border-radius: var(--r); background: var(--warn-soft); color: var(--warn); font-size: 13px; font-weight: 600; }
.btn.busy { opacity: .6; pointer-events: none; }
.ask-ai { margin-top: 8px; }
/* author proof: the author's page, the publisher's link card and review page */
.proof-bar { display: flex; gap: 12px; align-items: flex-start; margin: 16px 28px 0; padding: 12px 16px; border-radius: var(--r-lg); background: var(--brand-soft); color: var(--ink-2); font-size: 13.5px; line-height: 1.55; }
.proof-bar > svg.i { width: 18px; height: 18px; color: var(--brand); flex: none; margin-top: 2px; }
.proof-bar #proofState { display: block; margin-top: 4px; font-weight: 700; color: var(--brand); }
.proof-bar #proofState:empty { display: none; }
.proof-make { display: grid; grid-template-columns: minmax(0, 1fr) 150px auto; gap: 12px; align-items: end; }
.proof-link { display: flex; gap: 10px; margin-bottom: 12px; }
.proof-link input { flex: 1; min-width: 0; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); color: var(--ink); font: 600 13px var(--font); }
.proof-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-bottom: 14px; font-size: 13px; color: var(--muted); }
.proof-msg { margin-bottom: 14px; padding: 12px 14px; border-left: 3px solid var(--brand); border-radius: var(--r-sm); background: var(--brand-soft); }
.proof-msg b { font-size: 13px; } .proof-msg p { margin: 4px 0 0; white-space: pre-wrap; font-size: 13.5px; }
.chip-link { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 20px; background: var(--brand-soft); color: var(--brand); font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.chip-link svg.i { width: 14px; height: 14px; }
.dot-new { display: inline-block; width: 7px; height: 7px; margin-left: 4px; border-radius: 50%; background: var(--err); vertical-align: middle; }
.chg-all { margin-left: auto; }
.chg-list { display: flex; flex-direction: column; gap: 10px; }
.chg { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r); cursor: pointer; }
.chg:hover { border-color: var(--brand-ring); }
.chg input { margin-top: 3px; flex: none; }
.chg b { display: block; font-size: 13.5px; }
.chg-note { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.chg-diff { margin-top: 6px; font: 15px/1.55 "EB Garamond", Georgia, serif; color: var(--ink); white-space: pre-wrap; word-break: break-word; }
.chg-diff del { color: var(--err); text-decoration: line-through; background: var(--err-soft); }
.chg-diff ins { color: var(--brand-ink); text-decoration: none; background: var(--brand-soft); font-weight: 600; }
.chg-pic { display: block; max-width: 280px; max-height: 200px; margin-top: 8px; border: 1px solid var(--line); border-radius: var(--r-sm); }
.empty-note { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.empty-note svg.i { color: var(--brand); }
@media (max-width: 860px) {
  .proof-bar { margin: 12px 16px 0; }
  .proof-make { grid-template-columns: 1fr; }
  .proof-link { flex-direction: column; }
  #btnSend { padding: 0 12px; }
}
.proof-meta:last-child, .proof-msg:last-child { margin-bottom: 0; }
.chg-diff del + ins { display: inline-block; margin-top: 4px; }
/* author comments: under a paragraph / title-page field, on the review page */
.cmts { display: flex; flex-direction: column; gap: 6px; }
.cmts:not(:empty) { margin-top: 8px; }
.cmt { display: flex; gap: 10px; align-items: flex-start; padding: 9px 12px; border-radius: var(--r); border: 1px solid var(--brand-ring); background: var(--brand-soft); font: 500 13px/1.5 var(--font); color: var(--ink); }
.cmt.done { opacity: .6; background: var(--surface-2); border-color: var(--line); }
.cmt-ico { color: var(--brand); flex: none; line-height: 0; margin-top: 2px; } .cmt-ico svg.i { width: 15px; height: 15px; }
.cmt-body { flex: 1; min-width: 0; }
.cmt-body p { margin: 0; white-space: pre-wrap; word-break: break-word; }
.cmt-body small { color: var(--muted); font-size: 11.5px; font-weight: 600; }
.cmt q, .cmt-new q { display: block; margin-bottom: 3px; font: italic 14px/1.4 "EB Garamond", Georgia, serif; color: var(--ink-2); }
.cmt q::before, .cmt-new q::before { content: "“"; } .cmt q::after, .cmt-new q::after { content: "”"; }
.cmt-act { display: flex; gap: 4px; flex: none; }
.cmt-act button:not(.btn) { width: 28px; height: 28px; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; }
.cmt-act button:not(.btn):hover { background: var(--surface); color: var(--ink); }
.cmt-act svg.i { width: 14px; height: 14px; }
.cmt-new { display: grid; gap: 8px; padding: 10px 12px; border: 1px dashed var(--brand); border-radius: var(--r); background: var(--surface); }
.cmt-new textarea { width: 100%; min-height: 56px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); font: 500 13.5px/1.5 var(--font); resize: vertical; }
.cmt-row { display: flex; gap: 8px; }
.cmt-btn { color: var(--brand) !important; }
.cmt-add { display: inline-grid; place-items: center; width: 22px; height: 22px; margin-left: 6px; padding: 0; border: 0; border-radius: 6px; background: var(--brand-soft); color: var(--brand); cursor: pointer; vertical-align: middle; }
.cmt-add svg.i { width: 12px; height: 12px; }
.field .cmts { font-weight: 500; }
#fmtbar .fb-cmt { display: inline-flex; align-items: center; gap: 5px; width: auto; padding: 0 10px; color: #fff; font-weight: 700; border-left: 1px solid rgba(255, 255, 255, .2); border-radius: 0 8px 8px 0; }
#fmtbar .fb-cmt svg.i { width: 14px; height: 14px; }
.cmt-count { display: inline-flex; align-items: center; gap: 5px; color: var(--brand); font-weight: 700; }
.cmt-count svg.i { width: 14px; height: 14px; }
.proof-bar svg.i { vertical-align: -2px; }
.cmt-rv { display: flex; gap: 14px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r); }
.cmt-rv.done { opacity: .6; }
.cmt-rv-main { flex: 1; min-width: 0; }
.cmt-rv-main > b { display: block; font-size: 13.5px; }
.cmt-rv .chg-diff mark { background: #FFE58F; color: inherit; padding: 0 2px; border-radius: 3px; }
:root[data-theme="dark"] .cmt-rv .chg-diff mark { background: rgba(255, 214, 102, .35); }
.cmt-rv-text { display: flex; gap: 8px; align-items: flex-start; margin: 8px 0 2px; padding: 8px 12px; border-radius: var(--r-sm); background: var(--brand-soft); font-weight: 600; font-size: 13.5px; white-space: pre-wrap; }
.cmt-rv-text svg.i { width: 15px; height: 15px; color: var(--brand); flex: none; margin-top: 2px; }
/* proof link mode: edit and comment / comments only */
.proof-make { grid-template-columns: minmax(0, 1fr) 150px; }
.proof-make .span-all { grid-column: 1 / -1; }
.proof-make > .btn { justify-self: start; }
.mode-tag { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; color: var(--ink-2); }
.mode-tag svg.i { width: 14px; height: 14px; color: var(--brand); }
.role-ro { display: inline-flex; align-items: center; height: 24px; padding: 0 8px; border-radius: 6px; background: var(--surface-3); color: var(--ink-2); font-size: 11.5px; font-weight: 700; }
#fmtbar.cmt-only button[data-cmd] { display: none; }
#fmtbar.cmt-only .fb-cmt { border-left: 0; border-radius: 8px; }
.r-body .role-ro, .r-ref .role-ro, .r-list .role-ro { display: none; }

/* content tab: document view - the text on one page, as in Word */
.blocks-bar { flex-wrap: wrap; }
.seg.sm { padding: 3px; border-radius: 10px; }
.seg.sm button { padding: 5px 11px; font-size: 12px; border-radius: 8px; }
.seg.sm button svg { width: 14px; height: 14px; }
.dvbar { position: sticky; top: var(--edtop, 71px); z-index: 20; display: flex; align-items: center; gap: 2px; flex-wrap: wrap; padding: 5px 6px; margin-bottom: 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-sm); }
.dvbar select { width: auto; min-width: 190px; height: 34px; font-size: 13px; font-weight: 700; color: var(--ink); border-radius: 8px; }
.dvbar select:disabled { opacity: .5; cursor: default; }
.dvbar button { border: 0; background: none; min-width: 34px; height: 34px; border-radius: 8px; cursor: pointer; color: var(--ink-2); font: 600 14px var(--font); display: inline-grid; place-items: center; }
.dvbar button:hover { background: var(--surface-3); color: var(--ink); }
.dvbar button:disabled { opacity: .35; cursor: default; background: none; }
.dvbar button svg { width: 16px; height: 16px; }
.dvbar .sep { width: 1px; height: 22px; background: var(--line); margin: 0 5px; }
.docv { padding: 34px 44px 56px 156px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow);
  font-family: var(--serif); font-size: 16.5px; line-height: 1.6; color: var(--paper-ink); outline: none; min-height: 50vh; caret-color: var(--brand); }
.docv > p { position: relative; margin: 0 0 9px; text-align: justify; }
.docv > p::before { content: attr(data-label); position: absolute; right: calc(100% + 16px); top: .5em; width: 118px; text-align: right; pointer-events: none; user-select: none;
  font: 800 9.5px/1.25 var(--font); letter-spacing: .07em; text-transform: uppercase; font-style: normal; color: var(--rc, var(--muted)); text-indent: 0; }
.docv > p.r-h1, .docv > p.r-ref_head { font-weight: 700; text-transform: uppercase; text-align: left; margin-top: 24px; }
.docv > p.r-h2 { font-weight: 700; text-align: left; margin-top: 20px; }
.docv > p.r-h3 { font-weight: 700; font-style: italic; text-align: left; margin-top: 16px; }
.docv > p.r-h1 + p.r-h2, .docv > p.r-h1 + p.r-h3, .docv > p.r-h2 + p.r-h3, .docv > p.r-h2 + p.r-h2, .docv > p:first-child { margin-top: 0; }
.docv > p.r-caption_table, .docv > p.r-caption_figure { font-weight: 700; text-align: left; font-size: 15.5px; margin-top: 16px; }
.docv > p.r-note { font-style: italic; font-size: 14.5px; }
.docv > p.r-quote { padding: 0 14px 0 30px; }
.docv > p.r-list { padding-left: 24px; }
.docv > p.r-list::after { content: "•"; position: absolute; left: 8px; top: 0; color: var(--muted); pointer-events: none; }
.docv > p.r-ref { padding-left: 26px; text-indent: -26px; text-align: left; font-size: 15.5px; }
.docv > p.r-equation { text-align: center; }
.docv > p.r-skip { text-decoration: line-through; }
.docv:not(.show-skip) > p.r-skip, .docv:not(.show-skip) > .dv-obj:has(> .r-skip) { display: none; }
.docv .dv-obj { margin: 14px 0; font-family: var(--font); font-size: 14px; line-height: 1.45; text-align: left; }
.docv .dv-obj > .blk { background: var(--surface-2); box-shadow: 0 0 0 1px var(--line-2); }
.docv .dv-side { margin: -2px 0 12px; font-family: var(--font); font-size: 13.5px; line-height: 1.45; text-align: left; }
@media (max-width: 860px) {
  .docv { padding: 22px 18px 40px; font-size: 16px; }
  .docv > p::before { display: none; }
  .dvbar select { flex: 1 1 100%; min-width: 0; margin-bottom: 2px; }
  .dvbar select + .sep { display: none; }
}

/* content tab: the author's comments, one after another */
.cmt-nav { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--brand-ink); background: var(--brand-soft); border-radius: 20px; padding: 3px 4px 3px 12px; }
.cmt-nav > svg { width: 14px; height: 14px; }
.cmt-nav .icon-btn.sm { width: 26px; height: 26px; border-radius: 50%; }
.cmt-nav .icon-btn.sm svg { width: 14px; height: 14px; }
#cmtPrev svg { transform: rotate(180deg); }
.cmt.flash { animation: cmtflash 1.8s ease-out; }
@keyframes cmtflash { 0%, 35% { box-shadow: 0 0 0 3px var(--brand); } 100% { box-shadow: 0 0 0 0 transparent; } }
.cmt-nav a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

/* ------------------------------------------------------------------ layouts (Layouts page and the layout editor) */
.lay-assign { margin-bottom: 26px; }
.lay-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 0; border-top: 1px solid var(--line-2); }
.lay-row:first-child { border-top: 0; padding-top: 0; }
.lay-row > div { display: flex; align-items: center; gap: 10px; min-width: 0; }
.lay-row > div b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lay-row select { width: 260px; max-width: 46%; flex: none; }
.lay-default > div { flex-direction: column; align-items: flex-start; gap: 2px; }
.lay-default small { color: var(--muted); font-size: 12.5px; }
.lay-h { font-size: 17px; margin: 4px 0 12px; }
.lay-note { color: var(--muted); font-size: 13px; margin: -6px 0 14px; }
.lay-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; margin-bottom: 30px; }
.lay-card { display: flex; flex-direction: column; overflow: hidden; animation: rise .35s both; }
.lay-thumb { position: relative; display: block; aspect-ratio: 210 / 297; background: var(--surface-3); overflow: hidden; border-bottom: 1px solid var(--line); }
.lay-thumb::before { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .55) 50%, transparent 70%); background-size: 220% 100%; animation: shimmer 1.4s linear infinite; }
.lay-thumb.ready::before { display: none; }
.lay-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; background: #fff; transition: transform .4s; }
.lay-card:hover .lay-thumb img { transform: scale(1.03); }
.lay-thumb .jtag { position: absolute; top: 10px; left: 10px; background: rgba(20, 32, 51, .8); color: #fff; }
@keyframes shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }
.lay-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.lay-body b { font-size: 14px; }
.lay-body small { color: var(--muted); font-size: 12px; line-height: 1.4; }
.lay-users { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.lay-users .none, .lay-users .more { font-size: 11.5px; color: var(--faint); font-weight: 600; }
.lay-acts { display: flex; gap: 6px; margin-top: auto; padding-top: 8px; flex-wrap: wrap; }
.lay-acts form { display: contents; }
.danger-text { color: var(--err); }
.warn-text { color: var(--warn); }
#laySave.pulse { box-shadow: 0 0 0 4px var(--brand-ring); }

.lay-ed { display: grid; grid-template-columns: minmax(330px, 430px) minmax(0, 1fr); gap: 20px; align-items: start; }
.lay-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.lay-meta { display: flex; flex-direction: column; gap: 12px; }
.lay-meta-row { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.lay-start { flex: 1; min-width: 160px; }
.lay-group { overflow: hidden; }
.lay-group summary { list-style: none; display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; cursor: pointer; user-select: none; }
.lay-group summary::-webkit-details-marker { display: none; }
.lay-group summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .2s; margin-right: 4px; }
.lay-group[open] summary::after { transform: rotate(-135deg); }
.lay-group summary b { font-size: 14.5px; }
.lay-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; padding: 0 18px 18px; }
.lay-f { min-width: 0; }
.lay-f[hidden] { display: none; }
.lay-f.lay-choice, .lay-f.lay-font, .lay-f.lay-bool, .lay-f.lay-color { grid-column: 1 / -1; }
.lay-f .switch { padding: 6px 0; border-top: 0; }
.lay-help { display: block; color: var(--muted); font-size: 11.5px; margin-top: 4px; }
.lay-num { position: relative; }
.lay-num input { width: 100%; padding-right: 40px; }
.lay-num em { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-style: normal; font-size: 12px; color: var(--muted); pointer-events: none; }
.lay-color { display: flex; align-items: center; gap: 10px; }
.lay-color input[type="color"] { width: 46px; height: 34px; padding: 2px; flex: none; }
.lay-color code { font-size: 12px; }
.lay-area { grid-column: 1 / -1; margin: 0; padding: 9px 12px; border-radius: var(--r-sm); background: var(--surface-2); color: var(--ink-2); font-size: 12.5px; }
.font-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.font-row { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); }
.font-row b { font-size: 15px; } .font-row small { color: var(--muted); margin-right: auto; }
#fontPick { cursor: pointer; }

.lay-prev { position: sticky; top: 16px; display: flex; flex-direction: column; overflow: hidden; height: calc(100vh - 140px); min-height: 520px; }
.lay-prev-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.lay-prev-bar select { height: 34px; font-size: 13px; max-width: 320px; }
.lay-prev-bar #layJournal { width: 110px; }
.lay-state { font-size: 12.5px; color: var(--muted); margin-left: auto; }
.lay-state.bad { color: var(--err); font-weight: 600; }
.lay-frame { position: relative; flex: 1; background: #525659; }
.lay-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.lay-wait { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 20px; background: rgba(20, 32, 51, .85); color: #fff; font-size: 12.5px; font-weight: 600; }
.lay-wait[hidden] { display: none; }
.lay-hint { margin: 0; padding: 8px 14px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); }
@media (max-width: 1100px) {
  .lay-ed { grid-template-columns: minmax(0, 1fr); }
  .lay-prev { position: static; height: 78vh; min-height: 0; order: -1; }
}
@media (max-width: 520px) {
  .lay-fields { grid-template-columns: minmax(0, 1fr); }
  .lay-row { flex-direction: column; align-items: stretch; }
  .lay-row select { width: 100%; max-width: none; }
  .lay-prev { height: 70vh; }
}

/* layouts: Import from PDF */
.lay-imp { border-color: var(--brand-ring); }
.lay-imp.fresh { animation: listpulse 1.4s ease 2; }
.lay-imp-head { display: flex; gap: 14px; align-items: center; margin-bottom: 8px; }
.lay-imp-head small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.lay-score { flex: none; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font: 800 18px var(--font);
  color: var(--ok); background: var(--ok-soft); border: 3px solid currentColor; }
.lay-score.ok { color: var(--warn); background: var(--warn-soft); }
.lay-score.low { color: var(--err); background: var(--err-soft); }
.lay-imp details { margin-top: 8px; border-top: 1px solid var(--line-2); padding-top: 8px; }
.lay-imp summary { cursor: pointer; font-weight: 700; font-size: 13px; }
.lay-rep { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; max-height: 320px; overflow: auto; }
.lay-rep li { display: grid; grid-template-columns: 18px 150px minmax(0, 1fr); gap: 8px; font-size: 12.5px; align-items: baseline; }
.lay-rep li i { font-style: normal; font-weight: 800; text-align: center; }
.lay-rep li.found i { color: var(--ok); } .lay-rep li.close i { color: var(--warn); } .lay-rep li.guess i { color: var(--warn); }
.lay-rep li.missing i { color: var(--err); }
.lay-rep li span { color: var(--ink-2); word-break: break-word; }
.lay-rep li.wide span { grid-column: 2 / -1; }
.lay-ai-ico { flex: none; width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; color: var(--brand);
  background: var(--brand-soft); }
.lay-ai-ico .i { width: 26px; height: 26px; }
.lay-ai-sum { margin: 6px 0 0; font-size: 13px; line-height: 1.5; color: var(--ink-2); }
.lay-ai form { margin-top: 10px; }
.ai-wait { max-width: 460px; }
#setupForm .cover-drop { margin-bottom: 10px; padding: 10px 14px; }
#setupForm .cover-drop .cover-prev { width: 40px; font-size: 11px; }
.setup-ai { display: flex; gap: 10px; align-items: flex-start; margin-top: 6px; font-size: 13.5px; color: var(--ink-2); cursor: pointer; }
.setup-ai input { margin-top: 3px; flex: none; }
.setup-ai em { color: var(--muted); }
.setup-first { border-color: var(--accent, #4f46e5); }
.setup-first .lay-help { margin: 10px 0 0; }
.map-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 6px 0 8px; font-size: 12px; color: var(--ink-2); }
.map-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.map-img { display: block; width: 100%; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; }
.map-list li i { font-size: 11px; }
.lay-code { max-height: 320px; overflow: auto; margin: 8px 0 0; padding: 10px; border-radius: 8px; background: var(--surface-3);
  font: 11.5px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre; }
.ai-mark { display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; font-style: normal; font-size: 12px; font-weight: 600;
  color: var(--brand-ink); background: var(--brand-soft); border-radius: 6px; padding: 2px 7px; }
.ai-mark .i { width: 13px; height: 13px; }
small + .ai-mark, select + .ai-mark { display: flex; width: fit-content; }
.ai-result { border-color: var(--brand-ring); margin-bottom: 18px; }
.ai-result .card-head p { white-space: normal; }
.ai-todo { margin: 0 0 8px; font-size: 13.5px; line-height: 1.6; }
.ai-read { margin-bottom: 18px; }
.ai-read-form { display: grid; gap: 12px; }
.save-bar .btn.pulse { animation: listpulse 1.4s ease 3; }
.ai-step { display: flex; align-items: center; gap: 10px; margin: 4px 0 10px; }
.lay-frame.both iframe { width: 50%; }
.lay-frame.both #layTheirs { left: 50%; }
.lay-f textarea { width: 100%; resize: vertical; font: inherit; font-size: 13px; }
.lay-f.lay-longtext { grid-column: 1 / -1; }
@media (max-width: 520px) { .lay-rep li { grid-template-columns: 18px minmax(0, 1fr); } .lay-rep li span { grid-column: 2; } }
