:root {
  color-scheme: light;
  --ink: #18212b;
  --muted: #68737e;
  --line: #dfe4e8;
  --line-strong: #cbd3d9;
  --paper: #ffffff;
  --wash: #f4f6f7;
  --accent: #176b67;
  --accent-soft: #e6f2f0;
  --navy: #20394b;
  --shadow: 0 18px 45px rgba(28, 43, 53, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; background: var(--wash); color: var(--ink); }
body { font-size: 15px; line-height: 1.55; }
button, input, select { font: inherit; }
button, a, select { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.login-view { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-panel { width: min(360px, 100%); display: grid; gap: 18px; background: var(--paper); border: 1px solid var(--line-strong); padding: 30px; }
.login-panel h1 { font-size: 24px; margin: 0 0 4px; }
.login-panel p { color: var(--muted); margin: 0; }
.login-panel label span { display: block; color: var(--muted); font-size: 12px; font-weight: 700; margin-bottom: 5px; }
.login-panel input { width: 100%; border: 1px solid var(--line-strong); padding: 10px; outline: none; }
.login-panel input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(23, 107, 103, .12); }
.login-panel button { border: 0; background: var(--navy); color: white; padding: 10px 14px; cursor: pointer; font-weight: 700; }
.login-panel button:disabled { opacity: .55; cursor: wait; }
.login-panel .login-error { color: #8d3f3c; font-size: 13px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(250px, 300px) minmax(0, 1fr); }
.sidebar { min-width: 0; background: #eef1f2; border-right: 1px solid var(--line); padding: 26px 18px 22px; display: flex; flex-direction: column; min-height: 100vh; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 7px 28px; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; background: var(--navy); color: #fff; font-size: 11px; font-weight: 800; letter-spacing: .06em; }
.brand strong, .brand span { display: block; }
.brand strong { font-size: 15px; letter-spacing: .01em; }
.brand span { color: var(--muted); font-size: 11px; margin-top: 2px; }
.sidebar-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 7px 9px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.count-badge, .section-count { color: var(--accent); font-size: 11px; font-weight: 700; }
.count-badge { background: var(--accent-soft); padding: 2px 7px; }
.search-field { display: block; margin: 0 0 10px; }
.search-field input { width: 100%; border: 1px solid var(--line-strong); background: var(--paper); padding: 9px 10px; color: var(--ink); border-radius: 3px; outline: none; }
.search-field input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(23, 107, 103, .12); }
.filter-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin-bottom: 17px; }
.filter-row > label { min-width: 0; }
select { width: 100%; min-width: 0; border: 1px solid var(--line-strong); background: var(--paper); color: var(--muted); border-radius: 3px; padding: 8px 7px; font-size: 12px; outline: none; }
.problem-list { min-height: 0; overflow-y: auto; padding-right: 2px; }
.problem-card { display: block; width: 100%; min-width: 0; text-align: left; background: transparent; border: 1px solid transparent; padding: 12px 10px 11px; cursor: pointer; color: var(--ink); border-radius: 4px; margin-bottom: 3px; }
.problem-card:hover { background: rgba(255,255,255,.72); border-color: var(--line); }
.problem-card.active { background: var(--paper); border-color: var(--line-strong); box-shadow: 0 3px 10px rgba(30, 44, 54, .04); }
.problem-card-slug { display: block; color: var(--accent); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; font-weight: 800; line-height: 1.25; margin-bottom: 5px; overflow-wrap: anywhere; }
.problem-card-title { display: block; max-width: 100%; overflow-wrap: anywhere; font-weight: 700; font-size: 13px; line-height: 1.35; margin-bottom: 7px; }
.problem-card-meta { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 11px; }
.problem-card-meta span:last-child { color: var(--accent); text-align: right; }
.list-empty { padding: 20px 8px; color: var(--muted); font-size: 13px; }
.account-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-top: 1px solid var(--line); margin-top: auto; padding: 16px 7px 0; color: var(--muted); font-size: 12px; }
.account-row button { border: 0; background: transparent; color: var(--accent); padding: 0; cursor: pointer; font-size: 12px; }

.main-content { min-width: 0; max-width: 1040px; width: 100%; padding: 54px clamp(22px, 6vw, 82px) 90px; margin: 0 auto; }
.state-panel { max-width: 620px; margin: 20vh auto; padding: 24px; border: 1px solid var(--line); background: var(--paper); color: var(--muted); }
.error-panel { color: #8d3f3c; display: grid; gap: 5px; }
.detail-topline, .section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.eyebrow { color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: .13em; line-height: 1.2; text-transform: uppercase; }
.problem-header { display: flex; min-width: 0; justify-content: space-between; align-items: flex-start; gap: 24px; border-bottom: 1px solid var(--line); padding: 17px 0 25px; }
.problem-header > div:first-child { min-width: 0; }
.problem-slug { color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; letter-spacing: .04em; margin: 0 0 8px; }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 760px; font-size: clamp(25px, 3.1vw, 38px); letter-spacing: -.02em; line-height: 1.13; margin-bottom: 13px; }
h2 { font-size: 20px; letter-spacing: -.01em; margin: 5px 0 0; }
.lede { max-width: 700px; color: var(--muted); font-size: 16px; line-height: 1.65; margin-bottom: 0; }
.status-pill { flex: 0 0 auto; border: 1px solid var(--line-strong); color: var(--navy); background: #f7f9f9; padding: 5px 9px; font-size: 11px; font-weight: 750; white-space: nowrap; }
.status-pill[data-status="In progress"] { color: var(--accent); background: var(--accent-soft); border-color: #b9dcd8; }
.status-pill[data-status="Awaiting feedback"] { color: #815b1d; background: #fff4dd; border-color: #ecd39d; }
.status-pill[data-status="Discontinued"] { color: #6d5553; background: #f4eeee; border-color: #d9c8c6; }
.meta-grid { display: grid; grid-template-columns: minmax(150px, 1.35fr) minmax(170px, 1.55fr) minmax(90px, .65fr) minmax(105px, .8fr) minmax(105px, .8fr); border-bottom: 1px solid var(--line); }
.meta-item { padding: 15px 15px 16px 0; margin-right: 15px; border-right: 1px solid var(--line); }
.meta-item:last-child { border-right: 0; }
.meta-label { color: var(--muted); display: block; font-size: 10px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; margin-bottom: 4px; }
.meta-value { display: block; font-size: 13px; overflow-wrap: anywhere; }
.contact-list { display: grid; gap: 8px; }
.contact-entry { display: block; }
.contact-heading { display: flex; align-items: baseline; gap: 5px; flex-wrap: wrap; }
.contact-name, .contact-institution { display: block; }
.contact-role { color: var(--accent); border: 1px solid #b9dcd8; font-size: 9px; font-weight: 750; line-height: 1.3; padding: 1px 4px; }
.contact-institution { color: var(--muted); font-size: 11px; margin-top: 1px; }
.content-section { padding: 35px 0 0; }
.section-heading { margin-bottom: 16px; }
.quiet-link { color: var(--accent); font-size: 12px; text-decoration: none; border-bottom: 1px solid #b9dcd8; padding-bottom: 2px; }
.quiet-link:hover { border-color: var(--accent); }
.prose { color: #20252a; max-width: 790px; font-family: KaTeX_Main, "Latin Modern Roman", "Noto Serif CJK SC", "Songti SC", SimSun, "Times New Roman", serif; font-size: 17px; line-height: 1.68; }
.prose > :first-child { margin-top: 0; }
.prose h1, .prose h2, .prose h3 { font-family: KaTeX_Main, "Latin Modern Roman", "Noto Serif CJK SC", "Songti SC", SimSun, "Times New Roman", serif; color: #15191d; line-height: 1.25; margin-top: 1.8em; margin-bottom: .65em; }
.prose h1 { font-size: 23px; font-weight: 700; padding-bottom: .28em; border-bottom: 1px solid var(--line); }
.prose h2 { font-size: 19px; font-weight: 700; }
.prose h3 { font-size: 17px; font-weight: 700; }
.prose p { margin-bottom: 1em; }
.prose ul, .prose ol { padding-left: 1.35em; margin: .6em 0 1.1em; }
.prose li { margin: .3em 0; }
.prose blockquote { border-left: 3px solid #aacdc9; color: var(--muted); margin: 1.1em 0; padding: 2px 0 2px 17px; }
.prose code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: #f0f3f4; padding: .12em .32em; font-size: .87em; }
.prose pre { overflow: auto; background: #22313c; color: #e8eef0; padding: 14px 16px; border-radius: 3px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; line-height: 1.55; }
.prose a { color: var(--accent); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
.math-block { max-width: 100%; overflow-x: auto; overflow-y: hidden; margin: 1.25em 0; padding: 3px 0; }
.prose .katex { color: #15191d; font-size: 1em; }
.prose .katex-display { max-width: 100%; overflow-x: auto; overflow-y: hidden; margin: 0; padding: .35em 0; }
.prose .katex-error { color: #9a3f3a; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; }
.materials-section { border-top: 1px solid var(--line); margin-top: 42px; }
.materials-list { display: grid; gap: 8px; }
.material-item { display: flex; justify-content: space-between; align-items: center; gap: 16px; border: 1px solid var(--line); background: var(--paper); padding: 12px 14px; }
.material-info { min-width: 0; }
.material-name { display: block; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; overflow-wrap: anywhere; }
.material-meta { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.material-action { flex: 0 0 auto; color: var(--accent); background: transparent; border: 1px solid #b9dcd8; padding: 6px 10px; cursor: pointer; font-size: 11px; }
.material-action:hover { background: var(--accent-soft); }
.muted { color: var(--muted); font-size: 13px; }

.reader[hidden] { display: none; }
.reader { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 22px; }
.reader-backdrop { position: absolute; inset: 0; background: rgba(19, 30, 37, .43); }
.reader-panel { position: relative; width: min(820px, 100%); max-height: min(84vh, 760px); overflow: auto; background: var(--paper); box-shadow: var(--shadow); padding: 25px clamp(21px, 4vw, 42px) 35px; }
.reader-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); padding-bottom: 18px; margin-bottom: 22px; }
.reader-header h2 { font-size: 18px; max-width: 600px; }
.close-button { border: 1px solid var(--line-strong); background: transparent; color: var(--muted); cursor: pointer; padding: 6px 10px; font-size: 11px; }
.close-button:hover { color: var(--ink); border-color: var(--ink); }
.reader-content { font-size: 15px; }

@media (max-width: 1100px) {
  .meta-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .meta-item { border-top: 1px solid var(--line); }
  .meta-item:nth-child(-n+2) { border-top: 0; }
  .meta-item:nth-child(even) { border-right: 0; }
  .meta-item:last-child { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { width: 100%; min-height: 0; border-right: 0; border-bottom: 1px solid var(--line); padding: 19px 14px 13px; }
  .brand { padding-bottom: 18px; }
  .problem-list { max-height: 260px; }
  .main-content { padding: 34px 19px 65px; }
  .problem-header { display: block; }
  .status-pill { display: inline-block; margin-top: 16px; }
  .section-heading { align-items: flex-start; }
  .material-item { align-items: flex-start; }
}

@media (max-width: 420px) {
  .filter-row { grid-template-columns: 1fr; }
  .detail-topline { display: block; }
  h1 { font-size: 27px; }
}
