/*
  MyResearchPortal
  Academic editorial: the conventions of a bound thesis (title page, contents,
  margins, a supervisor's annotations) used as the interface itself.
*/

@font-face { font-family: "EB Garamond"; src: url("../fonts/eb-garamond-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "EB Garamond"; src: url("../fonts/eb-garamond-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "EB Garamond"; src: url("../fonts/eb-garamond-500.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "EB Garamond"; src: url("../fonts/eb-garamond-600.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Public Sans"; src: url("../fonts/public-sans-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Public Sans"; src: url("../fonts/public-sans-500.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Public Sans"; src: url("../fonts/public-sans-600.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }

:root {
  --paper: #f8f6f1;
  --paper-deep: #efebe3;
  --sheet: #fffdf9;
  --ink: #1d2332;
  --ink-soft: #3a4152;
  --graphite: #686c73;
  --rule: #d8d2c6;
  --rule-soft: #e7e2d8;
  --binding: #5c1b26;
  --binding-hover: #45121b;
  --binding-tint: #f3e9e8;
  --redpen: #b42a1f;
  --approve: #2e6a43;
  --approve-tint: #e6efe7;
  --pending: #87661c;
  --pending-tint: #f5edd9;
  --serif: "EB Garamond", "Garamond", "Times New Roman", serif;
  --sans: "Public Sans", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --focus: 0 0 0 3px rgba(92, 27, 38, 0.25);
  --measure: 66ch;

  --bs-body-font-family: var(--sans);
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--paper);
  --bs-border-color: var(--rule);
  --bs-link-color: var(--binding);
  --bs-link-hover-color: var(--binding-hover);
  --bs-link-color-rgb: 92, 27, 38;
  --bs-link-hover-color-rgb: 69, 18, 27;
}

html { font-size: 15px; }
body { background: var(--paper); color: var(--ink); font-family: var(--sans); line-height: 1.55; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
a { color: var(--binding); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--binding-hover); }
:focus-visible { outline: 2px solid var(--binding); outline-offset: 2px; }
code { color: var(--ink-soft); background: var(--paper-deep); padding: 1px 5px; border-radius: 2px; font-size: 0.85em; }
.font-mono { font-family: var(--mono); font-size: 0.86rem; }
.small { font-size: 0.87rem; }
.text-muted-ink { color: var(--graphite) !important; }
.text-danger-ink { color: var(--redpen) !important; }
.text-warn { color: var(--pending); }
.optional { color: var(--graphite); font-weight: 400; font-size: 0.88em; }
::selection { background: #e8d3d0; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

.skip-link { position: absolute; left: -999px; top: 8px; background: var(--sheet); padding: 8px 12px; z-index: 100; }
.skip-link:focus { left: 8px; }

/* ---------- Header ---------- */
.topbar { border-bottom: 1px solid var(--ink); background: var(--paper); }
.topbar-inner { max-width: 1180px; margin: 0 auto; padding: 0 24px; height: 60px; display: flex; align-items: center; gap: 36px; }
.brand { font-family: var(--serif); font-size: 1.45rem; font-weight: 500; color: var(--ink); text-decoration: none; letter-spacing: 0.005em; }
.brand:hover { color: var(--binding); }
.topnav { display: flex; gap: 22px; flex: 1; }
.topnav a, .topbar-user a { color: var(--ink-soft); text-decoration: none; font-size: 0.94rem; padding: 4px 0; border-bottom: 2px solid transparent; }
.topnav a:hover, .topbar-user a:hover { color: var(--ink); border-bottom-color: var(--rule); }
.topnav a.is-active, .topbar-user a.is-active { color: var(--ink); border-bottom-color: var(--binding); }
.topbar-user { display: flex; align-items: center; gap: 18px; }
.link-button { background: none; border: 0; padding: 0; color: var(--binding); font: inherit; cursor: pointer; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.link-button:hover { color: var(--binding-hover); }
.topbar .link-button { color: var(--ink-soft); text-decoration: none; font-size: 0.94rem; }
.topbar .link-button:hover { color: var(--ink); }

/* ---------- Page frame ---------- */
.page { max-width: 1180px; margin: 0 auto; padding: 36px 24px 64px; }
.page-narrow { max-width: 720px; }
.page-title { font-family: var(--serif); font-weight: 500; font-size: 2.3rem; line-height: 1.15; margin: 0 0 10px; letter-spacing: -0.005em; }
.project-title { font-size: 2.2rem; max-width: 34ch; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 28px; flex-wrap: wrap; padding-bottom: 20px; border-bottom: 1px solid var(--rule); }
.page-head-main { flex: 1 1 520px; }
.page-actions { display: flex; gap: 22px; flex-wrap: wrap; align-items: center; }
.page-actions .btn-outline-ink { border: 0; padding: 0; color: var(--binding); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; font-weight: 500; }
.page-actions .btn-outline-ink:hover, .page-actions .btn-outline-ink:active { background: none !important; color: var(--binding-hover) !important; }
.back-link { display: inline-block; font-size: 0.9rem; color: var(--graphite); margin-bottom: 14px; text-decoration: none; }
.back-link:hover { color: var(--binding); text-decoration: underline; }
.eyebrow { font-family: var(--serif); font-style: italic; font-size: 1.12rem; color: var(--graphite); margin: 0 0 2px; }
.meta-line { color: var(--graphite); font-size: 0.93rem; margin: 0; display: flex; flex-wrap: wrap; gap: 4px 22px; }
.section-label { font-family: var(--serif); font-weight: 500; font-size: 1.35rem; color: var(--ink); margin: 0 0 14px; }

.site-footer { border-top: 1px solid var(--rule); color: var(--graphite); font-size: 0.86rem; }
.footer-inner { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-top: 18px; padding-bottom: 28px; }

/* ---------- Panels: sheets of paper, used sparingly ---------- */
.panel { background: var(--sheet); border: 1px solid var(--rule); border-radius: 2px; padding: 22px 24px; margin-bottom: 18px; }
.panel-accent { border-color: var(--binding); border-left-width: 3px; }
.panel-title { font-family: var(--serif); font-weight: 500; font-size: 1.3rem; margin: 0 0 12px; }

/* ---------- Notes ---------- */
.note { padding: 10px 0 10px 16px; margin-bottom: 18px; border-left: 3px solid var(--graphite); font-size: 0.95rem; background: transparent; }
.note-ok { border-color: var(--approve); color: var(--approve); }
.note-warn { border-color: var(--pending); color: #6b5115; }
.note-danger { border-color: var(--redpen); color: var(--redpen); }
.note-info { border-color: var(--ink); }
.note-neutral { border-color: var(--rule); color: var(--graphite); }

/* ---------- Status tags ---------- */
.tag { display: inline-flex; align-items: center; gap: 6px; font-size: 0.82rem; font-weight: 500; white-space: nowrap; color: var(--ink-soft); }
.tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.tag-neutral { color: var(--graphite); }
.tag-neutral::before { background: transparent; border: 1px solid currentColor; }
.tag-ok { color: var(--approve); }
.tag-warn { color: var(--pending); }
.tag-danger { color: var(--redpen); }
.tag-info { color: var(--binding); }
.tag-tool { color: var(--graphite); font-weight: 400; font-family: var(--serif); font-style: italic; font-size: 0.98rem; }
.tag-tool::before { display: none; }

/* ---------- Buttons ---------- */
.btn { font-family: var(--sans); font-weight: 500; border-radius: 2px; padding: 0.5rem 1.05rem; font-size: 0.94rem; letter-spacing: 0.005em; }
.btn-sm { padding: 0.3rem 0.75rem; font-size: 0.86rem; }
.btn-lg { padding: 0.75rem 1.4rem; font-size: 1rem; }
.btn:focus-visible { box-shadow: var(--focus); }
.btn-primary { background: var(--binding); border-color: var(--binding); color: #fff; }
.btn-primary:hover, .btn-primary:focus, .btn-primary:active { background: var(--binding-hover) !important; border-color: var(--binding-hover) !important; color: #fff; }
.btn-primary:disabled { background: #a58389; border-color: #a58389; }
.btn-outline-ink { color: var(--ink); border: 1px solid var(--ink); background: transparent; }
.btn-outline-ink:hover, .btn-outline-ink:active { background: var(--ink) !important; color: var(--paper) !important; border-color: var(--ink) !important; }
.btn-outline-ink:disabled { border-color: var(--rule); color: var(--graphite); }
.btn-link-ink, .btn-link-danger { background: none; border: 1px solid transparent; padding-left: 0; padding-right: 0; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.btn-link-ink { color: var(--binding); }
.btn-link-ink:hover { color: var(--binding-hover); }
.btn-link-danger { color: var(--redpen); }
.btn-link-danger:hover { color: #8a1f17; }

/* ---------- Forms ---------- */
.form-label { font-weight: 500; font-size: 0.93rem; margin-bottom: 6px; }
legend.form-label { font-size: 0.93rem; }
.form-control, .form-select { border: 1px solid #bdb5a6; border-radius: 2px; background-color: var(--sheet); color: var(--ink); }
.form-control:focus, .form-select:focus { background-color: var(--sheet); color: var(--ink); border-color: var(--binding); box-shadow: var(--focus); }
.form-control[readonly] { background-color: var(--paper-deep); }
.form-control::placeholder { color: #9b9a95; }
.form-hint { color: var(--graphite); font-size: 0.86rem; margin-top: 6px; }
.field-error { color: var(--redpen); font-size: 0.88rem; margin-top: 6px; font-weight: 500; }
.choice { display: flex; gap: 14px; align-items: flex-start; border-top: 1px solid var(--rule); padding: 14px 4px; cursor: pointer; }
.choice:last-of-type { border-bottom: 1px solid var(--rule); }
.choice input { margin-top: 7px; accent-color: var(--binding); width: 16px; height: 16px; flex-shrink: 0; }
.choice:has(input:checked) .choice-title { color: var(--binding); }
.choice-title { display: block; font-family: var(--serif); font-size: 1.22rem; line-height: 1.3; }
.choice-meta { display: flex; gap: 18px; flex-wrap: wrap; font-size: 0.87rem; color: var(--graphite); margin-top: 2px; }
.choice-desc { display: block; font-size: 0.9rem; color: var(--ink-soft); margin-top: 4px; }
.copy-row { display: flex; gap: 8px; }
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.filter-bar .form-control, .filter-bar .form-select { width: auto; min-width: 190px; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 0.93rem; font-weight: 500; cursor: pointer; white-space: nowrap; }
.switch input { width: 17px; height: 17px; accent-color: var(--binding); }

/* ---------- Tables: ruled, not boxed ---------- */
.table-wrap { overflow-x: auto; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
.data-table { margin: 0; font-size: 0.93rem; --bs-table-bg: transparent; }
.data-table th { font-size: 0.84rem; color: var(--graphite); font-weight: 500; border-bottom: 1px solid var(--rule); padding: 10px 14px 8px 0; white-space: nowrap; background: transparent; }
.data-table td { padding: 12px 14px 12px 0; vertical-align: middle; border-color: var(--rule-soft); background: transparent; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tr.is-muted td { opacity: 0.5; }
.panel .table-wrap { border-top-color: var(--rule); border-bottom-color: var(--rule); }
.error-text { max-width: 380px; word-break: break-word; }

/* ---------- Figures ---------- */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--rule); margin-bottom: 28px; }
.stat { padding: 14px 18px 14px 0; display: flex; flex-direction: column-reverse; justify-content: flex-end; }
.stat + .stat { padding-left: 18px; border-left: 1px solid var(--rule-soft); }
.stat-value { font-family: var(--serif); font-size: 2rem; line-height: 1.1; font-variant-numeric: lining-nums tabular-nums; }
.stat-value-sm { font-size: 1.2rem; padding-top: 8px; }
.stat-label { font-size: 0.85rem; color: var(--graphite); margin-bottom: 4px; }

/* ---------- Sub navigation ---------- */
.subnav { display: flex; gap: 26px; border-bottom: 1px solid var(--rule); margin: 4px 0 26px; overflow-x: auto; }
.subnav a { padding: 10px 0; color: var(--graphite); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-size: 0.94rem; }
.subnav a:hover { color: var(--ink); }
.subnav a.is-active { color: var(--ink); border-bottom-color: var(--binding); }

/* ---------- Dashboard: projects as catalogue entries ---------- */
.project-list { border-top: 0; }
.project-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 32px; padding: 22px 0; border-bottom: 1px solid var(--rule); text-decoration: none; color: var(--ink); }
.project-card:hover { color: var(--ink); }
.project-card:hover .project-card-title { color: var(--binding); }
.project-card-title { font-family: var(--serif); font-size: 1.5rem; line-height: 1.25; max-width: 40ch; }
.project-card-meta { grid-column: 1; display: flex; gap: 20px; flex-wrap: wrap; font-size: 0.9rem; color: var(--graphite); }
.project-card-stats { grid-column: 2; grid-row: 1 / span 2; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; font-size: 0.88rem; color: var(--ink-soft); text-align: right; }
.marks { display: inline-flex; gap: 3px; }
.mark { width: 7px; height: 22px; border: 1px solid var(--ink); background: transparent; }
.mark-approved { background: var(--ink); }
.mark-submitted { background: linear-gradient(to top, var(--ink) 50%, transparent 50%); }
.mark-changes_requested { border-color: var(--redpen); }
.empty-state { padding: 8px 0 32px; max-width: 620px; }
.empty-state h2 { font-family: var(--serif); font-weight: 500; font-size: 1.7rem; }
.empty-state p { color: var(--graphite); max-width: 52ch; }

/* ---------- Project: a table of contents ---------- */
.chapter-list { max-width: 900px; }
.chapter { margin-bottom: 34px; }
.chapter-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding-bottom: 8px; border-bottom: 1px solid var(--ink); flex-wrap: wrap; }
.chapter-title { font-family: var(--serif); font-size: 1.5rem; font-weight: 500; margin: 0; }
.chapter-meta { font-size: 0.86rem; color: var(--graphite); display: block; margin-top: 2px; }
.chapter-actions { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.decide-form { padding: 16px 0; border-bottom: 1px solid var(--rule); max-width: 560px; }
.section-rows { list-style: none; margin: 0; padding: 0; }
.section-row { display: flex; align-items: baseline; gap: 10px; padding: 8px 0; color: var(--ink); text-decoration: none; }
.section-row-title { font-family: var(--serif); font-size: 1.18rem; flex-shrink: 0; max-width: 70%; }
.section-row::after { content: ""; order: 2; flex: 1; border-bottom: 1px dotted #b8b0a1; transform: translateY(-4px); min-width: 24px; }
.section-row-meta { order: 3; display: flex; align-items: baseline; gap: 14px; flex-shrink: 0; }
.section-row:hover { color: var(--ink); }
.section-row:hover .section-row-title { color: var(--binding); }
.words { font-size: 0.88rem; color: var(--ink-soft); min-width: 92px; text-align: right; font-variant-numeric: tabular-nums; }
.words.is-empty { color: #a39f97; }

/* ---------- Section page: the page and its margin ---------- */
.section-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 48px; align-items: start; }
.section-main { max-width: 760px; }
.guidance { border-left: 3px solid var(--rule); padding: 2px 0 2px 16px; margin: 6px 0 22px; color: var(--ink-soft); }
.guidance summary { cursor: pointer; font-size: 0.93rem; color: var(--graphite); }
.guidance summary:hover { color: var(--ink); }
.guidance p { font-family: var(--serif); font-size: 1.12rem; line-height: 1.55; margin: 8px 0 4px; max-width: var(--measure); }
.editor-form { background: var(--sheet); border: 1px solid var(--rule); border-radius: 2px; box-shadow: 0 1px 0 var(--rule-soft), 0 12px 28px -18px rgba(29, 35, 50, 0.28); }
.editor-form:focus-within { border-color: #bdb5a6; }
.editor { display: block; width: 100%; border: 0; resize: vertical; min-height: 460px; padding: 40px 56px; font-family: var(--serif); font-size: 1.27rem; line-height: 1.72; color: var(--ink); background: transparent; }
.editor:focus { outline: none; }
.editor-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 16px 10px 56px; border-top: 1px solid var(--rule-soft); background: var(--sheet); position: sticky; bottom: 0; }
.editor-status { font-size: 0.87rem; color: var(--graphite); font-variant-numeric: tabular-nums; display: flex; gap: 18px; flex-wrap: wrap; }
.editor-status .sep { display: none; }
.editor-status .is-dirty { color: var(--pending); font-weight: 500; }
.reading { font-family: var(--serif); font-size: 1.27rem; line-height: 1.72; max-width: var(--measure); margin-bottom: 14px; }
.reading p { margin-bottom: 1em; }
.reading p:last-child { margin-bottom: 0; }
.panel.reading { padding: 40px 56px; max-width: none; }
.pager { display: flex; justify-content: space-between; gap: 24px; margin-top: 34px; padding-top: 16px; border-top: 1px solid var(--rule); }
.pager a { display: flex; flex-direction: column; text-decoration: none; max-width: 48%; font-family: var(--serif); font-size: 1.15rem; color: var(--ink); }
.pager a:hover { color: var(--binding); }
.pager a span { font-family: var(--sans); font-size: 0.84rem; color: var(--graphite); }
.pager-next { text-align: right; margin-left: auto; }

/* The margin: annotations, not cards */
.section-side { position: sticky; top: 20px; display: grid; gap: 30px; padding-top: 74px; }
.side-panel { border-top: 1px solid var(--ink); padding-top: 12px; }
.side-title { font-family: var(--serif); font-size: 1.22rem; font-weight: 500; margin: 0 0 6px; }
.review-panel { }
.review-result { margin-top: 18px; }
.review-time { font-size: 0.82rem; color: var(--graphite); margin-bottom: 4px; }
.review-h { font-size: 0.86rem; font-weight: 600; color: var(--ink); margin: 14px 0 4px; }
.review-h-missing { color: var(--pending); }
.review-h-strengths { color: var(--approve); }
.review-list { list-style: none; padding: 0; margin: 0; font-family: var(--serif); font-size: 1.06rem; line-height: 1.45; color: var(--ink-soft); }
.review-list li { padding-left: 14px; position: relative; margin-bottom: 7px; }
.review-list li::before { content: ""; position: absolute; left: 0; top: 0.62em; width: 6px; height: 1px; background: var(--graphite); }
.review-next { font-family: var(--serif); font-size: 1.08rem; line-height: 1.45; border-left: 2px solid var(--binding); padding-left: 12px; margin: 0; }
.review-older { margin-top: 12px; font-size: 0.9rem; }
.review-older summary { cursor: pointer; color: var(--graphite); font-size: 0.86rem; }
.review-older[open] { padding-bottom: 6px; border-bottom: 1px solid var(--rule-soft); }
.comment { padding: 10px 0 10px 14px; border-left: 2px solid var(--redpen); margin-bottom: 12px; }
.comment-head { display: flex; justify-content: space-between; gap: 8px; font-size: 0.84rem; }
.comment-head strong { font-weight: 600; color: var(--redpen); }
.comment-head span { color: var(--graphite); }
.comment-body { font-family: var(--serif); font-size: 1.08rem; line-height: 1.45; color: var(--redpen); margin: 4px 0; }
.comment.is-resolved { opacity: 0.55; border-left-color: var(--rule); }
.comment.is-resolved .comment-body, .comment.is-resolved .comment-head strong { color: var(--graphite); text-decoration: line-through; text-decoration-thickness: 1px; }
.comment .link-button { font-size: 0.84rem; }
.version-list { list-style: none; padding: 0; margin: 0 0 8px; font-size: 0.89rem; }
.version-list li { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid var(--rule-soft); }
.version-list li span { color: var(--graphite); font-variant-numeric: tabular-nums; }

/* ---------- Section guide ---------- */
.guidance-full { border-left-color: var(--binding); padding-bottom: 8px; }
.guidance-full[open] summary { color: var(--ink); margin-bottom: 6px; }
.guidance-full > p { font-family: var(--serif); font-size: 1.12rem; line-height: 1.55; max-width: var(--measure); margin: 6px 0 10px; }
.guidance-full > p.guide-note { color: var(--ink); }
.guide-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 36px; margin: 8px 0 4px; }
.guide-grid h3 { font-family: var(--sans); font-size: 0.88rem; font-weight: 600; color: var(--ink); margin: 12px 0 6px; }
.guide-grid ul, .guide-grid ol { margin: 0; padding-left: 0; list-style: none; font-size: 0.94rem; color: var(--ink-soft); }
.guide-grid li { padding: 3px 0 3px 18px; position: relative; }
.guide-grid ul li::before { content: ""; position: absolute; left: 0; top: 0.9em; width: 8px; height: 1px; background: var(--graphite); }
.guide-grid ol { counter-reset: gstep; }
.guide-grid ol li { counter-increment: gstep; padding-left: 22px; }
.guide-grid ol li::before { content: counter(gstep); position: absolute; left: 0; top: 2px; font-family: var(--serif); color: var(--binding); font-size: 1rem; }
.guide-grid p { font-size: 0.94rem; color: var(--ink-soft); margin: 0; }
.guide-example { margin: 16px 0 6px; padding: 12px 0 0; border-top: 1px solid var(--rule); max-width: var(--measure); }
.guide-example figcaption { font-size: 0.84rem; color: var(--graphite); margin-bottom: 6px; }
.guide-example blockquote { font-family: var(--serif); font-style: italic; font-size: 1.1rem; line-height: 1.6; color: var(--ink-soft); margin: 0; padding-left: 14px; border-left: 2px solid var(--rule); }

/* ---------- Project path ---------- */
.path { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px 48px; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--rule); padding: 22px 0 18px; margin-bottom: 38px; max-width: 900px; }
.path-label { font-size: 0.88rem; color: var(--binding); font-weight: 600; margin: 0 0 2px; }
.path-title { font-family: var(--serif); font-weight: 500; font-size: 1.75rem; line-height: 1.2; margin: 0 0 2px; }
.path-title a { color: var(--ink); text-decoration: none; }
.path-title a:hover { color: var(--binding); text-decoration: underline; }
.path-where { font-family: var(--serif); font-style: italic; color: var(--graphite); margin: 0 0 10px; font-size: 1.05rem; }
.path-why { font-family: var(--serif); font-size: 1.12rem; line-height: 1.5; color: var(--ink-soft); margin: 0 0 16px; max-width: 46ch; }
.stages { list-style: none; padding: 0; margin: 0; align-self: start; }
.stage { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 7px 0; border-bottom: 1px solid var(--rule-soft); font-size: 0.92rem; }
.stage:last-child { border-bottom: 0; }
.stage-name { color: var(--ink-soft); }
.stage-count { color: var(--graphite); font-variant-numeric: tabular-nums; font-size: 0.86rem; }
.stage-bar { grid-column: 1 / -1; height: 3px; background: var(--rule-soft); }
.stage-bar span { display: block; height: 100%; background: var(--ink); }
.stage.is-current .stage-name { color: var(--binding); font-weight: 600; }
.stage.is-current .stage-bar span { background: var(--binding); }
.stage.is-done .stage-name { color: var(--graphite); }
.path-note { grid-column: 1 / -1; font-size: 0.84rem; color: var(--graphite); margin: 0; }

/* ---------- University guidelines ---------- */
.guide-layout { max-width: 760px; }
.guide-head { padding-bottom: 18px; border-bottom: 1px solid var(--ink); margin-bottom: 8px; }
.guide-file { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; margin: 16px 0 0; }
.guide-body { font-family: var(--serif); font-size: 1.16rem; line-height: 1.6; }
.guide-body > p:first-child { color: var(--ink-soft); font-style: italic; margin-top: 18px; }
.guide-body h2 { font-family: var(--serif); font-weight: 500; font-size: 1.5rem; margin: 30px 0 8px; padding-top: 14px; border-top: 1px solid var(--rule); }
.guide-body ul { list-style: none; padding: 0; margin: 0; }
.guide-body li { padding: 5px 0 5px 18px; position: relative; max-width: var(--measure); }
.guide-body li::before { content: ""; position: absolute; left: 0; top: 0.95em; width: 8px; height: 1px; background: var(--ink); }
.guidance-link { font-family: var(--sans) !important; font-size: 0.9rem !important; margin-top: 10px !important; }
.plain-list { list-style: none; padding: 0; margin: 0 0 10px; }
.plain-list li { padding: 4px 0; border-bottom: 1px solid var(--rule-soft); }

/* ---------- Word export ---------- */
.export-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 48px; align-items: start; }
.export-form { max-width: 680px; }
.export-form .section-label { margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--rule); }
.export-form .section-label:first-of-type { border-top: 0; padding-top: 0; }
.export-side { display: grid; gap: 28px; }
.export-order { padding-left: 18px; margin: 0; color: var(--ink-soft); }
.export-order li { padding: 2px 0; }

/* ---------- Writing log ---------- */
.timeline { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--ink); max-width: 860px; }
.timeline-day { font-family: var(--serif); font-size: 1.2rem; padding: 18px 0 6px; border-bottom: 1px solid var(--rule); }
.timeline-item { display: flex; gap: 20px; padding: 9px 0; border-bottom: 1px solid var(--rule-soft); font-size: 0.93rem; }
.timeline-time { color: var(--graphite); font-variant-numeric: tabular-nums; width: 46px; flex-shrink: 0; }
.timeline-body { flex: 1; }
.timeline-detail { display: block; color: var(--ink-soft); font-size: 0.88rem; }
.timeline-user { display: block; color: var(--graphite); font-size: 0.82rem; }

/* ---------- Admin ---------- */
.feature-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.rules-block { white-space: pre-wrap; font-family: var(--mono); font-size: 0.8rem; background: var(--paper); border-left: 2px solid var(--rule); padding: 10px 14px; margin: 0; color: var(--ink-soft); }
.mini-chart .bars { display: flex; align-items: flex-end; gap: 3px; height: 90px; border-bottom: 1px solid var(--ink); }
.mini-chart .bar { flex: 1; height: 100%; display: flex; align-items: flex-end; }
.mini-chart .bar span { display: block; width: 100%; background: var(--binding); min-height: 1px; }
.mini-chart .bars-axis { display: flex; justify-content: space-between; margin-top: 6px; }

/* ---------- Sign in and account pages: a title page ---------- */
.auth-body { background: var(--paper); }
.auth-wrap { max-width: 460px; margin: 0 auto; padding: 64px 24px; }
.auth-mark { text-align: center; padding-bottom: 18px; margin-bottom: 30px; border-bottom: 1px solid var(--ink); }
.auth-mark .brand { font-size: 1.9rem; }
.auth-card { background: transparent; }
.auth-title { font-family: var(--serif); font-weight: 500; font-size: 2rem; margin-bottom: 8px; }
.auth-alt { margin: 22px 0 0; padding-top: 16px; border-top: 1px solid var(--rule); font-size: 0.93rem; }
.invite-title { font-family: var(--serif); font-size: 1.45rem; line-height: 1.3; margin: 10px 0 16px; }

/* ---------- Homepage ---------- */
.home { background: var(--paper); }
.home-wrap { max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.home .topbar { border-bottom-color: var(--rule); }
.home-cta-link { color: var(--binding) !important; font-weight: 500; }

.title-page { padding: 76px 0 88px; border-bottom: 1px solid var(--ink); }
.title-sheet { max-width: 760px; margin: 0 auto; text-align: center; }
.tp-kicker { font-family: var(--serif); font-style: italic; font-size: 1.2rem; color: var(--graphite); margin: 0 0 30px; }
.tp-title { font-family: var(--serif); font-weight: 500; font-size: clamp(2.4rem, 5.4vw, 4.1rem); line-height: 1.06; letter-spacing: -0.012em; margin: 0 auto 30px; max-width: 16ch; }
.tp-rule { width: 64px; height: 1px; background: var(--ink); margin: 0 auto 30px; border: 0; opacity: 1; }
.tp-sub { font-family: var(--serif); font-size: 1.32rem; line-height: 1.5; color: var(--ink-soft); max-width: 46ch; margin: 0 auto 38px; }
.tp-actions { display: flex; gap: 22px; justify-content: center; align-items: center; flex-wrap: wrap; }
.tp-actions a:not(.btn) { font-size: 0.98rem; }
.tp-foot { margin-top: 56px; font-family: var(--serif); font-size: 1.05rem; color: var(--graphite); line-height: 1.6; }

.contents { padding: 64px 0 20px; }
.contents-inner { max-width: 760px; margin: 0 auto; }
.contents-title { font-family: var(--serif); font-weight: 500; font-size: 1.9rem; text-align: center; margin: 0 0 26px; }
.toc { list-style: none; padding: 0; margin: 0; }
.toc a { display: flex; align-items: baseline; gap: 10px; padding: 10px 0; color: var(--ink); text-decoration: none; font-family: var(--serif); font-size: 1.28rem; }
.toc a::after { content: ""; order: 2; flex: 1; border-bottom: 1px dotted #b8b0a1; transform: translateY(-5px); }
.toc a span:last-child { order: 3; font-size: 1.1rem; color: var(--graphite); font-variant-numeric: oldstyle-nums; }
.toc a:hover { color: var(--binding); }

.chapter-block { padding: 72px 0; border-top: 1px solid var(--rule); }
.chapter-block-head { max-width: 760px; margin: 0 auto 36px; }
.chapter-no { font-family: var(--serif); font-style: italic; font-size: 1.15rem; color: var(--graphite); margin: 0 0 4px; }
.chapter-name { font-family: var(--serif); font-weight: 500; font-size: 2.2rem; line-height: 1.15; margin: 0 0 12px; }
.chapter-intro { font-family: var(--serif); font-size: 1.25rem; line-height: 1.55; color: var(--ink-soft); margin: 0; max-width: 54ch; }

.steps { list-style: none; padding: 0; margin: 0 auto; max-width: 760px; counter-reset: step; }
.steps li { display: grid; grid-template-columns: 70px 1fr; gap: 0 18px; padding: 20px 0; border-top: 1px solid var(--rule); }
.steps li:last-child { border-bottom: 1px solid var(--rule); }
.step-num { font-family: var(--serif); font-size: 2.3rem; line-height: 1; color: var(--binding); grid-row: span 2; font-variant-numeric: oldstyle-nums; }
.steps h3 { font-family: var(--sans); font-size: 1.02rem; font-weight: 600; margin: 4px 0 4px; }
.steps p { color: var(--ink-soft); font-size: 0.98rem; margin: 0; max-width: 60ch; }

/* The annotated draft: the one bold element on the page */
.annotated { max-width: 1040px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 0 44px; }
.draft { background: var(--sheet); border: 1px solid var(--rule); padding: 44px 52px; box-shadow: 0 18px 40px -26px rgba(29, 35, 50, 0.35); position: relative; }
.draft-head { font-size: 0.86rem; color: var(--graphite); margin-bottom: 18px; display: flex; justify-content: space-between; gap: 12px; }
.draft h4 { font-family: var(--serif); font-weight: 500; font-size: 1.5rem; margin: 0 0 14px; }
.draft p { font-family: var(--serif); font-size: 1.2rem; line-height: 1.75; margin: 0 0 1em; color: var(--ink); }
.draft p:last-child { margin-bottom: 0; }
.draft mark { background: transparent; color: inherit; padding: 0; border-bottom: 2px solid var(--pending); }
.draft mark.red { border-bottom-color: var(--redpen); }
.margin-notes { padding-top: 70px; display: grid; gap: 22px; align-content: start; }
.mnote { font-family: var(--serif); font-size: 1.1rem; line-height: 1.42; padding-left: 14px; border-left: 2px solid var(--pending); }
.mnote-who { display: block; font-family: var(--sans); font-size: 0.82rem; font-weight: 600; margin-bottom: 2px; }
.mnote-tool { color: var(--ink-soft); }
.mnote-tool .mnote-who { color: var(--pending); }
.mnote-red { color: var(--redpen); border-left-color: var(--redpen); }
.legend { max-width: 1040px; margin: 26px auto 0; display: flex; gap: 28px; flex-wrap: wrap; font-size: 0.9rem; color: var(--graphite); }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.legend i { width: 18px; height: 2px; display: inline-block; }

.principles { max-width: 760px; margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr; gap: 28px 40px; }
.principles h3 { font-family: var(--sans); font-size: 1rem; font-weight: 600; margin: 0 0 4px; }
.principles p { margin: 0; color: var(--ink-soft); font-size: 0.98rem; }
.principles div { border-top: 1px solid var(--ink); padding-top: 12px; }

.colophon { padding: 64px 0 72px; border-top: 1px solid var(--ink); text-align: center; }
.colophon h2 { font-family: var(--serif); font-weight: 500; font-size: 2.1rem; margin: 0 0 10px; }
.colophon p { font-family: var(--serif); font-size: 1.2rem; color: var(--ink-soft); margin: 0 auto 26px; max-width: 46ch; }
.home .site-footer { border-top: 1px solid var(--rule); }

/* ---------- Responsive ---------- */
@media (max-width: 991px) {
  .export-layout { grid-template-columns: 1fr; }
  .path { grid-template-columns: 1fr; }
  .guide-grid { grid-template-columns: 1fr; }
  .section-layout { grid-template-columns: 1fr; gap: 28px; }
  .section-side { position: static; padding-top: 0; }
  .annotated { grid-template-columns: 1fr; }
  .margin-notes { padding-top: 22px; }
}
@media (max-width: 640px) {
  html { font-size: 14.5px; }
  .topbar-inner { gap: 16px; padding: 0 16px; }
  .topbar-user a { display: none; }
  .home .topnav { display: none; }
  .home .topbar-user a { display: inline; }
  .page { padding: 24px 16px 48px; }
  .page-title { font-size: 1.9rem; }
  .editor { padding: 22px 18px; min-height: 360px; font-size: 1.18rem; }
  .editor-bar { padding-left: 18px; }
  .panel.reading { padding: 22px 18px; }
  .section-row { flex-wrap: wrap; }
  .section-row::after { display: none; }
  .section-row-title { max-width: 100%; }
  .section-row-meta { width: 100%; }
  .words { text-align: left; min-width: 0; }
  .project-card { grid-template-columns: 1fr; }
  .project-card-stats { grid-column: 1; grid-row: auto; align-items: flex-start; text-align: left; }
  .copy-row { flex-direction: column; }
  .title-page { padding: 48px 0 56px; }
  .draft { padding: 26px 20px; }
  .principles { grid-template-columns: 1fr; }
  .steps li { grid-template-columns: 48px 1fr; }
  .step-num { font-size: 1.8rem; }
  .stat + .stat { padding-left: 0; border-left: 0; }
}
