/* 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;
  --grad: linear-gradient(135deg, #5B4CF5 0%, #8C56F4 50%, #E46BA0 100%);
  --grad-hover: linear-gradient(135deg, #4F40EE 0%, #7F48EC 50%, #DA5C94 100%);

  --bg: #F4F5FA;
  --bg-art: radial-gradient(1100px 520px at 100% -8%, rgba(140, 86, 244, .10), transparent 62%),
            radial-gradient(800px 420px at -6% 104%, rgba(228, 107, 160, .07), transparent 60%);
  --surface: #FFFFFF; --surface-2: #F8F9FC; --surface-3: #F0F1F7; --overlay: rgba(255, 255, 255, .78);
  --ink: #11132A; --ink-2: #3A3E5B; --muted: #6D7290; --faint: #A4A8C2;
  --line: #E4E6F0; --line-2: #EEF0F6;
  --brand: #5B4CF5; --brand-ink: #4436D9; --brand-soft: #EFEDFF; --brand-ring: rgba(91, 76, 245, .22);
  --ok: #0A946A; --ok-soft: #E2F6EE; --warn: #A86300; --warn-soft: #FFF2DB; --warn-line: #F6DDAE;
  --err: #DC3D45; --err-soft: #FFEBEC; --run: #2E6BFF; --run-soft: #E8EFFF; --stale: #8C56F4; --stale-soft: #F3ECFF;
  --shadow-sm: 0 1px 2px rgba(17, 19, 42, .06);
  --shadow: 0 1px 2px rgba(17, 19, 42, .04), 0 10px 30px -10px rgba(17, 19, 42, .12);
  --shadow-lg: 0 30px 70px -20px rgba(17, 19, 42, .35), 0 2px 6px rgba(17, 19, 42, .06);
  --paper: #FFFFFF; --paper-ink: #1E1E24; --paper-line: #E8E8EE;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0A0C17;
  --bg-art: radial-gradient(1100px 520px at 100% -8%, rgba(140, 86, 244, .16), transparent 62%),
            radial-gradient(800px 420px at -6% 104%, rgba(228, 107, 160, .08), transparent 60%);
  --surface: #121527; --surface-2: #161A2F; --surface-3: #1C2039; --overlay: rgba(18, 21, 39, .8);
  --ink: #ECEDF7; --ink-2: #BEC2DC; --muted: #8A8FAE; --faint: #5D6282;
  --line: #242944; --line-2: #1D2139;
  --brand: #8B7DFF; --brand-ink: #A79CFF; --brand-soft: rgba(139, 125, 255, .14); --brand-ring: rgba(139, 125, 255, .3);
  --ok: #3CCB98; --ok-soft: rgba(60, 203, 152, .13); --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: #6E9BFF; --run-soft: rgba(110, 155, 255, .14); --stale: #B593FF; --stale-soft: rgba(181, 147, 255, .14);
  --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: #171B31; --paper-ink: #E6E7F2; --paper-line: #272C48;
  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; filter: drop-shadow(0 6px 14px rgba(108, 76, 245, .35)); }
.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: 34px 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 { background: var(--ink); color: var(--surface); border-color: var(--ink); }
:root[data-theme="dark"] .btn.primary { background: var(--ink); color: #0A0C17; }
.btn.primary:hover { opacity: .9; }
.btn.grad { background: var(--grad); color: #fff; border: 0; box-shadow: 0 8px 22px -8px rgba(108, 76, 245, .7), inset 0 1px 0 rgba(255, 255, 255, .25); }
.btn.grad:hover { background: var(--grad-hover); box-shadow: 0 10px 26px -8px rgba(108, 76, 245, .85), inset 0 1px 0 rgba(255, 255, 255, .25); }
.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.c1 { background: linear-gradient(135deg, #6C5CFF, #8C56F4); box-shadow: 0 8px 18px -8px rgba(108, 92, 255, .8); }
.kpi-ico.c2 { background: linear-gradient(135deg, #12B886, #0CA678); box-shadow: 0 8px 18px -8px rgba(18, 184, 134, .8); }
.kpi-ico.c3 { background: linear-gradient(135deg, #FF8A4C, #F06595); box-shadow: 0 8px 18px -8px rgba(255, 138, 76, .8); }
.kpi-ico.c4 { background: linear-gradient(135deg, #3B82F6, #22B8CF); box-shadow: 0 8px 18px -8px rgba(59, 130, 246, .8); }
.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;
  box-shadow: 0 12px 24px -10px rgba(108, 76, 245, .9); 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: #11132A; 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: #22274A; border: 1px solid #323866; }
.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: #E3E4F5; 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: linear-gradient(135deg, #12B886, #0CA678); }
.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(17, 19, 42, .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: #11132A; 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: #262B50; }
.toast .ti { width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; flex: none; background: rgba(60, 203, 152, .2); color: #5BE3B0; }
.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; }
.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: #5B4CF5; } .r-h2, .r-h3 { --rc: #8C56F4; } .r-ref_head { --rc: #5B4CF5; }
.r-caption_table, .r-caption_figure { --rc: #E8890C; } .r-note { --rc: #E8890C; }
.r-table, .r-figure, .r-equation { --rc: #2E8BFF; } .r-list { --rc: #12B886; } .r-ref { --rc: #8A90AD; } .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; }
.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; }
.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: #11132A; 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(17, 19, 42, .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; box-shadow: 0 8px 18px -8px rgba(108, 76, 245, .8); }
.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: #0E0B2A; 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(600px 400px at 20% 20%, rgba(124, 92, 255, .65), transparent 60%),
  radial-gradient(520px 380px at 85% 70%, rgba(240, 114, 154, .5), transparent 60%), radial-gradient(500px 300px at 40% 100%, rgba(46, 107, 255, .45), 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; background: linear-gradient(90deg, #C9BFFF, #FFC2D9); -webkit-background-clip: text; background-clip: text; color: transparent; }
.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: #E3E2F2; }
.pages-art div i:first-child { height: 12px; background: linear-gradient(90deg, #6C5CFF, #F0729A); 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 in two tidy rows, short fields two per row */
@media (max-width: 860px) {
  .ed-top { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto auto; gap: 8px 10px; align-items: center; }
  .ed-top > .icon-btn { grid-column: 1; grid-row: 1; }
  .ed-top .ed-title { grid-column: 2 / span 3; grid-row: 1; }
  .ed-top .ed-title .ri-meta { flex-wrap: nowrap; white-space: nowrap; overflow: hidden; }
  .ed-top #statusChip { grid-column: 2; grid-row: 2; justify-self: start; }
  .ed-top #btnSave { grid-column: 3; grid-row: 2; }
  .ed-top #btnBuild { grid-column: 4; grid-row: 2; }
}
@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; }
}

/* 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; }

/* 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: linear-gradient(135deg, var(--brand-soft), var(--surface)); }
