/*
  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: "Bricolage Grotesque"; src: url("../fonts/bricolage-grotesque-latin.woff2") format("woff2-variations"); font-weight: 200 800; font-style: normal; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Bricolage Grotesque"; src: url("../fonts/bricolage-grotesque-latin-ext.woff2") format("woff2-variations"); font-weight: 200 800; font-style: normal; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Figtree"; src: url("../fonts/figtree-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Figtree"; src: url("../fonts/figtree-ext-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Figtree"; src: url("../fonts/figtree-500.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Figtree"; src: url("../fonts/figtree-ext-500.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Figtree"; src: url("../fonts/figtree-600.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Figtree"; src: url("../fonts/figtree-ext-600.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Figtree"; src: url("../fonts/figtree-700.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Figtree"; src: url("../fonts/figtree-ext-700.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Figtree"; src: url("../fonts/figtree-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; 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;
  --display: "Bricolage Grotesque", "Figtree", "Segoe UI", system-ui, sans-serif;
  --sans: "Figtree", "Segoe UI", system-ui, sans-serif;
  /* Reading text now uses the text face; the name is kept so existing rules follow */
  --serif: var(--sans);
  --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; }
@media (hover: hover) { 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(--display); font-size: 1.33rem; font-weight: 650; color: var(--ink); text-decoration: none; letter-spacing: 0.005em; }
@media (hover: hover) { .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; }
@media (hover: hover) { .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; }
@media (hover: hover) { .link-button:hover { color: var(--binding-hover); } }
.topbar .link-button { color: var(--ink-soft); text-decoration: none; font-size: 0.94rem; }
@media (hover: hover) { .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(--display); font-weight: 650; font-size: 2.12rem; 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:active { background: none !important; color: var(--binding-hover) !important; }
@media (hover: hover) { .page-actions .btn-outline-ink:hover { 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; }
@media (hover: hover) { .back-link:hover { color: var(--binding); text-decoration: underline; } }
.eyebrow { font-family: var(--serif); font-size: 1.01rem; 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(--display); font-weight: 650; font-size: 1.24rem; 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(--display); font-weight: 650; font-size: 1.2rem; 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-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:focus, .btn-primary:active { background: var(--binding-hover) !important; border-color: var(--binding-hover) !important; color: #fff; }
@media (hover: hover) { .btn-primary:hover { 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:active { background: var(--ink) !important; color: var(--paper) !important; border-color: var(--ink) !important; }
@media (hover: hover) { .btn-outline-ink:hover { 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); }
@media (hover: hover) { .btn-link-ink:hover { color: var(--binding-hover); } }
.btn-link-danger { color: var(--redpen); }
@media (hover: hover) { .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(--display); font-size: 1.12rem; 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(--display); font-size: 1.84rem; 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; }
@media (hover: hover) { .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); }
@media (hover: hover) { .project-card:hover { color: var(--ink); } }
@media (hover: hover) { .project-card:hover .project-card-title { color: var(--binding); } }
.project-card-title { font-family: var(--display); font-size: 1.38rem; 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(--display); font-weight: 650; font-size: 1.56rem; }
.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(--display); font-size: 1.38rem; font-weight: 650; 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.06rem; 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; }
@media (hover: hover) { .section-row:hover { color: var(--ink); } }
@media (hover: hover) { .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); }
@media (hover: hover) { .guidance summary:hover { color: var(--ink); } }
.guidance p { font-family: var(--serif); font-size: 1.01rem; 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.14rem; 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.14rem; 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.03rem; color: var(--ink); }
@media (hover: hover) { .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(--display); font-size: 1.12rem; font-weight: 650; 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: 0.95rem; 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: 0.97rem; 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: 0.97rem; 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.01rem; 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(--display); color: var(--binding); font-size: 0.92rem; }
.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: 0.99rem; 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(--display); font-weight: 650; font-size: 1.61rem; line-height: 1.2; margin: 0 0 2px; }
.path-title a { color: var(--ink); text-decoration: none; }
@media (hover: hover) { .path-title a:hover { color: var(--binding); text-decoration: underline; } }
.path-where { font-family: var(--serif); color: var(--graphite); margin: 0 0 10px; font-size: 0.95rem; }
.path-why { font-family: var(--serif); font-size: 1.01rem; 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.04rem; 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(--display); font-weight: 650; font-size: 1.38rem; 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; }

/* ---------- References ---------- */
.refs-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 48px; align-items: start; }
.refs-side { position: sticky; top: 16px; }
.ref-entries { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--ink); }
.ref-entry { padding: 14px 0; border-bottom: 1px solid var(--rule-soft); }
.ref-text { font-family: var(--serif); font-size: 1.03rem; line-height: 1.55; padding-left: 2em; text-indent: -2em; margin: 0 0 6px; }
.ref-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; font-size: 0.86rem; padding-left: 2em; }
.ref-cite { font-size: 0.86rem; color: var(--ink-soft); }
.copy-row .btn { white-space: nowrap; }
.ref-check { border-top: 1px solid var(--ink); border-bottom: 1px solid var(--rule); padding: 16px 0; margin-bottom: 30px; }
.check-h { font-family: var(--sans); font-size: 0.95rem; font-weight: 600; margin: 4px 0 8px; }
.check-list { list-style: none; padding: 0; margin: 0 0 8px; }
.check-list li { padding: 6px 0; border-bottom: 1px solid var(--rule-soft); display: flex; flex-direction: column; }
.check-list li span { font-size: 0.86rem; color: var(--graphite); }
.cite-panel summary { cursor: pointer; }
.cite-list { list-style: none; padding: 0; margin: 6px 0 10px; max-height: 340px; overflow-y: auto; }
.cite-list li { padding: 7px 0; border-bottom: 1px solid var(--rule-soft); }
.cite-title { display: block; font-family: var(--serif); font-size: 0.9rem; line-height: 1.3; margin-bottom: 4px; }
.cite-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.cite-btn { background: transparent; border: 1px solid var(--rule); border-radius: 2px; padding: 2px 8px; font-size: 0.82rem; color: var(--binding); cursor: pointer; }
@media (hover: hover) { .cite-btn:hover { border-color: var(--binding); background: var(--binding-tint); } }

/* ---------- Method tools ---------- */
.tool-layout { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: 48px; align-items: start; }
.tool-form { max-width: 620px; }
.tool-stack { grid-template-columns: 1fr; gap: 36px; }
.tool-stack .tool-result { position: static; max-width: 760px; }
.choice-compact { padding: 10px 4px; }
.choice-compact .choice-title { font-size: 1.12rem; }
.tool-result { border-top: 1px solid var(--ink); padding-top: 14px; position: sticky; top: 16px; }
.result-label { font-size: 0.9rem; color: var(--graphite); margin: 0; }
.result-number { font-family: var(--display); font-size: 3.68rem; line-height: 1; margin: 4px 0 6px; font-variant-numeric: lining-nums; color: var(--binding); }
.result-sub { font-family: var(--serif); font-size: 1.03rem; color: var(--ink-soft); margin: 0; }
.working { padding-left: 20px; margin: 0; font-size: 0.93rem; color: var(--ink-soft); }
.working li { padding: 3px 0; font-variant-numeric: tabular-nums; }
.instrument-table td { vertical-align: middle; }
.obj-boxes { white-space: nowrap; }
.obj-boxes label { margin-right: 10px; font-size: 0.9rem; cursor: pointer; }
.obj-boxes input { accent-color: var(--binding); }
.coverage { list-style: none; padding: 0; margin: 0; }
.coverage li { padding: 10px 0 10px 14px; border-left: 2px solid var(--approve); margin-bottom: 10px; }
.coverage li.is-gap { border-left-color: var(--redpen); }
.coverage-obj { font-family: var(--serif); font-size: 0.97rem; line-height: 1.4; margin: 0 0 4px; }
.coverage-obj span { color: var(--graphite); }

/* ---------- Literature search ---------- */
.lit-search { border-top: 1px solid var(--ink); padding-top: 18px; margin-bottom: 26px; max-width: 900px; }
.lit-query { display: flex; gap: 10px; margin-bottom: 12px; }
.lit-filters { display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: center; font-size: 0.9rem; color: var(--ink-soft); }
.lit-filters label { display: inline-flex; align-items: center; gap: 8px; }
.lit-filters .form-select-sm { width: auto; }
.lit-count { max-width: 900px; }
.lit-results { list-style: none; padding: 0; margin: 0; max-width: 900px; border-top: 1px solid var(--rule); }
.lit-item { padding: 16px 0; border-bottom: 1px solid var(--rule-soft); }
.lit-title { font-family: var(--display); font-weight: 650; font-size: 1.21rem; line-height: 1.3; margin: 0 0 4px; }
.lit-title a { color: var(--ink); text-decoration: none; }
@media (hover: hover) { .lit-title a:hover { color: var(--binding); text-decoration: underline; } }
.lit-meta { display: flex; flex-wrap: wrap; gap: 2px 18px; font-size: 0.88rem; color: var(--graphite); margin: 0 0 6px; }
.lit-source { font-style: italic; font-family: var(--serif); font-size: 0.98rem; }
.lit-abstract summary { cursor: pointer; font-size: 0.86rem; color: var(--graphite); }
.lit-abstract p { font-family: var(--serif); font-size: 0.94rem; line-height: 1.55; color: var(--ink-soft); margin: 6px 0 4px; max-width: var(--measure); }
.lit-actions { display: flex; gap: 18px; align-items: center; margin-top: 6px; font-size: 0.9rem; }
.lit-tips { max-width: 760px; }

/* ---------- Reading log ---------- */
.stat-link { text-decoration: none; color: var(--ink); }
.stat-link.is-active .stat-label { color: var(--binding); }
@media (hover: hover) { .stat-link:hover .stat-label { color: var(--binding); } }
.stat-link.is-active { box-shadow: inset 0 -2px 0 var(--binding); }
.notes-form .ref-text { padding-left: 0; text-indent: 0; }
.rl-list { list-style: none; padding: 0; margin: 0; max-width: 900px; }
.rl-item { padding: 14px 0; border-bottom: 1px solid var(--rule-soft); }
.rl-head { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: baseline; }
.rl-cite { font-weight: 600; font-size: 0.95rem; }
.rl-status { font-size: 0.82rem; color: var(--graphite); }
.rl-status.rl-reading { color: var(--pending); }
.rl-status.rl-done { color: var(--approve); }
.rl-edit { font-size: 0.88rem; margin-left: auto; }
.rl-title { font-family: var(--serif); font-size: 1.01rem; line-height: 1.35; margin: 2px 0 6px; }
.rl-note { font-family: var(--serif); font-size: 0.94rem; line-height: 1.5; color: var(--ink-soft); margin: 0 0 4px; max-width: var(--measure); }
.rl-note span { font-family: var(--sans); font-size: 0.8rem; font-weight: 600; color: var(--graphite); margin-right: 8px; }
.rl-themes { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 0; }
.rl-themes span { font-size: 0.8rem; border: 1px solid var(--rule); border-radius: 2px; padding: 1px 7px; color: var(--ink-soft); }
.rl-group { margin-bottom: 34px; max-width: 900px; }
.rl-group-title { font-family: var(--display); font-weight: 650; font-size: 1.29rem; line-height: 1.3; padding-bottom: 6px; border-bottom: 1px solid var(--ink); margin: 0 0 4px; }

/* ---------- Similarity check ---------- */
.sim-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 48px; align-items: start; }
.sim-main { min-width: 0; }
.sim-side { position: sticky; top: 16px; display: grid; gap: 28px; }
.sim-score { border-top: 1px solid var(--ink); padding-top: 14px; }
.sim-when { margin-top: 8px; }
.result-number.sim-low { color: var(--approve); }
.result-number.sim-mid { color: var(--pending); }
.result-number.sim-high { color: var(--redpen); }
.sim-sources { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--rule); }
.sim-sources li { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 12px; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--rule-soft); }
.sim-key { display: inline-flex; width: 24px; height: 24px; align-items: center; justify-content: center; font-size: 0.82rem; font-weight: 600; border-radius: 2px; }
.sim-src strong { display: block; font-weight: 500; font-family: var(--serif); font-size: 0.99rem; line-height: 1.3; }
.sim-src span { display: block; font-size: 0.86rem; color: var(--graphite); }
.sim-src a { display: inline-block; margin-top: 2px; font-size: 0.86rem; }
.sim-pct { font-family: var(--display); font-size: 1.24rem; text-align: right; }
.sim-pct span { display: block; font-family: var(--sans); font-size: 0.8rem; color: var(--graphite); }
.sim-section { border-top: 1px solid var(--rule); padding: 14px 0 6px; }
.sim-section h3 { font-family: var(--display); font-weight: 650; font-size: 1.2rem; margin: 0 0 8px; display: flex; gap: 14px; align-items: baseline; }
.sim-section h3 a { color: var(--ink); text-decoration: none; }
@media (hover: hover) { .sim-section h3 a:hover { color: var(--binding); text-decoration: underline; } }
.sim-section h3 span { font-family: var(--sans); font-size: 0.84rem; color: var(--graphite); }
.sim-text { font-family: var(--serif); font-size: 1.01rem; line-height: 1.75; max-width: var(--measure); }
.sim-text p { margin: 0 0 0.8em; }
mark.hl { padding: 1px 0; border-radius: 1px; color: inherit; }
mark.hl sup { font-family: var(--sans); font-size: 0.72rem; font-weight: 700; margin: 0 3px 0 1px; color: var(--ink); }
.hl-1 { background: #f4d4cf; } .hl-2 { background: #f3e3bd; } .hl-3 { background: #d4e7d8; } .hl-4 { background: #d6e0f1; } .hl-5 { background: #e6d6eb; }
.hl-6 { background: #f0dcc9; } .hl-7 { background: #d2e8e6; } .hl-8 { background: #e4dfcf; } .hl-9 { background: #e0e0e0; }

/* ---------- Writing log ---------- */
.timeline { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--ink); max-width: 860px; }
.timeline-day { font-family: var(--display); font-size: 1.1rem; 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(--display); font-weight: 650; font-size: 1.84rem; 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(--display); font-size: 1.33rem; line-height: 1.3; margin: 10px 0 16px; }

/* ---------- Homepage ---------- */
/* The homepage styles are in the Home section at the end of this file */

/* ---------- Responsive ---------- */
@media (max-width: 991px) {
  .sim-layout { grid-template-columns: 1fr; }
  .sim-side { position: static; }
  .tool-layout { grid-template-columns: 1fr; }
  .tool-result { position: static; }
  .refs-layout { grid-template-columns: 1fr; }
  .refs-side { position: static; }
  .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; }
}
@media (max-width: 640px) {
  html { font-size: 14.5px; }
  .topbar-inner { gap: 16px; padding: 0 16px; }
  .topbar-user a { display: none; }
  .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; }
  .step-num { font-size: 1.8rem; }
  .stat + .stat { padding-left: 0; border-left: 0; }
}

/* ---------- Repository harvesting ---------- */
.harvest-intro { max-width: 760px; }
.cmd-line, .cmd-log { font-size: 0.84rem; background: var(--paper-deep); color: var(--ink); padding: 10px 12px; border-radius: 2px; white-space: pre-wrap; word-break: break-all; margin-bottom: 10px; }
.cmd-log { color: var(--graphite); max-height: 160px; overflow: auto; word-break: normal; overflow-wrap: anywhere; }
.harvest-filter { display: flex; gap: 16px; flex-wrap: wrap; }
.harvest-filter a { color: var(--graphite); text-decoration: none; border-bottom: 1px solid transparent; }
.harvest-filter a.is-active { color: var(--ink); border-bottom-color: var(--binding); }

/* ---------- Library collections ---------- */
.import-intro { max-width: 760px; }
.import-progress { height: 6px; background: var(--paper-deep); border-radius: 3px; overflow: hidden; margin: 14px 0 6px; max-width: 560px; }
.import-progress span { display: block; height: 100%; background: var(--binding); transition: width 0.3s; }
.import-remove { max-width: 420px; }
.sheet-example td { font-size: 0.86rem; }

/* ---------- Archive and delete ---------- */
.danger-zone { border-top: 2px solid var(--redpen); padding-top: 12px; }
.danger-zone .side-title { color: var(--redpen); }
.btn-danger { background: var(--redpen); border-color: var(--redpen); color: #fff; }
.btn-danger:active { background: #8a1f17 !important; border-color: #8a1f17 !important; color: #fff !important; }
@media (hover: hover) { .btn-danger:hover { background: #8a1f17 !important; border-color: #8a1f17 !important; color: #fff !important; } }
.archived-list { margin-top: 28px; border-top: 1px solid var(--rule); padding-top: 12px; }
.archived-list summary { cursor: pointer; color: var(--graphite); font-size: 0.95rem; }
.archived-list ul { margin-top: 10px; }
.archived-list li { padding: 6px 0; }

/* ---------- Past theses ---------- */
.related-theses { margin-top: 40px; border-top: 1px solid var(--ink); padding-top: 14px; max-width: 900px; }
.related-theses li { padding: 8px 0; border-bottom: 1px solid var(--rule-soft); }
.related-theses .rt-title { font-family: var(--serif); font-size: 0.97rem; }
.related-theses .rt-meta { display: block; }

/* ---------- System ---------- */
.system-text { max-width: 760px; }
.system-log { max-height: 320px; font-size: 0.78rem; white-space: pre-wrap; }

/* ---------- Spelling and grammar ---------- */
.editor-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.lang-panel { border-top: 1px solid var(--ink); margin-top: 22px; padding-top: 14px; }
.lang-head { display: flex; justify-content: space-between; align-items: baseline; }
.lang-filter { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 6px 0 10px; }
.lang-tab { background: none; border: 0; padding: 0 0 2px; color: var(--graphite); border-bottom: 1px solid transparent; font: inherit; }
.lang-tab.is-active { color: var(--ink); border-bottom-color: var(--binding); }
.lang-list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--rule); }
.lang-item { padding: 10px 0 10px 14px; border-bottom: 1px solid var(--rule-soft); border-left: 3px solid var(--rule); }
.lang-spelling { border-left-color: var(--redpen); }
.lang-grammar { border-left-color: var(--binding); }
.lang-punctuation { border-left-color: var(--pending); }
.lang-style { border-left-color: var(--graphite); }
.lang-item-head { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.lang-kind { font-size: 0.78rem; font-weight: 600; color: var(--graphite); min-width: 84px; }
.lang-msg { font-size: 0.92rem; }
.lang-context { font-family: var(--serif); font-size: 0.92rem; color: var(--ink-soft); margin: 4px 0 4px; }
.lang-context mark { background: rgba(180, 42, 31, 0.12); color: var(--ink); padding: 0 2px; border-bottom: 2px solid var(--redpen); }
.lang-grammar .lang-context mark { background: rgba(92, 27, 38, 0.10); border-bottom-color: var(--binding); }
.lang-punctuation .lang-context mark, .lang-style .lang-context mark { background: rgba(160, 120, 30, 0.12); border-bottom-color: var(--pending); }
.lang-actions { display: flex; gap: 16px; align-items: baseline; flex-wrap: wrap; font-size: 0.86rem; }
.lang-suggest { color: var(--ink-soft); display: inline-flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.lang-use { border: 1px solid var(--rule); background: var(--paper, #fff); color: var(--ink); padding: 1px 8px; font-size: 0.86rem; border-radius: 3px; cursor: pointer; }
.lang-use:focus-visible { border-color: var(--binding); color: var(--binding); }
@media (hover: hover) { .lang-use:hover { border-color: var(--binding); color: var(--binding); } }
.lang-words { margin-top: 12px; }
.lang-words li { padding: 2px 0; }
@media (max-width: 600px) { .editor-bar { padding-left: 16px; flex-wrap: wrap; } }

/* Topic finder */
.topic-trigger { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: baseline; margin-top: 10px; }
.topic-trigger .form-hint { margin: 0; }
.topic-dialog { width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 1px solid var(--rule); border-top: 3px solid var(--binding); border-radius: 2px; background: var(--sheet); color: var(--ink); box-shadow: 0 18px 50px rgba(29, 35, 50, 0.22); }
.topic-dialog::backdrop { background: rgba(29, 35, 50, 0.45); }
.topic-dialog[open] { display: flex; flex-direction: column; overflow: hidden; }
.topic-head { display: flex; justify-content: space-between; align-items: baseline; padding: 18px 24px 10px; border-bottom: 1px solid var(--rule-soft); position: sticky; top: 0; background: var(--sheet); z-index: 1; }
.topic-title { font-family: var(--display); font-weight: 650; font-size: 1.33rem; margin: 0; }
.topic-step { padding: 16px 24px 16px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.topic-busy { margin: 0 24px 14px; padding-left: 14px; border-left: 3px solid var(--pending); color: var(--ink-soft); }
.topic-dialog .note-danger { margin: 0 24px 16px; }
.topic-card { padding: 14px 0; border-bottom: 1px solid var(--rule-soft); }
.topic-card:first-of-type { padding-top: 4px; }
.topic-card-title { font-family: var(--serif); font-weight: 500; font-size: 1.06rem; line-height: 1.3; margin: 0 0 6px; }
.topic-why { margin: 0 0 6px; color: var(--ink-soft); font-size: 0.95rem; }
.topic-meta { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 0 0 8px; }
.topic-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.topic-related { margin-top: 10px; padding: 10px 14px; background: var(--paper); border-left: 2px solid var(--rule); }
.topic-related-group + .topic-related-group { margin-top: 10px; }
.topic-related-head { font-size: 0.84rem; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--graphite); margin: 0 0 4px; }
.topic-related li { margin-bottom: 4px; }
.topic-note { margin: 12px 0 0; padding-left: 14px; border-left: 3px solid var(--binding); color: var(--ink-soft); }
.topic-round-old { margin-bottom: 10px; border-bottom: 1px solid var(--rule-soft); padding-bottom: 6px; }
.topic-round-old summary { cursor: pointer; color: var(--graphite); }
.topic-refine { margin-top: 18px; padding: 14px 16px; background: var(--paper); border: 1px solid var(--rule-soft); }
.topic-chip { border: 1px solid var(--rule); background: var(--sheet); color: var(--ink); border-radius: 999px; padding: 2px 12px; font-size: 0.86rem; cursor: pointer; }
.topic-chip:focus-visible { border-color: var(--binding); color: var(--binding); }
@media (hover: hover) { .topic-chip:hover { border-color: var(--binding); color: var(--binding); } }
.topic-chip:disabled { opacity: 0.5; cursor: default; }
@media (max-width: 575px) {
  .topic-dialog { width: 100%; max-width: 100%; height: 100%; max-height: 100%; margin: 0; inset: 0; border: 0; border-top: 3px solid var(--binding); }
  .topic-head, .topic-step { padding-left: 16px; padding-right: 16px; }
}
.allowance-bar { height: 6px; background: var(--paper-deep); border-radius: 3px; overflow: hidden; }
.allowance-bar span { display: block; height: 100%; background: var(--binding); }
.helper-mark { font-size: 0.82rem; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--binding); margin: 0 0 2px; }

/* ---------- Sidebar layout for signed-in pages ---------- */
.has-sidebar { --sidebar-w: 252px; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); display: flex; flex-direction: column; background: var(--paper-deep); border-right: 1px solid var(--rule); z-index: 40; }
.sidebar-brand { padding: 20px 22px 16px; border-bottom: 1px solid var(--rule); }
.sidebar-brand .brand { font-size: 1.3rem; }
.sidebar-nav { flex: 1 1 auto; overflow-y: auto; padding: 10px 0 18px; }
.sidebar-group { padding: 10px 0 6px; }
.sidebar-group + .sidebar-group { border-top: 1px solid var(--rule-soft); }
.sidebar-heading { font-size: 0.82rem; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--graphite); margin: 4px 22px 6px; line-height: 1.35; }
.sidebar-project .sidebar-heading { text-transform: none; letter-spacing: 0; font-family: var(--serif); font-size: 0.92rem; font-weight: 500; color: var(--ink); }
.sidebar-project .sidebar-heading span { display: block; font-family: var(--sans); font-size: 0.82rem; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--binding); margin-bottom: 2px; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li a { display: block; padding: 5px 22px 5px 19px; border-left: 3px solid transparent; color: var(--ink-soft); text-decoration: none; font-size: 0.93rem; }
@media (hover: hover) { .sidebar li a:hover { color: var(--ink); background: rgba(29, 35, 50, 0.04); } }
.sidebar li a.is-active { color: var(--ink); font-weight: 500; border-left-color: var(--binding); background: var(--sheet); }
.sidebar li a:focus-visible { outline: none; box-shadow: inset var(--focus); }
.sidebar-user { border-top: 1px solid var(--rule); padding: 14px 22px 18px; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 0.9rem; }
.sidebar-name { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user .link-button { color: var(--graphite); text-decoration: none; font-size: 0.9rem; white-space: nowrap; }
@media (hover: hover) { .sidebar-user .link-button:hover { color: var(--binding); } }
.shell { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.shell > main { flex: 1 0 auto; width: 100%; }
.mobilebar { display: none; }
.sidebar-backdrop { position: fixed; inset: 0; background: rgba(29, 35, 50, 0.4); z-index: 35; }
@media (max-width: 991px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.2s ease; box-shadow: none; width: min(300px, 86vw); }
  .sidebar.is-open { transform: none; box-shadow: 0 0 40px rgba(29, 35, 50, 0.25); }
  .shell { margin-left: 0; }
  .mobilebar { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 56px; padding: 0 16px; border-bottom: 1px solid var(--ink); background: var(--paper); position: sticky; top: 0; z-index: 30; }
  .mobilebar .brand { font-size: 1.25rem; }
  .mobilebar-toggle { border: 1px solid var(--ink); background: var(--sheet); color: var(--ink); padding: 4px 14px; font-size: 0.9rem; border-radius: 2px; }
  .mobilebar-toggle:focus-visible { outline: none; box-shadow: var(--focus); }
}

/* Paper reader */
.paper-intro { max-width: 720px; }
.paper-terms { border-left: 3px solid var(--pending); padding: 4px 0 4px 14px; color: var(--ink-soft); }
.paper-terms ul { padding-left: 18px; }
.paper-terms li { margin-bottom: 4px; }
.paper-card summary { cursor: pointer; list-style: none; display: flex; flex-direction: column; gap: 2px; }
.paper-card summary::-webkit-details-marker { display: none; }
.paper-title { font-family: var(--display); font-size: 1.12rem; font-weight: 650; line-height: 1.3; }
.paper-card[open] summary { padding-bottom: 10px; border-bottom: 1px solid var(--rule-soft); }
.paper-part { margin-top: 14px; }
.paper-part h3 { font-size: 0.8rem; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--graphite); margin: 0 0 4px; }
.paper-part p { margin: 0; }
.paper-part ul { margin: 0; padding-left: 18px; }
.paper-part li { margin-bottom: 4px; }

/* Defence preparation */
.defence-intro { max-width: 760px; }
.defence-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding-bottom: 12px; margin-bottom: 8px; border-bottom: 1px solid var(--rule); }
.defence-area { margin-top: 26px; }
.defence-question { font-family: var(--serif); font-size: 1.08rem; line-height: 1.35; margin: 0 0 6px; display: flex; gap: 12px; }
.defence-no { flex: 0 0 auto; min-width: 1.6em; color: var(--binding); font-variant-numeric: lining-nums tabular-nums; }
.defence-cover summary { cursor: pointer; color: var(--binding); }
.defence-feedback { margin-top: 16px; padding: 12px 16px; background: var(--paper); border-left: 3px solid var(--binding); }
.defence-feedback .paper-part:first-of-type { margin-top: 6px; }
.practice-dialog { width: min(680px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--rule); border-top: 3px solid var(--binding); border-radius: 2px; background: var(--sheet); color: var(--ink); box-shadow: 0 18px 50px rgba(29, 35, 50, 0.22); }
.practice-dialog::backdrop { background: rgba(29, 35, 50, 0.55); }
.practice-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 24px; border-bottom: 1px solid var(--rule-soft); }
.practice-body { padding: 22px 24px 24px; }
.practice-question { font-family: var(--display); font-weight: 650; font-size: 1.43rem; line-height: 1.3; margin: 0 0 18px; }
.practice-timer { font-family: var(--display); font-size: 2.21rem; line-height: 1; margin: 0 0 8px; font-variant-numeric: lining-nums tabular-nums; color: var(--ink); }
.practice-timer.is-over { color: var(--redpen); font-size: 1.6rem; }
.practice-cover { padding: 10px 14px; background: var(--paper); border-left: 2px solid var(--rule); }
.practice-cover ul { margin: 0; padding-left: 18px; }
@media (max-width: 575px) { .practice-dialog { width: 100%; max-width: 100%; height: 100%; max-height: 100%; margin: 0; inset: 0; border: 0; border-top: 3px solid var(--binding); } }

/* Deadlines */
.deadline-intro { max-width: 760px; }
.deadline-table input[type="date"] { max-width: 170px; }
.chapter-due { display: inline-block; margin-top: 4px; font-size: 0.84rem; text-decoration: none; }
@media (hover: hover) { .chapter-due:hover { text-decoration: underline; } }

/* Similarity report PDF and verification */
.sim-pdf { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin: 6px 0 8px; }
.verify-result { border-top: 1px solid var(--rule); padding-top: 14px; }
.verify-list { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; margin: 10px 0; }
.verify-list dt { font-weight: 400; color: var(--graphite); }
.verify-list dd { margin: 0; }

/* Buying tokens */
.tokens-intro { max-width: 760px; }
.token-packages { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin: 6px 0 12px; }
.token-package { background: var(--sheet); border: 1px solid var(--rule); border-top: 3px solid var(--binding); border-radius: 2px; padding: 18px 20px 20px; display: flex; flex-direction: column; }
.token-name { font-size: 0.82rem; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--binding); margin: 0 0 6px; }
.token-amount { font-family: var(--display); font-size: 1.75rem; line-height: 1.1; margin: 0 0 4px; font-variant-numeric: lining-nums tabular-nums; }
.token-amount span { font-size: 1rem; color: var(--graphite); }
.token-price { font-size: 1.15rem; font-weight: 600; margin: auto 0 12px; padding-top: 10px; }
.sidebar-sub { font-size: 0.82rem; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--graphite); margin: 10px 22px 3px; }
.sidebar-project .sidebar-heading + .sidebar-sub { margin-top: 8px; }

/* Sidebar section colours: maroon, green, ochre, blue */
.sidebar { --tone-1: #7a2232; --tone-2: #2e6a43; --tone-3: #8a6514; --tone-4: #2f5585; }
.sidebar-heading.tone-1, .sidebar-heading.tone-2, .sidebar-heading.tone-3, .sidebar-heading.tone-4,
.sidebar-sub { display: flex; align-items: center; gap: 8px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; }
.sidebar-heading.tone-1::before, .sidebar-heading.tone-2::before, .sidebar-heading.tone-3::before, .sidebar-heading.tone-4::before,
.sidebar-sub::before { content: ""; width: 10px; height: 3px; border-radius: 2px; background: currentColor; flex: 0 0 auto; }
.tone-1 { color: var(--tone-1) !important; }
.tone-2 { color: var(--tone-2) !important; }
.tone-3 { color: var(--tone-3) !important; }
.tone-4 { color: var(--tone-4) !important; }
.sidebar-sub { margin: 14px 22px 4px; }
.text-danger-ink { color: var(--redpen); }
.model-prices input { width: 72px; }

/* Logo mark beside the name */
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand-mark { width: 28px; height: 28px; flex: 0 0 auto; border-radius: 6px; }
.auth-mark .brand-mark { width: 36px; height: 36px; border-radius: 8px; }
.sidebar-brand .brand-mark { width: 26px; height: 26px; }
.mobilebar .brand-mark { width: 24px; height: 24px; }

/* Assignments */
.assign-intro { max-width: var(--measure); margin-bottom: 1.25rem; }
.assign-card { display: block; padding: 14px 16px; margin-bottom: 10px; background: var(--sheet); border: 1px solid var(--rule); border-left: 3px solid var(--binding); border-radius: 2px; color: var(--ink); text-decoration: none; }
@media (hover: hover) { .assign-card:hover { border-color: var(--graphite); border-left-color: var(--binding-hover); color: var(--ink); } }
.assign-card-title { display: block; font-family: var(--serif); font-size: 1.08rem; font-weight: 500; line-height: 1.3; }
.assign-card-meta { display: block; margin-top: 2px; }
.assign-card-foot { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin-top: 8px; color: var(--graphite); }
.guide { max-width: 72ch; }
.guide-task { font-family: var(--serif); font-size: 1.03rem; line-height: 1.45; padding: 10px 14px; margin-bottom: 1rem; background: var(--binding-tint); border-left: 3px solid var(--binding); }
.guide-part { margin-bottom: 1.1rem; }
.guide-part h3 { font-size: 0.82rem; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--binding); margin: 0 0 6px; }
.guide-part ul, .guide-outline { padding-left: 1.2rem; margin-bottom: 0; }
.guide-part li { margin-bottom: 4px; }
.guide-dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0; }
.guide-dl dt { font-weight: 600; }
.guide-dl dd { margin: 0; }
.guide-outline li { margin-bottom: 8px; }
.guide-outline li div { color: var(--ink-soft); }
.guide-check { list-style: none; padding-left: 0 !important; }
.guide-check li { position: relative; padding-left: 26px; }
.guide-check li::before { content: ""; position: absolute; left: 0; top: 4px; width: 15px; height: 15px; border: 1.5px solid var(--approve); border-radius: 2px; }
@media (max-width: 575px) { .guide-dl { grid-template-columns: 1fr; } .guide-dl dd { margin-bottom: 6px; } }

/* Assignment marking report */
.readiness { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; margin: 4px 0 1.1rem; border-left: 3px solid var(--pending); background: var(--pending-tint); }
.readiness strong { font-family: var(--display); font-size: 1.1rem; font-weight: 650; }
.readiness span { font-size: 0.9rem; color: var(--ink-soft); }
.readiness-ready { border-left-color: var(--approve); background: var(--approve-tint); }
.readiness-redraft { border-left-color: var(--redpen); background: var(--binding-tint); }
.report-head { font-size: 0.82rem; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--graphite); margin: 1.1rem 0 6px; }
.report-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.report-table th, .report-table td { padding: 8px 10px 8px 0; border-top: 1px solid var(--rule-soft); vertical-align: top; text-align: left; }
.report-table th { font-weight: 600; width: 30%; }
.report-band { width: 1%; white-space: nowrap; }
.coverage-list, .accuracy-list, .small-list { list-style: none; padding: 0; margin: 0; font-size: 0.92rem; }
.coverage-list li { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; padding: 6px 0; border-top: 1px solid var(--rule-soft); }
.coverage-part { flex: 1 1 220px; }
.accuracy-list li, .small-list li { padding: 6px 0 6px 14px; border-top: 1px solid var(--rule-soft); position: relative; }
.small-list li::before { content: ""; position: absolute; left: 0; top: 14px; width: 5px; height: 5px; border-radius: 50%; background: var(--graphite); }
.accuracy-list li { border-left: 2px solid var(--pending); padding-left: 12px; margin-bottom: 4px; }
.accuracy-check { display: block; color: var(--ink-soft); font-size: 0.88rem; margin-top: 2px; }
.para-ref { display: inline-block; min-width: 1.6em; padding: 0 5px; margin: 0 1px; border: 1px solid var(--rule); border-radius: 2px; background: var(--sheet); font: inherit; line-height: 1.4; text-align: center; color: var(--binding); cursor: pointer; }
.para-ref:focus-visible { border-color: var(--binding); background: var(--binding-tint); outline: none; }
@media (hover: hover) { .para-ref:hover { border-color: var(--binding); background: var(--binding-tint); outline: none; } }
@media (max-width: 575px) {
  .report-table, .report-table tbody, .report-table tr, .report-table th, .report-table td { display: block; width: auto; }
  .report-table tr { border-top: 1px solid var(--rule-soft); padding: 8px 0; }
  .report-table th, .report-table td { border: 0; padding: 2px 0; }
}

/* Background web check */
.web-job { border-left: 3px solid var(--binding); }
.web-job .allowance-bar span { transition: width 0.6s ease; }
.web-job-failed { border-left-color: var(--redpen); }
.web-job-failed .web-job-status { color: var(--redpen); }

/* Listen and dictate bar above the editor */
.voice-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; padding: 10px 56px; border-bottom: 1px solid var(--rule-soft); font-size: 0.86rem; color: var(--ink-soft); }
.voice-group { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.voice-btn { border: 1px solid var(--rule); background: var(--sheet); color: var(--ink); border-radius: 2px; padding: 3px 11px; font: inherit; line-height: 1.5; cursor: pointer; }
.voice-btn:focus-visible { border-color: var(--binding); outline: none; }
@media (hover: hover) { .voice-btn:hover { border-color: var(--binding); outline: none; } }
.voice-btn.is-live { background: var(--binding); border-color: var(--binding); color: #fff; }
.voice-btn.is-live::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: #fff; vertical-align: 1px; animation: voice-pulse 1.2s ease-in-out infinite; }
.voice-speed { display: inline-flex; align-items: center; gap: 5px; margin: 0; color: var(--graphite); }
.voice-speed select { border: 1px solid var(--rule); background: var(--sheet); color: var(--ink); border-radius: 2px; padding: 2px 4px; font: inherit; }
.voice-note { flex: 1 1 100%; min-height: 1.2em; color: var(--graphite); font-style: italic; }
.voice-note:empty { display: none; }
@keyframes voice-pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .voice-btn.is-live::before { animation: none; } }
@media (max-width: 575px) { .voice-bar { padding: 10px 18px; } }

/* Writing record */
.writing-record { margin-top: 1.5rem; }
.wr-bar { display: flex; height: 12px; border-radius: 2px; overflow: hidden; background: var(--paper-deep); margin: 6px 0 8px; }
.wr-bar span { display: block; height: 100%; }
.wr-bar-sm { height: 8px; margin: 2px 0 3px; min-width: 120px; }
.wr-typed { background: #3a4152; }
.wr-dictated { background: var(--approve); }
.wr-talk { background: var(--pending); }
.wr-pasted { background: var(--redpen); }
.wr-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; list-style: none; padding: 0; margin: 0; color: var(--ink-soft); }
.wr-key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.wr-pastes { list-style: none; padding: 0; margin: 0; }
.wr-pastes li { padding: 5px 0 5px 12px; border-left: 2px solid var(--redpen); margin-bottom: 4px; }
.table-group th { background: var(--paper-deep); font-size: 0.82rem; letter-spacing: 0; text-transform: none; color: var(--graphite); font-weight: 600; }

/* Talk it through */
.talk-question { font-family: var(--serif); font-size: 1.12rem; line-height: 1.4; margin: 0 0 10px; }
.talk-answer { font-size: 1rem; line-height: 1.6; }
.talk-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-top: 10px; }
.talk-nav { display: inline-flex; gap: 6px; align-items: center; margin-left: auto; }
.talk-result { max-height: 46vh; overflow-y: auto; padding: 14px 18px; background: var(--sheet); border: 1px solid var(--rule); border-left: 3px solid var(--pending); font-family: var(--serif); font-size: 0.97rem; line-height: 1.65; }
.talk-result p:last-child { margin-bottom: 0; }
.talk-dialog .voice-btn { font-size: 0.88rem; }

/* Topics close to a project title */
.topic-matches { margin: 0 0 1.25rem; padding: 12px 16px; background: var(--sheet); border: 1px solid var(--rule); border-left: 3px solid var(--graphite); border-radius: 2px; }
.topic-matches-close { border-left-color: var(--pending); background: var(--pending-tint); }
.topic-matches-title { font-size: 0.8rem; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--ink-soft); margin: 0 0 6px; }
.topic-match-list li { padding: 6px 0; border-top: 1px solid var(--rule-soft); }
.topic-match-list li:first-child { border-top: 0; }
.topic-match-list li.is-close .tm-title, .topic-match-list li.is-close a { font-weight: 600; }
.topic-live { margin-top: 8px; padding: 8px 12px; border-left: 3px solid var(--graphite); background: var(--sheet); }
.topic-live-close { border-left-color: var(--pending); background: var(--pending-tint); }
.topic-live li { padding: 3px 0; }
.topic-taken { margin: 0 0 6px; padding: 4px 8px; border-left: 3px solid var(--pending); background: var(--pending-tint); color: var(--ink); }

/* ---------- Word-style page editor ---------- */
.doc-shell { position: relative; border-bottom: 1px solid var(--rule-soft); background: #e3e5e8; }
.doc-shell[hidden] { display: none; }
.ribbon { background: #f6f5f2; border-bottom: 1px solid var(--rule); font-family: var(--sans); color: var(--ink); }
.rb-tabs { display: flex; align-items: flex-end; gap: 2px; padding: 4px 8px 0; overflow-x: auto; scrollbar-width: none; }
.rb-tabs::-webkit-scrollbar { display: none; }
.rb-tab { border: 0; background: none; padding: 7px 14px 8px; font-size: 0.86rem; color: var(--ink-soft); border-bottom: 3px solid transparent; white-space: nowrap; cursor: pointer; }
@media (hover: hover) { .rb-tab:hover { color: var(--ink); background: rgba(29, 35, 50, 0.05); } }
.rb-tab.is-active { color: var(--binding); border-bottom-color: var(--binding); font-weight: 600; }
.rb-tab-context { color: var(--approve); }
.rb-tab-context.is-active { color: var(--approve); border-bottom-color: var(--approve); }
.rb-panels { background: #fbfaf8; border-top: 1px solid var(--rule-soft); }
.rb-panel { display: flex; align-items: stretch; overflow-x: auto; padding: 4px 4px 0; min-height: 96px; }
.rb-panel[hidden] { display: none; }
.rb-group { display: flex; flex-direction: column; justify-content: space-between; padding: 2px 8px 0; border-right: 1px solid var(--rule-soft); flex: none; }
.rb-group[hidden] { display: none; }
.rb-group:last-child { border-right: 0; }
.rb-group-body { display: flex; flex-direction: column; gap: 3px; flex: 1; justify-content: center; }
.rb-group-body:has(> .rb-big), .rb-group-body:has(> .rb-stack), .rb-group-body:has(> .rb-styles) { flex-direction: row; align-items: stretch; gap: 3px; }
.rb-group-body[data-slot] { flex-direction: row; align-items: center; }
.rb-group-label { font-size: 0.7rem; color: var(--graphite); text-align: center; padding: 3px 0 4px; white-space: nowrap; }
.rb-row { display: flex; align-items: center; gap: 2px; }
.rb-stack { display: flex; flex-direction: column; justify-content: center; gap: 1px; }
.rb-btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 28px; height: 28px; padding: 0 4px; border: 1px solid transparent; border-radius: 3px; background: none; color: var(--ink); font-size: 0.8rem; cursor: pointer; line-height: 1; }
@media (hover: hover) { .rb-btn:hover { background: #ebe7df; border-color: #ddd6c9; } }
.rb-btn:focus-visible { outline: none; box-shadow: var(--focus); }
.rb-btn[aria-pressed="true"] { background: #e7dcda; border-color: #c9b2ae; }
.rb-btn[aria-expanded="true"] { background: #ebe7df; }
.rb-icon { display: inline-flex; width: 22px; height: 22px; align-items: center; justify-content: center; }
.rb-icon svg { width: 22px; height: 22px; fill: currentColor; }
.rb-labelled, .rb-stack .rb-btn { justify-content: flex-start; height: 25px; padding-right: 8px; }
.rb-stack .rb-icon, .rb-stack .rb-icon svg { width: 18px; height: 18px; }
.rb-big { flex-direction: column; height: auto; min-height: 66px; min-width: 54px; padding: 4px 6px; gap: 3px; }
.rb-big .rb-icon, .rb-big .rb-icon svg { width: 30px; height: 30px; }
.rb-big .rb-label { font-size: 0.74rem; white-space: nowrap; max-width: 90px; white-space: normal; text-align: center; line-height: 1.15; }
.rb-split { display: inline-flex; align-items: center; }
.rb-split .rb-btn:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; padding-right: 2px; }
.rb-arrow { min-width: 14px; width: 14px; padding: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.rb-caret { width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid currentColor; }
.rb-swatched { position: relative; }
.rb-swatched::after { content: ""; position: absolute; left: 5px; right: 3px; bottom: 2px; height: 4px; background: var(--swatch, #c00000); border-radius: 1px; }
.rb-select { height: 26px; border: 1px solid #cfc8bb; border-radius: 3px; background: #fff; font-size: 0.8rem; color: var(--ink); padding: 0 4px; }
.rb-select:focus { outline: none; box-shadow: var(--focus); }
.rb-font { width: 138px; }
.rb-size { width: 58px; }
.rb-zoom { width: 104px; }
.rb-styles { display: flex; gap: 4px; align-items: stretch; padding: 2px 0; }
.rb-style { width: 70px; border: 1px solid #ddd6c9; background: #fff; border-radius: 3px; font-family: "Times New Roman", Times, serif; color: var(--ink); padding: 4px 5px; text-align: left; font-size: 0.74rem; line-height: 1.2; cursor: pointer; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
@media (hover: hover) { .rb-style:hover { border-color: #b9ad9b; } }
.rb-style[aria-pressed="true"] { border-color: var(--binding); box-shadow: inset 0 0 0 1px var(--binding); }
.rb-style-h1 { font-size: 0.8rem; font-weight: 700; }
.rb-style-h2 { font-weight: 700; }
.rb-style-h3 { font-weight: 700; font-style: italic; }
.rb-style-blockquote { font-style: italic; }
.rb-pop { position: absolute; z-index: 60; background: #fff; border: 1px solid var(--rule); border-radius: 3px; box-shadow: 0 10px 28px -10px rgba(29, 35, 50, 0.35); padding: 6px; min-width: 180px; font-family: var(--sans); }
.rb-pop[hidden] { display: none; }
.rb-menu { display: flex; flex-direction: column; }
.rb-menu-item { display: flex; align-items: center; gap: 8px; text-align: left; border: 0; background: none; padding: 6px 10px; font-size: 0.86rem; color: var(--ink); border-radius: 2px; cursor: pointer; white-space: pre; }
.rb-menu-item:focus-visible { background: #f1ede6; outline: none; }
@media (hover: hover) { .rb-menu-item:hover { background: #f1ede6; outline: none; } }
.rb-swatches { display: grid; grid-template-columns: repeat(5, 24px); gap: 4px; padding: 6px 10px; }
.rb-swatch { width: 24px; height: 24px; border: 1px solid #bdb5a6; border-radius: 2px; cursor: pointer; padding: 0; }
.rb-swatch:focus-visible { outline: 2px solid var(--binding); outline-offset: 1px; }
@media (hover: hover) { .rb-swatch:hover { outline: 2px solid var(--binding); outline-offset: 1px; } }
.rb-more input { width: 30px; height: 22px; border: 0; padding: 0; background: none; cursor: pointer; }
.rb-grid-label { font-size: 0.8rem; color: var(--graphite); margin: 2px 4px 6px; }
.rb-grid { display: grid; grid-template-columns: repeat(10, 16px); gap: 2px; padding: 0 4px 6px; }
.rb-grid-cell { width: 16px; height: 16px; border: 1px solid #bdb5a6; background: #fff; padding: 0; cursor: pointer; }
.rb-grid-cell.is-on { background: #e7dcda; border-color: var(--binding); }
.rb-note { margin: 0; padding: 6px 14px; font-size: 0.84rem; background: var(--pending-tint); color: #5d4614; border-bottom: 1px solid #e6d7b2; font-family: var(--sans); }
.doc-area { background: #e3e5e8; }
.doc-area .tox-tinymce { border: 0; border-radius: 0; }
.doc-status { display: flex; justify-content: space-between; gap: 12px; padding: 4px 14px; font-size: 0.78rem; color: var(--graphite); background: #f6f5f2; border-top: 1px solid var(--rule-soft); font-family: var(--sans); font-variant-numeric: tabular-nums; }
.doc-shell .voice-bar { margin: 0; padding: 0; border: 0; background: none; flex-wrap: nowrap; }
.doc-full { position: fixed; inset: 0; z-index: 1040; display: flex; flex-direction: column; border: 0; }
.doc-full .doc-area { flex: 1; }
html.doc-full-open { overflow: hidden; }
.editor-form:has(.doc-shell:not([hidden])) .editor-bar { padding-left: 16px; }
.doc-body { font-family: "Times New Roman", Times, serif; font-size: 1.12rem; line-height: 1.6; }
.doc-body h1, .doc-body h2, .doc-body h3, .doc-body h4 { font-family: inherit; font-weight: 700; margin: 1.1em 0 0.4em; }
.doc-body h1 { font-size: 1.3rem; }
.doc-body h2 { font-size: 1.18rem; }
.doc-body h3, .doc-body h4 { font-size: 1.06rem; }
.doc-body table { border-collapse: collapse; margin: 0.4em 0 1em; max-width: 100%; }
.doc-body td, .doc-body th { border: 1px solid #000; padding: 3px 7px; vertical-align: top; }
.doc-body td > p:last-child, .doc-body th > p:last-child { margin: 0; }
.doc-body img { max-width: 100%; height: auto; }
.doc-body blockquote { margin: 0 0 1em 1.27cm; }
.doc-body .page-break { border-top: 1px dashed var(--rule); margin: 1.4em 0; }
@media (max-width: 720px) {
  .rb-panel { min-height: 88px; }
  .rb-font { width: 118px; }
}
.rb-cite { max-width: min(520px, 92vw); max-height: 360px; overflow-y: auto; }
.rb-cite-row { padding: 6px 4px; border-bottom: 1px solid var(--rule-soft); }
.rb-cite-title { display: block; font-size: 0.78rem; color: var(--graphite); margin: 0 6px 2px; }
.rb-cite-buttons { display: flex; flex-wrap: wrap; gap: 2px; }
.rb-cite-use { padding: 4px 8px; white-space: normal; }
.section-layout:has(.doc-shell:not([hidden])) { grid-template-columns: minmax(0, 1fr); gap: 32px; }
.section-layout:has(.doc-shell:not([hidden])) .section-main { max-width: none; }
.section-layout:has(.doc-shell:not([hidden])) .guidance { max-width: 860px; }
.section-layout:has(.doc-shell:not([hidden])) .section-side { position: static; padding-top: 0; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); align-items: start; gap: 28px; }
.side-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; align-items: start; margin-top: 8px; }
.side-row > * { margin: 0; }
.rb-quick { display: inline-flex; gap: 1px; align-self: center; padding: 0 8px 3px 0; margin-right: 6px; border-right: 1px solid var(--rule-soft); }
.rb-quick .rb-btn { min-width: 26px; height: 26px; }
.rb-quick .rb-icon, .rb-quick .rb-icon svg { width: 20px; height: 20px; }
.rb-styles .rb-style { max-height: 62px; }

/* ---------- Study slides ---------- */
.study-wrap { max-width: 860px; }
.study-wrap > .panel, .study-wrap > form, .study-wrap > .form-hint { margin-bottom: 18px; }
.study-part-range { font-size: 0.82rem; letter-spacing: 0; text-transform: none; color: var(--graphite); margin: 0 0 4px; }
.study-points { padding-left: 1.2rem; margin-bottom: 12px; }
.study-points li { margin-bottom: 6px; }
.study-ref { font-size: 0.82rem; color: var(--graphite); white-space: nowrap; }
.study-ref a { color: var(--binding); }
.study-terms { display: grid; grid-template-columns: minmax(120px, 28%) 1fr; gap: 6px 18px; margin: 0 0 12px; }
.study-terms dt { font-weight: 600; }
.study-terms dd { margin: 0; }
.study-overview { border-left: 3px solid var(--binding); }
.study-set { margin-bottom: 28px; }
.study-set-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.study-q { margin-bottom: 12px; }
.study-q-meta { display: flex; gap: 8px; align-items: center; margin: 0 0 6px; color: var(--graphite); }
.study-q-text { font-family: var(--serif); font-size: 1.01rem; line-height: 1.5; margin: 0 0 10px; }
.study-options { display: grid; gap: 6px; margin-bottom: 10px; }
.study-option { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--rule-soft); border-radius: 2px; cursor: pointer; background: var(--sheet); }
@media (hover: hover) { .study-option:hover { border-color: var(--rule); } }
.study-option input { margin-top: 4px; accent-color: var(--binding); }
.study-option:has(input:checked) { border-color: var(--binding); background: var(--binding-tint); }
.study-q textarea { margin-bottom: 10px; }
.study-q-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.study-result { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--rule-soft); }
.study-unit { padding: 16px 0; border-bottom: 1px solid var(--rule-soft); scroll-margin-top: 16px; }
.study-unit:target { background: var(--binding-tint); padding-left: 12px; padding-right: 12px; }
.study-unit-no { font-family: var(--sans); font-size: 0.82rem; letter-spacing: 0; text-transform: none; color: var(--graphite); margin: 0 0 6px; }
.study-unit-text { font-family: var(--serif); font-size: 0.95rem; line-height: 1.6; }
@media (max-width: 720px) {
  .study-terms { grid-template-columns: 1fr; }
  .study-terms dd { margin-bottom: 8px; }
}
.study-verdict { font-size: 0.92rem; }

/* ---------- Sign-in card ---------- */
.auth-body { background: radial-gradient(circle at 50% 0%, #fbf8f3 0%, var(--paper) 45%, var(--paper-deep) 100%); min-height: 100vh; }
.auth-wrap { max-width: 440px; padding: 48px 20px 64px; }
.auth-mark { border-bottom: 0; margin-bottom: 18px; padding-bottom: 0; }
.auth-card {
  background: linear-gradient(0deg, #ffffff 0%, #f6f1ea 100%);
  border: 5px solid #ffffff;
  border-radius: 40px;
  padding: 28px 34px 30px;
  box-shadow: rgba(92, 27, 38, 0.28) 0 30px 30px -20px;
}
.auth-card .auth-title { color: var(--binding); }
.auth-title-center { text-align: center; font-weight: 600; margin-bottom: 4px; }
.auth-card .form-control, .auth-card .form-select, .auth-input {
  width: 100%;
  background-color: #ffffff;
  border: 1px solid transparent;
  border-inline-width: 2px;
  border-radius: 20px;
  padding: 14px 20px;
  box-shadow: rgba(92, 27, 38, 0.12) 0 10px 10px -5px;
  font-size: 0.98rem;
  color: var(--ink);
}
.auth-input { display: block; margin-top: 15px; }
.auth-card .form-select { padding-right: 44px; background-position: right 18px center; }
.auth-card .form-control::placeholder, .auth-input::placeholder { color: #a9a39a; }
.auth-card .form-control:focus, .auth-card .form-select:focus, .auth-input:focus { outline: none; box-shadow: rgba(92, 27, 38, 0.12) 0 10px 10px -5px; border-inline-color: var(--binding); }
.auth-form { margin-top: 18px; }
.auth-forgot { display: block; margin: 10px 0 0 10px; }
.auth-forgot a { font-size: 0.8rem; color: var(--binding); text-decoration: none; }
@media (hover: hover) { .auth-forgot a:hover { text-decoration: underline; } }
.auth-button, .auth-card .btn-primary {
  display: block;
  width: 100%;
  font-weight: 600;
  background: linear-gradient(45deg, var(--binding) 0%, #8a3341 100%);
  color: #ffffff;
  padding-block: 14px;
  margin: 20px auto 6px;
  border-radius: 20px;
  /* Transparent, so forced-colours mode, which drops shadows, still draws the button's edge */
  border: 1px solid transparent;
  box-shadow: rgba(92, 27, 38, 0.35) 0 20px 10px -15px;
  -webkit-tap-highlight-color: transparent;
  transition-property: transform, box-shadow;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}
@media (hover: hover) {
  .auth-button:hover, .auth-card .btn-primary:hover { background: linear-gradient(45deg, var(--binding-hover) 0%, #7a2a37 100%); color: #ffffff; box-shadow: rgba(92, 27, 38, 0.35) 0 23px 10px -20px; }
}
/* Movement only for people who have not asked their device to reduce motion */
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .auth-button:not(:disabled):hover, .auth-card .btn-primary:not(:disabled):hover { transform: scale(1.03); }
}
@media (prefers-reduced-motion: no-preference) {
  .auth-button:not(:disabled):active, .auth-card .btn-primary:not(:disabled):active { transform: scale(0.96); box-shadow: rgba(92, 27, 38, 0.35) 0 15px 10px -10px; }
}
.auth-button:focus-visible, .auth-card .btn-primary:focus-visible { outline: none; box-shadow: var(--focus), rgba(92, 27, 38, 0.35) 0 20px 10px -15px; }
.auth-button:disabled, .auth-card .btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.auth-alt { border-top: 0; padding-top: 0; }
.auth-alt-center { text-align: center; font-size: 0.86rem; color: var(--graphite); margin-top: 16px; }
.auth-alt-center a { color: var(--binding); }
@media (max-width: 480px) { .auth-card { padding: 22px 20px 24px; border-radius: 28px; } }

/* Scrolling inside dialogs, menus and lists stops at their end instead of moving the page behind */
.topic-step, .talk-result, .rb-cite, .sidebar-nav, .cite-list { overscroll-behavior: contain; }
/* Students' pictures get a faint edge so white charts do not melt into the white page */
.doc-body img, .doc img { outline: 1px solid oklch(0 0 0 / 0.1); outline-offset: -1px; }

/* ---------- Home ----------
   One bold element: the kente weave. Depth only where work is shown as paper: the stacked
   sheets in the opening and the draft on the desk. Everything else stays quiet and left aligned. */
.home {
  --hm-maroon: #5c1b26;
  --hm-gold: #d9a21b;
  --hm-green: #1e6b47;
  --hm-ink: #1d2332;
  --hm-desk: #eceef1;
  --hm-kente: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='64' viewBox='0 0 96 64'%3E%3Crect width='96' height='64' fill='%235C1B26'/%3E%3Crect x='3' width='42' height='32' fill='%23D9A21B'/%3E%3Crect x='3' y='5' width='42' height='3' fill='%231E6B47'/%3E%3Crect x='3' y='13' width='42' height='6' fill='%235C1B26'/%3E%3Crect x='3' y='24' width='42' height='3' fill='%231E6B47'/%3E%3Cpath d='M24 37l7 11-7 11-7-11z' fill='%23D9A21B'/%3E%3Cpath d='M24 43l3 5-3 5-3-5z' fill='%231E6B47'/%3E%3Crect x='51' y='32' width='42' height='32' fill='%23D9A21B'/%3E%3Crect x='51' y='37' width='42' height='3' fill='%231E6B47'/%3E%3Crect x='51' y='45' width='42' height='6' fill='%235C1B26'/%3E%3Crect x='51' y='56' width='42' height='3' fill='%231E6B47'/%3E%3Crect x='51' y='11' width='42' height='10' fill='%231D2332'/%3E%3Cpath d='M51 18l5-4 5 4 5-4 5 4 5-4 5 4 5-4 5 4' stroke='%23D9A21B' stroke-width='1.6' fill='none'/%3E%3Crect width='3' height='64' fill='%23D9A21B'/%3E%3Crect x='45' width='6' height='64' fill='%231E6B47'/%3E%3Crect x='47' width='2' height='64' fill='%23D9A21B'/%3E%3Crect x='93' width='3' height='64' fill='%23D9A21B'/%3E%3C/svg%3E");
  background: #ffffff;
  color: var(--hm-ink);
  font-size: 1.04rem;
}
.hm-wrap { max-width: 1200px; margin: 0 auto; padding: 0 28px; }
.hm-bar { position: sticky; top: 0; z-index: 20; background: rgba(255, 255, 255, 0.94); backdrop-filter: blur(8px); border-bottom: 1px solid #e6e7ea; }
.hm-bar-inner { display: flex; align-items: center; gap: 28px; min-height: 68px; }
.hm-nav { display: flex; gap: 24px; margin-right: auto; margin-left: 18px; }
.hm-nav a, .hm-signin { color: var(--ink-soft); text-decoration: none; font-weight: 500; font-size: 0.97rem; }
.hm-bar-actions { display: flex; align-items: center; gap: 18px; }
@media (hover: hover) { .hm-nav a:hover, .hm-signin:hover { color: var(--hm-maroon); } }

.hm-btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 14px 26px; border-radius: 14px; border: 1px solid transparent;
  background: linear-gradient(160deg, #73273a 0%, var(--hm-maroon) 60%);
  color: #ffffff; font-weight: 600; text-decoration: none; font-size: 1rem;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.18) inset, 0 10px 18px -10px rgba(92, 27, 38, 0.7), 0 2px 4px rgba(92, 27, 38, 0.25);
  -webkit-tap-highlight-color: transparent;
  transition-property: transform, box-shadow; transition-duration: 150ms; transition-timing-function: ease-out;
}
.hm-btn-small { padding: 9px 16px; border-radius: 11px; font-size: 0.94rem; white-space: nowrap; }
@media (hover: hover) { .hm-btn:hover { color: #ffffff; box-shadow: 0 1px 0 rgba(255, 255, 255, 0.18) inset, 0 14px 22px -10px rgba(92, 27, 38, 0.75), 0 2px 4px rgba(92, 27, 38, 0.25); } }
@media (prefers-reduced-motion: no-preference) { .hm-btn:active { transform: scale(0.96); } }
.hm-btn:focus-visible { outline: 3px solid var(--hm-gold); outline-offset: 3px; color: #ffffff; }
.hm-btn-ghost { background: #ffffff; color: var(--hm-maroon); border: 1px solid rgba(92, 27, 38, 0.35); box-shadow: 0 1px 2px rgba(29, 35, 50, 0.06), 0 8px 16px -10px rgba(92, 27, 38, 0.35); }
@media (hover: hover) { .hm-btn-ghost:hover { color: var(--hm-maroon); background: #fbf3f4; border-color: var(--hm-maroon); } }
.hm-btn-ghost:focus-visible { color: var(--hm-maroon); }
.hm-link { color: var(--hm-maroon); font-weight: 600; text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }

/* Opening */
.hm-hero { padding: 72px 0 64px; overflow: hidden; background: radial-gradient(1200px 520px at 85% 30%, #f5ecee 0%, rgba(255, 255, 255, 0) 70%); }
.hm-hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 56px; align-items: center; }
.hm-hero-title { font-family: var(--display); font-weight: 680; font-size: clamp(2.3rem, 4.4vw, 3.7rem); line-height: 1.04; letter-spacing: -0.015em; font-variation-settings: "opsz" 96; margin: 0 0 22px; max-width: 17ch; }
.hm-hero-sub { font-size: 1.15rem; line-height: 1.6; color: var(--ink-soft); max-width: 50ch; margin: 0 0 30px; }
.hm-hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 24px; }
.hm-hero-note { margin: 22px 0 0; font-size: 0.92rem; color: var(--graphite); }

/* The stacked sheets */
.hm-stack { position: relative; height: 470px; perspective: 1500px; }
.hm-sheet {
  position: absolute; background: #ffffff; border-radius: 14px; border: 1px solid rgba(29, 35, 50, 0.08);
  box-shadow: 0 1px 2px rgba(29, 35, 50, 0.06), 0 8px 16px -6px rgba(29, 35, 50, 0.12), 0 32px 56px -24px rgba(92, 27, 38, 0.32);
  transform-style: preserve-3d;
}
.hm-sheet-page { left: 0; top: 56px; width: 64%; transform: rotateY(-14deg) rotateX(7deg) rotateZ(1.5deg) translateZ(60px); overflow: hidden; }
.hm-sheet-report { right: 0; top: 0; width: 42%; padding: 18px 20px; transform: rotateY(-14deg) rotateX(7deg) rotateZ(3deg) translateZ(-20px); }
.hm-sheet-sim { right: 3%; bottom: 10px; width: 40%; padding: 18px 20px; transform: rotateY(-14deg) rotateX(7deg) rotateZ(-4deg) translateZ(-60px); background: #fbf7f2; }
.hm-card-name { font-family: var(--display); font-weight: 650; font-size: 1rem; margin: 0 0 10px; }
.hm-card-foot { margin: 10px 0 0; font-size: 0.8rem; color: var(--graphite); }
.hm-sim-figure { margin: 0 0 10px; font-size: 0.9rem; color: var(--ink-soft); }
.hm-sim-figure strong { font-family: var(--display); font-size: 1.8rem; color: var(--hm-green); margin-right: 6px; }
.hm-sim-bars { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: #e9e4dc; }
.hm-sim-bars span:nth-child(1) { background: var(--hm-green); }
.hm-sim-bars span:nth-child(2) { background: var(--hm-gold); }
.hm-sim-bars span:nth-child(3) { background: var(--hm-maroon); }
.hm-criteria { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; font-size: 0.86rem; }
.hm-criteria li { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.hm-tag { font-weight: 600; font-size: 0.76rem; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.hm-tag-ok { background: #e3f0e8; color: var(--hm-green); }
.hm-tag-mid { background: #f8edd3; color: #8a6210; }
.hm-tag-low { background: #f6e1e3; color: var(--hm-maroon); }
.hm-ribbon { display: flex; gap: 2px; padding: 8px 12px 0; background: #f6f5f2; font-size: 0.74rem; color: var(--graphite); }
.hm-ribbon span { padding: 4px 9px 6px; }
.hm-ribbon .is-on { color: var(--hm-maroon); font-weight: 600; box-shadow: inset 0 -2px 0 var(--hm-maroon); }
.hm-tools { display: flex; gap: 6px; padding: 9px 12px; background: #fbfaf8; border-bottom: 1px solid #ecebe8; }
.hm-tools i { width: 16px; height: 14px; border-radius: 3px; background: #d9d5ce; }
.hm-tools i.hm-gap { margin-left: 10px; }
.hm-page { padding: 22px 28px 6px; font-family: "Times New Roman", Times, serif; font-size: 0.93rem; line-height: 1.6; color: #222; }
.hm-page p { margin: 0 0 10px; }
.hm-page-h { font-weight: 700; font-size: 1rem; }
.hm-page mark { background: rgba(217, 162, 27, 0.28); padding: 0 1px; }
.hm-page-foot { display: flex; justify-content: space-between; margin: 0; padding: 8px 14px; font-size: 0.74rem; color: var(--graphite); background: #f6f5f2; }
@media (prefers-reduced-motion: no-preference) {
  .hm-sheet { animation: hm-settle 700ms cubic-bezier(0.2, 0, 0, 1) both; }
  .hm-sheet-report { animation-delay: 120ms; }
  .hm-sheet-page { animation-delay: 240ms; }
}
@keyframes hm-settle { from { opacity: 0; translate: 0 18px; } to { opacity: 1; translate: 0 0; } }

/* The kente weave */
.hm-kente { height: 44px; background-image: var(--hm-kente); background-size: 72px 48px; background-repeat: repeat-x; box-shadow: inset 0 6px 8px -6px rgba(0, 0, 0, 0.35), inset 0 -6px 8px -6px rgba(0, 0, 0, 0.35); }
.hm-kente-thin { height: 14px; background-size: 42px 28px; box-shadow: none; }

.hm-h2 { font-family: var(--display); font-weight: 700; font-size: clamp(1.75rem, 3vw, 2.5rem); line-height: 1.08; letter-spacing: -0.012em; font-variation-settings: "opsz" 72; margin: 0 0 14px; max-width: 26ch; }
.hm-lead { font-size: 1.1rem; line-height: 1.6; color: var(--ink-soft); max-width: 56ch; margin: 0 0 8px; }

/* Plan, write, check, finish */
.hm-journey { padding: 88px 0 80px; }
.hm-stages { list-style: none; margin: 44px 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; position: relative; }
.hm-stages::before { content: ""; position: absolute; left: 0; right: 0; top: 13px; height: 6px; border-radius: 3px; background-image: var(--hm-kente); background-size: 24px 16px; opacity: 0.9; }
.hm-stage { position: relative; padding: 44px 26px 0 0; }
.hm-stage::before { content: ""; position: absolute; left: 0; top: 6px; width: 20px; height: 20px; border-radius: 50%; background: #ffffff; border: 4px solid var(--hm-maroon); box-shadow: 0 2px 6px rgba(92, 27, 38, 0.3); }
.hm-stage h3 { font-family: var(--display); font-weight: 700; font-size: 1.45rem; margin: 0 0 4px; }
.hm-stage > p { color: var(--ink-soft); margin: 0 0 14px; }
.hm-stage ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 9px; font-size: 0.95rem; }
.hm-stage li { padding-left: 16px; position: relative; line-height: 1.45; }
.hm-stage li::before { content: ""; position: absolute; left: 0; top: 0.58em; width: 7px; height: 7px; border-radius: 2px; background: var(--hm-gold); transform: rotate(45deg); }

/* Feedback on the desk */
.hm-feedback { background: var(--hm-desk); padding: 88px 0; }
.hm-feedback-grid { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 56px; align-items: center; }
.hm-key { display: flex; gap: 22px; flex-wrap: wrap; margin-top: 22px; font-size: 0.92rem; color: var(--ink-soft); }
.hm-key span { display: inline-flex; align-items: center; gap: 8px; }
.hm-key span::before { content: ""; width: 16px; height: 12px; border-radius: 3px; }
.hm-key-review::before { background: #f7e3a8; }
.hm-key-super::before { background: #f3c9cf; }
.hm-desk { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 230px; gap: 0; align-items: start; }
.hm-draft { background: #ffffff; padding: 36px 40px; border-radius: 6px; transform: rotate(-0.6deg); box-shadow: 0 1px 2px rgba(29, 35, 50, 0.08), 0 24px 40px -20px rgba(29, 35, 50, 0.35); font-family: "Times New Roman", Times, serif; }
.hm-draft-head { display: flex; justify-content: space-between; font-family: var(--sans); font-size: 0.8rem; color: var(--graphite); margin: 0 0 14px; }
.hm-draft h3 { font-family: "Times New Roman", Times, serif; font-weight: 700; font-size: 1.2rem; margin: 0 0 10px; }
.hm-draft p { font-size: 1.05rem; line-height: 1.7; margin: 0 0 12px; }
.hm-draft mark { background: rgba(217, 162, 27, 0.3); color: inherit; padding: 0 1px; }
.hm-draft mark.is-red { background: rgba(196, 64, 80, 0.2); }
.hm-notes { display: grid; gap: 16px; margin-left: -18px; padding-top: 34px; position: relative; z-index: 1; }
.hm-note { margin: 0; padding: 14px 16px 16px; font-size: 0.92rem; line-height: 1.45; border-radius: 3px; box-shadow: 0 10px 16px -10px rgba(29, 35, 50, 0.45); transform: rotate(1.6deg); }
.hm-note b { display: block; font-family: var(--display); font-weight: 650; margin-bottom: 4px; }
.hm-note-tilt { transform: rotate(-1.4deg); margin-left: 12px; }
.hm-note-review { background: #fbefc6; }
.hm-note-super { background: #f8dde1; color: #5a1420; transform: rotate(-0.8deg); }

/* Coursework */
.hm-course { padding: 88px 0; }
.hm-course-grid { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 64px; align-items: center; }
.hm-quiz { background: #ffffff; border-radius: 16px; padding: 24px 26px; border: 1px solid rgba(29, 35, 50, 0.08); box-shadow: 0 1px 2px rgba(29, 35, 50, 0.06), 0 26px 44px -22px rgba(30, 107, 71, 0.4); transform: rotate(-1.2deg); }
.hm-quiz-q { font-size: 1.08rem; font-weight: 600; margin: 0 0 14px; }
.hm-opt { margin: 0 0 8px; padding: 10px 14px; border-radius: 10px; border: 1px solid #e4e5e8; font-size: 0.95rem; }
.hm-opt.is-picked { border-color: var(--hm-green); background: #eef6f1; box-shadow: inset 0 0 0 1px var(--hm-green); }
.hm-quiz-result { margin: 14px 0 0; font-size: 0.9rem; color: var(--ink-soft); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.hm-pairs { margin: 26px 0 0; display: grid; gap: 4px 0; }
.hm-pairs dt { font-family: var(--display); font-weight: 700; font-size: 1.2rem; margin-top: 14px; }
.hm-pairs dd { margin: 0; color: var(--ink-soft); line-height: 1.55; max-width: 56ch; }

/* Supervisors */
.hm-super { background: var(--hm-maroon); color: #f6eceb; padding: 0 0 80px; }
.hm-super .hm-kente-thin { margin-bottom: 72px; }
.hm-super-grid { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 56px; }
.hm-super .hm-h2 { color: #ffffff; }
.hm-super .hm-lead { color: #ead6d6; }
.hm-super-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 28px 36px; }
.hm-super-list li { line-height: 1.5; color: #ead6d6; padding-top: 14px; border-top: 2px solid rgba(217, 162, 27, 0.55); }
.hm-super-list b { display: block; font-family: var(--display); font-weight: 650; font-size: 1.12rem; color: #ffffff; margin-bottom: 4px; }

/* Closing */
.hm-end { padding: 80px 0; }
.hm-end-inner { display: flex; align-items: center; justify-content: space-between; gap: 32px; flex-wrap: wrap; }
.hm-foot { border-top: 1px solid #e6e7ea; padding: 22px 0; font-size: 0.88rem; color: var(--graphite); }
.hm-foot-inner { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

@media (max-width: 991px) {
  .hm-nav { display: none; }
  .hm-hero-grid, .hm-feedback-grid, .hm-course-grid, .hm-super-grid { grid-template-columns: 1fr; gap: 40px; }
  .hm-stack { height: 420px; max-width: 560px; }
  .hm-stages { grid-template-columns: 1fr 1fr; row-gap: 36px; }
  .hm-stages::before { display: none; }
  .hm-quiz { order: 2; }
}
@media (max-width: 575px) {
  .hm-wrap { padding: 0 18px; }
  .hm-bar-inner { gap: 12px; }
  .hm-bar-actions { gap: 12px; }
  .hm-signin { font-size: 0.9rem; white-space: nowrap; }
  .hm-hero-actions { gap: 12px; }
  .hm-hero-actions .hm-btn { flex: 1 1 100%; }
  .hm-hero { padding: 44px 0 40px; }
  /* On a phone the writing page is shown on its own, so nothing important is hidden behind it */
  .hm-stack { height: auto; perspective: 1100px; padding: 6px 4px 18px; }
  .hm-sheet-report, .hm-sheet-sim { display: none; }
  .hm-sheet-page { position: relative; width: 100%; left: 0; top: 0; transform: rotateY(-8deg) rotateX(5deg) rotateZ(1deg); }
  .hm-btn-small { padding: 8px 12px; font-size: 0.88rem; }
  .hm-bar .brand { font-size: 1.02rem; gap: 6px; }
  .hm-bar .brand-mark { width: 24px; height: 24px; }
  .hm-page { padding: 16px 18px 4px; font-size: 0.85rem; }
  .hm-stages { grid-template-columns: 1fr; }
  .hm-desk { grid-template-columns: 1fr; }
  .hm-draft { padding: 24px 20px; }
  .hm-notes { margin-left: 0; padding-top: 0; margin-top: -10px; }
  .hm-super-list { grid-template-columns: 1fr; }
  .hm-journey, .hm-feedback, .hm-course, .hm-end { padding: 60px 0; }
}

/* ---------- Legal pages and the shared footer ---------- */
.legal { max-width: 74ch; }
.legal h2 { font-family: var(--display); font-weight: 650; font-size: 1.3rem; margin: 2rem 0 0.5rem; }
.legal p, .legal li { line-height: 1.65; color: var(--ink-soft); }
.legal ul { padding-left: 1.2rem; }
.legal li { margin-bottom: 6px; }
.legal li strong { color: var(--ink); }
.legal-meta { font-size: 0.92rem; color: var(--graphite); }
.legal-foot { display: grid; grid-template-columns: 1fr auto; gap: 6px 24px; align-items: baseline; font-size: 0.88rem; color: var(--graphite); }
.legal-foot p { margin: 0; }
.legal-foot a { color: var(--ink-soft); }
@media (hover: hover) { .legal-foot a:hover { color: var(--binding); } }
.legal-links { display: flex; flex-wrap: wrap; gap: 6px 20px; justify-content: flex-end; }
.legal-copy { grid-column: 1 / -1; font-size: 0.82rem; }
.legal-phone { white-space: nowrap; }
.site-footer .legal-foot { padding: 18px 0 28px; }
.legal-foot-auth { margin-top: 28px; grid-template-columns: 1fr; text-align: center; }
.legal-foot-auth .legal-links { justify-content: center; }
@media (max-width: 640px) { .legal-foot { grid-template-columns: 1fr; } .legal-links { justify-content: flex-start; } }
.panel-danger { border-left: 3px solid var(--redpen); }
.delete-list { padding-left: 1.2rem; color: var(--ink-soft); }
.delete-list li { margin-bottom: 4px; }
.panel-danger summary { list-style: none; cursor: pointer; }
.panel-danger summary::-webkit-details-marker { display: none; }
/* The smallest phones show the logo mark alone, so Sign in and Create account both fit */
@media (max-width: 379px) { .hm-bar .brand { font-size: 0; } .hm-bar .brand-mark { width: 28px; height: 28px; } }