/* ═══════════════════════════════════════════════════════════════
   ALAGANU PRESS · the system
   Same tokens as the landing page: navy ink, one red, hairlines,
   Schibsted Grotesk for the interface, Newsreader for titles.
   ═══════════════════════════════════════════════════════════════ */
:root {
  --paper: #ffffff;
  --ink: #0a3a6b;
  --ink-2: #2c4a63;
  --ink-3: #50708c;
  --rule: #0a3a6b;
  --rule-soft: #c8d7e5;
  --wash: #eef4f9;
  --red: #e3261f;
  --red-dk: #b61a15;
  --ok: #0a7a3d;
  --warn: #9a5b00;
  --font: 'Schibsted Grotesk', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body { font-family: var(--font); background: var(--paper); color: var(--ink); line-height: 1.5; min-height: 100vh; }
a { color: inherit; }
::selection { background: var(--red); color: #fff; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.serif { font-family: var(--serif); }
.muted { color: var(--ink-3); }
.small { font-size: 0.88rem; }
.tn { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* wordmark */
.wordmark { display: inline-flex; align-items: baseline; font-weight: 800; letter-spacing: 0.02em; font-size: 1.05rem; white-space: nowrap; text-decoration: none; direction: ltr; }
.wordmark .mark { height: 1.7em; width: auto; margin-inline-end: 0.5em; position: relative; top: 0.225em; }
.wordmark em { font-family: var(--serif); font-style: italic; font-weight: 500; letter-spacing: 0; margin-inline-start: 0.35em; font-size: 1.12em; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.6em; font: inherit; font-weight: 600; font-size: 0.92rem;
  padding: 11px 18px; border: 1px solid var(--ink); background: var(--ink); color: #fff; cursor: pointer; text-decoration: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s; white-space: nowrap; }
.btn:hover { background: var(--red); border-color: var(--red); }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.danger { background: transparent; color: var(--red-dk); border-color: var(--red-dk); }
.btn.danger:hover { background: var(--red-dk); color: #fff; }
.btn.sm { padding: 6px 11px; font-size: 0.82rem; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: 0.55; cursor: progress; }
.link { background: none; border: 0; font: inherit; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: 0; }
.link:hover { color: var(--red); }

/* forms */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.field label, .lbl { font-size: 0.74rem; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink); }
.field label small { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--ink-3); }
input[type='text'], input[type='email'], input[type='password'], input[type='number'], input[type='date'], input[type='search'], select, textarea {
  font: inherit; font-size: 0.98rem; color: var(--ink); background: #fff; border: 1px solid var(--rule-soft); border-radius: 0; padding: 10px 12px; width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(10, 58, 107, 0.12); }
textarea { resize: vertical; min-height: 110px; line-height: 1.5; }
.pw { position: relative; }
.pw input { padding-inline-end: 64px; }
.pw .toggle { position: absolute; inset-inline-end: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; font: inherit;
  font-size: 0.8rem; font-weight: 600; color: var(--ink-3); cursor: pointer; padding: 6px 8px; }
.pw .toggle:hover { color: var(--ink); }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 0.92rem; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--ink); }
.hint { font-size: 0.82rem; color: var(--ink-3); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.code-input { font-family: Consolas, Menlo, monospace; font-size: 1.5rem !important; letter-spacing: 0.35em; text-align: center; }

/* messages */
.msg { padding: 12px 14px; border: 1px solid; font-size: 0.92rem; margin-bottom: 18px; }
.msg.err { border-color: var(--red-dk); color: var(--red-dk); background: #fdf1f0; }
.msg.ok { border-color: var(--ok); color: var(--ok); background: #eef8f2; }
.msg.info { border-color: var(--rule-soft); color: var(--ink-2); background: var(--wash); }
.msg a, .msg button.link { color: inherit; }

/* ── auth pages ───────────────────────────────────────────────── */
.auth { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); min-height: 100vh; }
.auth-side { background: var(--ink); color: #fff; padding: 40px clamp(24px, 4vw, 56px); display: flex; flex-direction: column; justify-content: space-between; }
.auth-side .wordmark { color: #fff; }
.auth-side h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(2rem, 3.6vw, 3.2rem); line-height: 1.08; letter-spacing: -0.02em; }
.auth-side h2 em { color: #ff8a83; }
.auth-side p { color: rgba(255, 255, 255, 0.78); max-width: 42ch; margin-top: 18px; }
.auth-side .foot { font-size: 0.8rem; color: rgba(255, 255, 255, 0.6); }
.auth-side .foot a { color: #fff; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 20px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h1 { font-size: 1.9rem; letter-spacing: -0.03em; line-height: 1.1; margin-bottom: 8px; }
.auth-card .lede { color: var(--ink-2); margin-bottom: 26px; }
.auth-card .alt { margin-top: 22px; font-size: 0.92rem; color: var(--ink-2); text-align: center; }
.auth-card .alt a { font-weight: 600; }
.auth-version { position: fixed; inset-block-end: 10px; inset-inline-end: 14px; font-size: 0.75rem; color: var(--ink-3); }
.qr { display: block; width: 200px; height: 200px; border: 1px solid var(--rule-soft); margin: 6px 0 12px; }
.secret { font-family: Consolas, Menlo, monospace; font-size: 0.9rem; background: var(--wash); padding: 8px 10px; word-break: break-all; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; font-family: Consolas, Menlo, monospace; font-size: 1rem; background: var(--wash); padding: 14px 16px; margin: 10px 0 14px; }
.tabs { display: flex; border-bottom: 1px solid var(--rule-soft); margin-bottom: 20px; }
.tabs button { background: none; border: 0; font: inherit; font-weight: 600; font-size: 0.9rem; color: var(--ink-3); padding: 10px 14px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button[aria-selected='true'] { color: var(--ink); border-color: var(--red); }

/* ── app shell ────────────────────────────────────────────────── */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.nav { border-inline-end: 1px solid var(--rule); padding: 18px 0; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; background: #fff; }
.nav .wordmark { padding: 0 20px 18px; border-bottom: 1px solid var(--rule-soft); margin-bottom: 10px; }
.nav h6 { font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); padding: 14px 20px 6px; font-weight: 600; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 20px; font-size: 0.92rem; font-weight: 500; color: var(--ink-2); text-decoration: none; border-inline-start: 3px solid transparent; }
.nav a:hover { background: var(--wash); color: var(--ink); }
.nav a.on { color: var(--ink); border-color: var(--red); background: var(--wash); font-weight: 600; }
.nav .badge { margin-inline-start: auto; }
.nav .spacer { flex: 1; }
.nav .me { padding: 14px 20px; border-top: 1px solid var(--rule-soft); font-size: 0.85rem; }
.nav .me b { display: block; }
.nav .ver { padding: 4px 20px 0; font-size: 0.72rem; color: var(--ink-3); }
.main { min-width: 0; }
.topbar { display: none; }
.page { padding: 28px clamp(18px, 3vw, 40px) 60px; max-width: 1280px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; padding-bottom: 18px; border-bottom: 1px solid var(--rule); margin-bottom: 24px; }
.page-head h1 { font-size: clamp(1.6rem, 2.6vw, 2.2rem); letter-spacing: -0.03em; line-height: 1.1; }
.page-head .crumb { font-size: 0.78rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 6px; font-weight: 600; }
.page-head .crumb a { text-decoration: none; }
.label { font-size: 0.74rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; }
.label .sq { display: inline-block; width: 0.62em; height: 0.62em; background: var(--red); margin-inline-end: 0.6em; }

/* cards & stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); border-top: 1px solid var(--rule); border-inline-start: 1px solid var(--rule-soft); margin-bottom: 28px; }
.stat { padding: 18px; border-inline-end: 1px solid var(--rule-soft); border-bottom: 1px solid var(--rule-soft); }
.stat b { display: block; font-size: 2rem; font-weight: 800; letter-spacing: -0.04em; line-height: 1.1; }
.stat span { font-size: 0.85rem; color: var(--ink-2); }
.card { border: 1px solid var(--rule-soft); padding: 20px; margin-bottom: 20px; background: #fff; }
.card > h2, .section-title { font-size: 1.05rem; font-weight: 700; margin-bottom: 14px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.cols { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 24px; align-items: start; }

/* tables */
.tablewrap { overflow-x: auto; border-top: 1px solid var(--rule); }
table.t { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.t th { text-align: start; font-size: 0.7rem; letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; padding: 10px 12px 10px 0; border-bottom: 1px solid var(--rule); white-space: nowrap; }
table.t td { padding: 11px 12px 11px 0; border-bottom: 1px solid var(--rule-soft); vertical-align: top; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: var(--wash); }
table.t .ref { font-variant-numeric: tabular-nums; font-size: 0.82rem; color: var(--ink-3); white-space: nowrap; }
table.t .ttl { font-family: var(--serif); font-size: 1.05rem; }
.mono { font-family: Consolas, Menlo, monospace; font-size: 0.8rem; }
.details-json { font-family: Consolas, Menlo, monospace; font-size: 0.76rem; color: var(--ink-2); white-space: pre-wrap; word-break: break-word; max-width: 420px; }

/* status pills */
.pill { display: inline-block; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.04em; padding: 3px 8px; border: 1px solid var(--rule-soft); background: var(--wash); color: var(--ink-2); white-space: nowrap; }
.pill.draft { background: #fff; }
.pill.submitted, .pill.in_review { border-color: #7aa3c9; background: #e6f0fa; color: #0a3a6b; }
.pill.revisions { border-color: #e2b25c; background: #fff6e5; color: var(--warn); }
.pill.accepted, .pill.contract, .pill.copyediting, .pill.typesetting, .pill.proofs { border-color: #8cc2a3; background: #eef8f2; color: var(--ok); }
.pill.published { border-color: var(--ink); background: var(--ink); color: #fff; }
.pill.rejected, .pill.withdrawn { border-color: #e7a7a3; background: #fdf1f0; color: var(--red-dk); }
.pill.role { background: #fff; }
.pill.suspended { border-color: #e7a7a3; color: var(--red-dk); background: #fdf1f0; }
.pill.active { border-color: #8cc2a3; color: var(--ok); background: #eef8f2; }
.badge { display: inline-block; min-width: 20px; padding: 1px 6px; font-size: 0.72rem; font-weight: 700; text-align: center; background: var(--red); color: #fff; }

/* filters */
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.filters input, .filters select { width: auto; min-width: 160px; padding: 8px 10px; font-size: 0.9rem; }

/* title detail */
.meta-list { display: grid; grid-template-columns: 140px 1fr; gap: 0; border-top: 1px solid var(--rule-soft); }
.meta-list dt, .meta-list dd { padding: 9px 0; border-bottom: 1px solid var(--rule-soft); font-size: 0.9rem; }
.meta-list dt { color: var(--ink-3); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 600; padding-top: 11px; }
.abstract { font-family: var(--serif); font-size: 1.1rem; line-height: 1.6; color: var(--ink-2); white-space: pre-wrap; }
.timeline { list-style: none; border-inline-start: 1px solid var(--rule-soft); margin-inline-start: 6px; }
.timeline li { position: relative; padding: 0 0 16px 18px; font-size: 0.88rem; }
.timeline li::before { content: ''; position: absolute; inset-inline-start: -5px; top: 6px; width: 9px; height: 9px; background: #fff; border: 1px solid var(--ink); }
.timeline li.status::before { background: var(--ink); }
.timeline li.internal::before { border-color: var(--warn); }
.timeline .when { font-size: 0.75rem; color: var(--ink-3); }
.timeline .note { white-space: pre-wrap; color: var(--ink-2); margin-top: 2px; }
.tag { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--warn); margin-inline-start: 6px; }
.file-row { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--rule-soft); font-size: 0.9rem; }
.file-row .fn { font-weight: 600; word-break: break-all; }
.review { border: 1px solid var(--rule-soft); padding: 14px; margin-bottom: 12px; }
.review .head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; font-size: 0.9rem; }
.review .body { white-space: pre-wrap; font-size: 0.92rem; color: var(--ink-2); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.empty { padding: 34px 20px; text-align: center; color: var(--ink-3); border: 1px dashed var(--rule-soft); }

/* modal */
dialog { border: 1px solid var(--ink); padding: 0; max-width: min(560px, calc(100vw - 32px)); width: 100%; color: var(--ink); }
dialog::backdrop { background: rgba(10, 58, 107, 0.35); }
dialog .dh { padding: 16px 20px; border-bottom: 1px solid var(--rule-soft); font-weight: 700; display: flex; justify-content: space-between; align-items: center; }
dialog .db { padding: 20px; }
dialog .df { padding: 14px 20px; border-top: 1px solid var(--rule-soft); display: flex; justify-content: flex-end; gap: 8px; }
dialog .x { background: none; border: 0; font-size: 1.3rem; cursor: pointer; color: var(--ink-3); line-height: 1; }

/* toast + refresh banner */
.toast { position: fixed; inset-block-end: 20px; inset-inline-start: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; font-size: 0.92rem; z-index: 200; box-shadow: 0 8px 30px rgba(10, 58, 107, 0.25); max-width: calc(100vw - 32px); }
.toast.err { background: var(--red-dk); }
.update-banner { position: fixed; inset-block-start: 0; inset-inline: 0; z-index: 300; background: var(--red); color: #fff; display: flex; justify-content: center; align-items: center; gap: 14px; padding: 10px 16px; font-size: 0.92rem; font-family: var(--font); flex-wrap: wrap; text-align: center; }
.update-banner button { background: #fff; color: var(--red-dk); border: 0; font: inherit; font-weight: 700; padding: 6px 14px; cursor: pointer; }
.update-banner .dismiss { background: transparent; color: #fff; text-decoration: underline; font-weight: 500; padding: 6px 4px; }

/* responsive */
@media (max-width: 960px) {
  .auth { grid-template-columns: 1fr; }
  .auth-side { padding: 22px 20px; }
  .auth-side h2, .auth-side p, .auth-side .foot { display: none; }
  .cols { grid-template-columns: 1fr; }
  .shell { grid-template-columns: 1fr; }
  .nav { position: fixed; inset-block: 0; inset-inline-start: 0; width: 260px; z-index: 100; transform: translateX(-100%); transition: transform 0.2s var(--ease); box-shadow: 0 0 40px rgba(10, 58, 107, 0.2); }
  [dir='rtl'] .nav { transform: translateX(100%); }
  .nav.open { transform: none; }
  .topbar { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--rule); position: sticky; top: 0; background: #fff; z-index: 50; }
  .topbar button { background: none; border: 1px solid var(--rule); font: inherit; font-weight: 600; padding: 6px 10px; cursor: pointer; color: var(--ink); }
}
@media (max-width: 560px) {
  .grid2 { grid-template-columns: 1fr; }
  .meta-list { grid-template-columns: 1fr; }
  .meta-list dt { border-bottom: 0; padding-bottom: 0; }
}

/* The view receives focus after navigation (for screen readers); no ring. */
#view:focus { outline: none; }
/* The sidebar link styles must not flatten the wordmark. */
.nav a.wordmark { display: inline-flex; align-items: baseline; font-weight: 800; font-size: 1.05rem; color: var(--ink); border-inline-start: 0; padding: 0 20px 18px; gap: 0; }
.nav a.wordmark:hover { background: none; }
