:root {
  color-scheme: light;
  --ink: #10233f;
  --ink-soft: #50627a;
  --brand: #153d72;
  --brand-bright: #2165b5;
  --brand-pale: #eaf2fb;
  --paper: #fbfcfe;
  --canvas: #edf2f7;
  --line: #cbd7e4;
  --signal: #d5a233;
  --danger: #9d2f34;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--canvas);
  color: var(--ink);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 20rem;
  background: var(--canvas);
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgb(33 101 181 / 35%);
  outline-offset: 3px;
}

.page-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem;
}

.login-card {
  width: min(100%, 27rem);
  padding: 3rem 2.75rem 2.75rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-top: 0.35rem solid var(--brand-bright);
  box-shadow: 0 1.5rem 4rem rgb(16 35 63 / 12%);
}

.eyebrow {
  margin: 0 0 0.9rem;
  color: var(--brand-bright);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.16em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1,
h2 {
  font-family: "Songti SC", "STSong", serif;
  font-weight: 700;
}

.login-card h1 {
  margin-bottom: 0.65rem;
  font-size: clamp(2rem, 8vw, 2.75rem);
}

.intro {
  margin-bottom: 1.75rem;
  color: var(--ink-soft);
  line-height: 1.7;
}

.login-card label,
.login-card input,
.login-card button {
  display: block;
  width: 100%;
}

.login-card label {
  margin: 1.1rem 0 0.45rem;
  font-size: 0.9rem;
  font-weight: 650;
}

.login-card input,
.login-card button {
  min-height: 2.9rem;
  border-radius: 0.2rem;
}

.login-card input {
  border: 1px solid #91a3b7;
  padding: 0.7rem 0.8rem;
  background: #fff;
  color: var(--ink);
}

.login-card button {
  margin-top: 1.65rem;
  border: 0;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.login-card button:hover {
  background: var(--brand-bright);
}

.error {
  padding: 0.8rem;
  border-left: 0.25rem solid var(--danger);
  background: #fae9ea;
  color: #762328;
}

.workspace-page {
  background:
    linear-gradient(90deg, var(--brand) 0 0.7rem, transparent 0.7rem),
    var(--canvas);
}

.workspace-frame {
  min-height: 100vh;
}

.workspace-header {
  min-height: 5.4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: 1rem clamp(1.25rem, 5vw, 4.5rem);
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  width: 2.75rem;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  background: var(--brand);
  color: #fff;
  font-family: "Songti SC", "STSong", serif;
  font-size: 1.35rem;
  font-weight: 700;
}

.brand-lockup strong,
.brand-lockup small {
  display: block;
}

.brand-lockup strong {
  font-family: "Songti SC", "STSong", serif;
  font-size: 1.15rem;
  letter-spacing: 0.08em;
}

.brand-lockup small {
  margin-top: 0.1rem;
  color: var(--ink-soft);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
}

.workspace-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-right: auto;
}

.workspace-nav a {
  padding: 0.55rem 0.75rem;
  border-bottom: 2px solid transparent;
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-weight: 650;
  text-decoration: none;
}

.workspace-nav a:hover,
.workspace-nav a[aria-current="page"] {
  border-bottom-color: var(--brand-bright);
  color: var(--brand);
}

.advisor-controls {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.advisor-controls p {
  margin: 0;
  text-align: right;
}

.advisor-controls p span,
.advisor-controls p strong {
  display: block;
}

.advisor-controls p span {
  margin-bottom: 0.15rem;
  color: var(--ink-soft);
  font-size: 0.7rem;
}

.advisor-controls p strong {
  font-size: 0.9rem;
}

.quiet-button {
  min-height: 2.3rem;
  padding: 0 1rem;
  border: 1px solid var(--line);
  border-radius: 0.2rem;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.quiet-button:hover {
  border-color: var(--brand-bright);
  color: var(--brand-bright);
}

.workspace-content {
  width: min(100% - 3rem, 76rem);
  margin: 0 auto;
  padding: clamp(3rem, 7vw, 6.5rem) 0 2rem;
}

.workspace-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 2rem;
  margin-bottom: clamp(2.5rem, 6vw, 4.5rem);
}

.workspace-intro h1 {
  max-width: 8em;
  margin-bottom: 1rem;
  font-size: clamp(3rem, 8vw, 6.5rem);
  line-height: 0.98;
  letter-spacing: -0.045em;
}

.workspace-lead {
  max-width: 36rem;
  margin-bottom: 0;
  color: var(--ink-soft);
  font-size: clamp(1rem, 2vw, 1.15rem);
  line-height: 1.8;
}

.folio-note {
  display: grid;
  grid-template-columns: auto 1fr;
  min-width: 12.5rem;
  border: 1px solid var(--line);
  background: rgb(251 252 254 / 72%);
}

.folio-note span {
  padding: 1rem 0.65rem;
  background: var(--brand);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  writing-mode: vertical-rl;
}

.folio-note strong {
  padding: 1rem 1.15rem;
  font-family: "Songti SC", "STSong", serif;
  font-size: 1rem;
  line-height: 1.75;
  letter-spacing: 0.12em;
}

.workflow-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.workflow-card {
  min-height: 19rem;
  display: grid;
  grid-template-columns: 2.65rem 1fr;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: 0 0.75rem 2.2rem rgb(16 35 63 / 6%);
  color: var(--ink);
  text-decoration: none;
}

.workflow-card--next {
  border-color: #8ab2df;
  transform: translateY(-0.7rem);
  box-shadow: 0 1.2rem 3rem rgb(21 61 114 / 13%);
}

.card-spine {
  padding: 1rem 0.75rem;
  border-right: 1px solid var(--line);
  color: var(--brand);
  font-family: "Songti SC", "STSong", serif;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-align: center;
  writing-mode: vertical-rl;
}

.workflow-card--next .card-spine {
  background: var(--brand);
  color: #fff;
}

.card-content {
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
}

.card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.card-heading p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.08em;
}

.status-label {
  flex: none;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.68rem;
}

.status-label--next {
  border-color: var(--signal);
  color: #76520b;
  background: #fff8e6;
}

.workflow-card h2 {
  margin: auto 0 1rem;
  font-size: clamp(1.65rem, 3vw, 2.15rem);
}

.workflow-card .card-content > p {
  margin-bottom: 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.8;
}

.workspace-footer {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.75rem;
}

.workspace-footer p {
  margin: 0;
}

.site-legal-footer {
  padding: 1.25rem 1rem 1.75rem;
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.75rem;
}

.site-legal-footer a {
  color: inherit;
  text-decoration: none;
}

.site-legal-footer a:hover,
.site-legal-footer a:focus-visible {
  color: var(--ink);
  text-decoration: underline;
}

.workspace-content--wide {
  width: min(100% - 3rem, 88rem);
  padding-top: clamp(2.5rem, 5vw, 4.5rem);
}

.section-masthead {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 2.25rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
}

.section-masthead h1 {
  margin-bottom: 0.45rem;
  font-size: clamp(2.5rem, 6vw, 4.8rem);
  line-height: 1;
  letter-spacing: -0.035em;
}

.section-masthead p:last-child {
  margin-bottom: 0;
  color: var(--ink-soft);
}

.primary-link,
.primary-button {
  min-height: 2.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.15rem;
  border: 1px solid var(--brand);
  border-radius: 0.15rem;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.primary-link:hover,
.primary-button:hover {
  border-color: var(--brand-bright);
  background: var(--brand-bright);
}

.quiet-link {
  color: var(--ink-soft);
  font-weight: 650;
  text-decoration: none;
}

.quiet-link:hover {
  color: var(--brand-bright);
}

.student-register {
  border-top: 0.25rem solid var(--brand);
  background: var(--paper);
  box-shadow: 0 1.2rem 3.2rem rgb(16 35 63 / 7%);
}

.student-row {
  min-height: 6.5rem;
  display: grid;
  grid-template-columns: 4rem minmax(10rem, 0.8fr) minmax(15rem, 1.8fr) auto;
  align-items: center;
  gap: 1.5rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--line);
}

.student-row:hover {
  background: var(--brand-pale);
}

.student-row__main {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(10rem, 0.8fr) minmax(15rem, 1.8fr);
  align-items: center;
  gap: 1.5rem;
  color: var(--ink);
  text-decoration: none;
}

.student-row__state {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  gap: 0.38rem;
}

.history-action {
  color: var(--brand-bright);
  font-size: 0.75rem;
  font-weight: 700;
  text-decoration: none;
}

.history-action:hover {
  text-decoration: underline;
}

.history-action--primary {
  color: var(--brand);
}

.student-index {
  color: #8191a6;
  font-family: ui-monospace, "SFMono-Regular", monospace;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
}

.student-identity strong,
.student-identity small {
  display: block;
}

.student-identity strong {
  margin-bottom: 0.35rem;
  font-family: "Songti SC", "STSong", serif;
  font-size: 1.25rem;
}

.student-identity small,
.student-request {
  color: var(--ink-soft);
}

.student-request {
  overflow: hidden;
  font-size: 0.86rem;
  line-height: 1.65;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.register-status {
  padding: 0.4rem 0.65rem;
  border: 1px solid #d6b86a;
  background: #fff9e8;
  color: #785814;
  font-size: 0.72rem;
  font-weight: 700;
}

.register-status--confirmed {
  border-color: #91b9a3;
  background: #edf8f1;
  color: #245f3f;
}

.empty-panel {
  min-height: 22rem;
  display: grid;
  place-items: center;
  align-content: center;
  padding: 3rem;
  border: 1px dashed #9daec0;
  background: rgb(251 252 254 / 72%);
  text-align: center;
}

.empty-panel h2 {
  margin-bottom: 0.7rem;
  font-size: 2rem;
}

.empty-panel > p:not(.eyebrow) {
  max-width: 38rem;
  margin-bottom: 1.5rem;
  color: var(--ink-soft);
  line-height: 1.8;
}

.section-masthead--form {
  align-items: center;
}

.privacy-note {
  max-width: 24rem;
  display: grid;
  gap: 0.35rem;
  padding: 1rem 1.15rem;
  border-left: 0.3rem solid var(--signal);
  background: #fff8e6;
}

.privacy-note strong {
  color: #65470d;
  font-size: 0.82rem;
}

.privacy-note span {
  color: #6f6041;
  font-size: 0.76rem;
  line-height: 1.65;
}

.intake-form {
  display: grid;
  gap: 1rem;
}

.form-banner {
  margin: 0;
}

.form-sheet {
  padding: clamp(1.4rem, 3vw, 2.3rem);
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: 0 0.85rem 2.5rem rgb(16 35 63 / 5%);
}

.sheet-heading {
  display: grid;
  grid-template-columns: 3rem 1fr;
  gap: 1rem;
  margin-bottom: 1.75rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.sheet-heading > span {
  color: var(--brand-bright);
  font-family: ui-monospace, "SFMono-Regular", monospace;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
}

.sheet-heading h2 {
  margin-bottom: 0.25rem;
  font-size: 1.7rem;
}

.sheet-heading p {
  margin-bottom: 0;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.form-grid {
  display: grid;
  gap: 1.1rem;
}

.form-grid--two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.intake-form label,
.intake-form legend {
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 700;
}

.intake-form input:not([type="checkbox"]),
.intake-form select,
.intake-form textarea {
  width: 100%;
  margin-top: 0.42rem;
  border: 1px solid #9babbc;
  border-radius: 0.12rem;
  background: #fff;
  color: var(--ink);
}

.intake-form input:not([type="checkbox"]),
.intake-form select {
  min-height: 2.7rem;
  padding: 0.55rem 0.7rem;
}

.intake-form textarea {
  padding: 0.7rem;
  line-height: 1.65;
  resize: vertical;
}

.form-field--full {
  display: block;
  margin-top: 1.1rem;
}

.field-error {
  display: block;
  margin-top: 0.35rem;
  color: var(--danger);
  font-weight: 650;
}

.constraint-sheet {
  position: relative;
  overflow: hidden;
}

.constraint-sheet::before {
  content: "HARD / SOFT";
  position: absolute;
  top: 0;
  right: 0;
  padding: 0.45rem 0.75rem;
  background: var(--brand);
  color: #fff;
  font-family: ui-monospace, "SFMono-Regular", monospace;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
}

.constraint-ledger {
  border-top: 1px solid var(--line);
}

.constraint-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 11rem;
  gap: 1.2rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}

.constraint-level > span {
  display: block;
}

.constraint-row fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.choice-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.5rem;
}

.choice-chip {
  position: relative;
  cursor: pointer;
}

.choice-chip input {
  position: absolute;
  opacity: 0;
}

.choice-chip span {
  display: block;
  padding: 0.45rem 0.7rem;
  border: 1px solid #9babbc;
  background: #fff;
  color: var(--ink-soft);
  font-size: 0.72rem;
}

.choice-chip input:checked + span {
  border-color: var(--brand);
  background: var(--brand-pale);
  color: var(--brand);
}

.choice-chip input:focus-visible + span {
  outline: 3px solid rgb(33 101 181 / 35%);
  outline-offset: 3px;
}

.form-actions,
.confirmation-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1.25rem;
  padding: 1rem 0 2rem;
}

.workflow-history {
  margin-top: 1rem;
  padding: 1.5rem;
  border-top: 0.25rem solid var(--brand);
  background: var(--paper);
  box-shadow: 0 1.2rem 3.2rem rgb(16 35 63 / 7%);
}

.workflow-history header h2 {
  margin-bottom: 0.35rem;
}

.workflow-history header > p:last-child {
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.workflow-history__list {
  margin-top: 1rem;
  border-top: 1px solid var(--line);
}

.workflow-history__item {
  min-height: 4.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--line);
}

.workflow-history__item small,
.workflow-history__item strong {
  display: block;
}

.workflow-history__item small {
  margin-bottom: 0.25rem;
  color: var(--ink-soft);
}

.workflow-history__actions {
  display: flex;
  gap: 1rem;
}

.confirmation-seal {
  min-width: 10rem;
  padding: 0.8rem 1rem;
  border: 2px solid #3b7b59;
  color: #245f3f;
  text-align: center;
  transform: rotate(-1.5deg);
}

.confirmation-seal span,
.confirmation-seal strong {
  display: block;
}

.confirmation-seal span {
  margin-bottom: 0.2rem;
  font-family: ui-monospace, "SFMono-Regular", monospace;
  font-size: 0.62rem;
  letter-spacing: 0.16em;
}

.confirmation-seal--pending {
  border-color: #b28a32;
  color: #76520b;
}

.success-banner {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 0.9rem 1rem;
  border-left: 0.3rem solid #3b7b59;
  background: #edf8f1;
  color: #245f3f;
}

.success-banner span {
  font-size: 0.82rem;
}

.review-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.15fr);
  gap: 1rem;
}

.review-brief,
.constraint-review {
  padding: clamp(1.5rem, 3vw, 2.25rem);
  border: 1px solid var(--line);
  background: var(--paper);
}

.review-brief blockquote {
  margin: 0 0 2rem;
  padding: 0 0 0 1rem;
  border-left: 0.25rem solid var(--brand-bright);
  font-family: "Songti SC", "STSong", serif;
  font-size: 1.2rem;
  line-height: 1.85;
}

.profile-facts {
  margin: 0;
}

.profile-facts div {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 1rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--line);
}

.profile-facts dt {
  color: var(--ink-soft);
  font-size: 0.72rem;
}

.profile-facts dd {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.6;
}

.constraint-review h2 {
  margin-bottom: 1.25rem;
  font-size: 1.8rem;
}

.review-constraint {
  display: grid;
  grid-template-columns: 5rem 1fr;
  gap: 1rem;
  align-items: center;
  padding: 1rem 0;
  border-top: 1px solid var(--line);
}

.constraint-tag {
  padding: 0.35rem 0.45rem;
  border: 1px solid #b28a32;
  color: #76520b;
  font-size: 0.68rem;
  font-weight: 700;
  text-align: center;
}

.review-constraint--hard .constraint-tag {
  border-color: #ad5559;
  background: #fae9ea;
  color: #762328;
}

.review-constraint--soft .constraint-tag {
  border-color: #6d9bc8;
  background: var(--brand-pale);
  color: var(--brand);
}

.review-constraint small,
.review-constraint strong {
  display: block;
}

.review-constraint small {
  margin-bottom: 0.3rem;
  color: var(--ink-soft);
  font-size: 0.68rem;
}

.review-constraint strong {
  font-size: 0.9rem;
  line-height: 1.55;
}

.confirmation-actions {
  justify-content: space-between;
  padding-top: 1.5rem;
}

.confirmation-actions p {
  margin: 0 0 0 auto;
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.next-step {
  padding: 0.75rem 1rem;
  border: 1px dashed #91a3b7;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 700;
}

@media (max-width: 800px) {
  .workspace-header,
  .section-masthead,
  .confirmation-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .workspace-header {
    gap: 0.9rem;
  }

  .workspace-nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
  }

  .advisor-controls {
    align-self: flex-end;
  }

  .workflow-grid,
  .form-grid--two,
  .review-layout {
    grid-template-columns: 1fr;
  }

  .student-row {
    grid-template-columns: 2.5rem 1fr;
    gap: 0.65rem 1rem;
  }

  .student-row__main {
    display: contents;
  }

  .student-row__state {
    grid-column: 2;
    align-items: flex-start;
  }

  .workflow-history__item,
  .workflow-history__actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .student-request,
  .register-status {
    grid-column: 2;
  }

  .student-request {
    white-space: normal;
  }

  .constraint-row {
    grid-template-columns: 1fr;
  }

  .constraint-level {
    width: min(100%, 13rem);
  }

  .confirmation-actions p {
    margin-left: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}

.cultivation-masthead {
  align-items: flex-end;
}

.cultivation-shared-note {
  max-width: 23rem;
  padding: 1rem 1.15rem;
  border-left: 0.3rem solid #b28a32;
  background: #fff7df;
  color: #76520b;
}

.cultivation-shared-note strong,
.cultivation-shared-note span {
  display: block;
}

.cultivation-shared-note span {
  margin-top: 0.3rem;
  font-size: 0.78rem;
  line-height: 1.55;
}

.agent-document-error {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 0.9rem 1rem;
  border-left: 0.3rem solid var(--danger);
  background: #fff0f0;
  color: #873333;
}

.agent-document-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.agent-document-tabs a {
  min-height: 10.5rem;
  display: flex;
  flex-direction: column;
  padding: 1rem;
  border: 1px solid var(--line);
  background: rgb(255 255 255 / 68%);
  color: var(--ink);
  text-decoration: none;
}

.agent-document-tabs a:hover,
.agent-document-tabs a[aria-current="page"] {
  border-color: var(--brand-bright);
  background: var(--paper);
  box-shadow: 0 1rem 2.5rem rgb(16 35 63 / 8%);
}

.agent-document-tabs span {
  color: var(--brand-bright);
  font-family: ui-monospace, "SFMono-Regular", monospace;
  font-size: 0.72rem;
}

.agent-document-tabs strong {
  margin: 0.65rem 0 0.4rem;
  font-family: "Songti SC", "STSong", serif;
  font-size: 1.2rem;
}

.agent-document-tabs small {
  color: var(--ink-soft);
  line-height: 1.55;
}

.agent-document-tabs em {
  margin-top: auto;
  padding-top: 0.8rem;
  color: var(--brand);
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 700;
}

.agent-document-guide,
.agent-document-editor,
.agent-document-history {
  background: var(--paper);
  box-shadow: 0 1.2rem 3.2rem rgb(16 35 63 / 7%);
}

.agent-document-guide {
  margin-bottom: 1rem;
  padding: 1.5rem;
  border-top: 0.25rem solid var(--brand);
}

.agent-guide-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.agent-guide-grid article {
  padding: 1rem;
  border: 1px solid var(--line);
  background: #f9fbfd;
}

.agent-guide-grid article > span {
  color: var(--brand-bright);
  font-family: ui-monospace, "SFMono-Regular", monospace;
  font-size: 0.68rem;
}

.agent-guide-grid h3 {
  margin: 0.45rem 0 0.65rem;
  font-size: 1rem;
}

.agent-guide-grid p,
.agent-guide-grid li {
  color: var(--ink-soft);
  font-size: 0.77rem;
  line-height: 1.65;
}

.agent-guide-grid ul {
  margin: 0;
  padding-left: 1rem;
}

.agent-guide-card--warning {
  border-color: #e3c5c5 !important;
  background: #fff7f7 !important;
}

.agent-guide-card--example {
  border-color: #c7d8eb !important;
  background: var(--brand-pale) !important;
}

.agent-document-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(20rem, 0.75fr);
  gap: 1rem;
  align-items: start;
  padding-bottom: 2rem;
}

.agent-document-editor,
.agent-document-history {
  padding: 1.5rem;
  border-top: 0.25rem solid var(--brand);
}

.agent-document-editor > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.document-version {
  color: var(--brand);
  font-family: ui-monospace, "SFMono-Regular", monospace;
  font-size: 0.75rem;
  font-weight: 700;
}

.agent-document-editor label {
  display: block;
  margin-bottom: 1rem;
  font-size: 0.78rem;
  font-weight: 700;
}

.agent-document-editor textarea,
.agent-document-editor input {
  width: 100%;
  margin-top: 0.4rem;
  border: 1px solid #9babbc;
  background: #fbfcfe;
  color: var(--ink);
}

.agent-document-editor textarea {
  padding: 1rem;
  font-family: ui-monospace, "SFMono-Regular", monospace;
  font-size: 0.78rem;
  line-height: 1.65;
  resize: vertical;
}

.agent-document-editor input {
  min-height: 2.75rem;
  padding: 0.55rem 0.7rem;
}

.editor-safety-note {
  color: #873333;
  font-size: 0.75rem;
}

.read-only-document > span {
  display: inline-block;
  margin-bottom: 0.75rem;
  padding: 0.25rem 0.45rem;
  background: #e9eef4;
  color: var(--ink-soft);
  font-size: 0.65rem;
  font-weight: 750;
}

.read-only-document pre,
.agent-document-history pre {
  overflow: auto;
  padding: 1rem;
  background: #f5f7fa;
  white-space: pre-wrap;
}

.agent-document-history > article {
  padding: 1rem 0;
  border-top: 1px solid var(--line);
}

.revision-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.revision-heading span {
  padding: 0.18rem 0.38rem;
  background: #edf8f1;
  color: #245f3f;
  font-size: 0.62rem;
  font-weight: 700;
}

.agent-document-history article > p {
  margin: 0.5rem 0;
  font-size: 0.8rem;
}

.agent-document-history small {
  display: block;
  color: var(--ink-soft);
  font-size: 0.68rem;
}

.agent-document-history details {
  margin: 0.75rem 0;
  font-size: 0.75rem;
}

@media (max-width: 980px) {
  .agent-document-tabs,
  .agent-guide-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .agent-document-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .agent-document-tabs,
  .agent-guide-grid {
    grid-template-columns: 1fr;
  }

  .agent-document-error {
    flex-direction: column;
  }
}

.workspace-footer strong {
  color: var(--brand);
}

.library-content {
  width: min(100% - 3rem, 76rem);
  margin: 0 auto;
  padding: clamp(2.75rem, 6vw, 5rem) 0 4rem;
}

.library-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 2rem;
}

.breadcrumb {
  display: flex;
  gap: 0.55rem;
  margin-bottom: 2.5rem;
  color: var(--ink-soft);
  font-size: 0.72rem;
}

.breadcrumb a {
  color: var(--brand-bright);
  text-decoration: none;
}

.library-intro h1 {
  margin-bottom: 0.75rem;
  font-size: clamp(2.75rem, 7vw, 5.5rem);
  line-height: 1;
  letter-spacing: -0.04em;
}

.library-lead {
  max-width: 40rem;
  margin-bottom: 0;
  color: var(--ink-soft);
  line-height: 1.8;
}

.library-index {
  min-width: 10.5rem;
  padding: 1.1rem 1.25rem;
  border-top: 0.3rem solid var(--brand);
  background: var(--paper);
  box-shadow: 0 0.8rem 2rem rgb(16 35 63 / 7%);
}

.library-side-actions {
  display: grid;
  justify-items: stretch;
  gap: 0.75rem;
}

.bulk-approval-form button {
  width: 100%;
  min-height: 2.7rem;
  padding: 0.65rem 1rem;
  border: 1px solid #27704e;
  background: #e9f5ef;
  color: #17533a;
  font-size: 0.76rem;
  font-weight: 750;
  cursor: pointer;
}

.bulk-approval-form button:hover {
  background: #d9eee3;
}

.library-notice {
  margin-top: 1.5rem;
}

.library-filter-panel {
  margin-top: 1.5rem;
  padding: clamp(1.25rem, 3vw, 2rem);
  border: 1px solid var(--line);
  border-top: 0.3rem solid var(--brand-bright);
  background: var(--paper);
  box-shadow: 0 0.8rem 2.4rem rgb(16 35 63 / 6%);
}

.library-filter-panel > header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.library-filter-panel h2,
.library-filter-panel p {
  margin: 0;
}

.library-filter-panel h2 {
  font-size: clamp(1.45rem, 3vw, 2rem);
}

.library-filter-panel > header > p {
  color: var(--ink-soft);
  font-size: 0.72rem;
}

.library-filter-panel fieldset {
  margin: 0;
  padding: 1rem 0;
  border: 0;
  border-bottom: 1px solid var(--line);
}

.library-filter-panel legend {
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 750;
}

.library-filter-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.9rem;
  padding-top: 1rem;
}

.library-filter-actions p {
  margin-right: auto;
  color: var(--ink-soft);
  font-size: 0.75rem;
}

.library-filter-actions strong {
  color: var(--brand);
  font-family: "Songti SC", "STSong", serif;
  font-size: 1.2rem;
}

.library-filter-actions a,
.library-filter-actions button {
  min-height: 2.55rem;
  padding: 0.6rem 0.9rem;
  font-size: 0.75rem;
  font-weight: 700;
}

.library-filter-actions a {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  text-decoration: none;
}

.library-filter-actions button {
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #fff;
  cursor: pointer;
}

.library-filter-actions button:hover {
  border-color: var(--brand-bright);
  background: var(--brand-bright);
}

.primary-link,
.open-record-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.7rem;
  padding: 0.65rem 1rem;
  background: var(--brand);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
}

.primary-link:hover,
.open-record-link:hover {
  background: var(--brand-bright);
}

.open-record-link {
  flex: none;
  min-height: 2.25rem;
  padding: 0.45rem 0.8rem;
  background: transparent;
  border: 1px solid var(--brand-bright);
  color: var(--brand-bright);
}

.open-record-link:hover {
  color: #fff;
}

.library-index span,
.library-index strong,
.library-index small {
  display: block;
}

.library-index span,
.library-index small {
  color: var(--ink-soft);
  font-size: 0.7rem;
}

.library-index strong {
  margin: 0.2rem 0 0.1rem;
  font-family: "Songti SC", "STSong", serif;
  font-size: 2.5rem;
}

.library-filters {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 3rem 0 1.25rem;
  border: 1px solid var(--line);
  background: var(--paper);
}

.library-filters a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.15rem;
  border-right: 1px solid var(--line);
  color: var(--ink-soft);
  text-decoration: none;
}

.library-filters a:last-child {
  border-right: 0;
}

.library-filters a:hover,
.library-filters a[aria-current="page"] {
  background: var(--brand-pale);
  color: var(--brand);
}

.library-filters a[aria-current="page"] {
  box-shadow: inset 0 -0.2rem var(--brand-bright);
}

.library-filters span {
  font-size: 0.82rem;
  font-weight: 650;
}

.library-filters strong {
  font-family: "Songti SC", "STSong", serif;
  font-size: 1.35rem;
}

.programme-list {
  display: grid;
  gap: 1rem;
}

.programme-card {
  display: grid;
  grid-template-columns: 3.3rem minmax(0, 1fr);
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: 0 0.75rem 2.4rem rgb(16 35 63 / 6%);
}

.programme-state {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0.75rem;
  border-right: 1px solid var(--line);
  color: var(--brand);
  writing-mode: vertical-rl;
}

.programme-state span {
  font-family: "Songti SC", "STSong", serif;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.programme-state small {
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.programme-state--draft,
.programme-state--in_review {
  background: var(--brand);
  color: #fff;
}

.programme-state--approved {
  background: #e9f5ef;
  color: #14603e;
}

.programme-state--rejected {
  background: #f8ebec;
  color: var(--danger);
}

.programme-body {
  min-width: 0;
  padding: clamp(1.35rem, 3vw, 2rem);
}

.programme-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
}

.programme-code {
  margin-bottom: 0.65rem;
  color: var(--ink-soft);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  overflow-wrap: anywhere;
}

.programme-heading h2 {
  margin-bottom: 0.35rem;
  font-size: clamp(1.65rem, 4vw, 2.4rem);
}

.programme-name-en {
  margin-bottom: 0;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.read-only-label {
  flex: none;
  padding: 0.3rem 0.55rem;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.68rem;
}

.programme-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 1.75rem;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.programme-facts section {
  min-width: 0;
  padding: 1rem;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.programme-facts h3 {
  margin: 0 0 0.45rem;
  color: var(--ink-soft);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
}

.programme-facts p {
  margin-bottom: 0;
  font-size: 0.85rem;
  line-height: 1.65;
}

.institution-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.institution-list li {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  font-size: 0.82rem;
  line-height: 1.6;
}

.institution-list li + li {
  margin-top: 0.3rem;
}

.institution-list span {
  flex: none;
  padding: 0.08rem 0.3rem;
  background: var(--brand-pale);
  color: var(--brand);
  font-size: 0.62rem;
}

.unknown-value {
  color: #8a6517;
}

.programme-intro {
  margin: 1.25rem 0 0;
  padding: 1rem 1.1rem;
  background: #f5f8fc;
  color: var(--ink-soft);
  font-size: 0.86rem;
  line-height: 1.8;
}

.programme-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-top: 1.25rem;
}

.programme-footer > p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.68rem;
  text-align: right;
}

.missing-fields strong {
  display: block;
  margin-bottom: 0.45rem;
  color: #76520b;
  font-size: 0.7rem;
}

.missing-fields ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.missing-fields li {
  padding: 0.25rem 0.45rem;
  border: 1px solid #dfc376;
  background: #fff9e9;
  color: #76520b;
  font-size: 0.68rem;
}

.complete-fields {
  margin: 0;
  color: #14603e;
  font-size: 0.75rem;
  font-weight: 650;
}

.library-empty {
  min-height: 21rem;
  display: grid;
  grid-template-columns: 4rem minmax(0, 1fr);
  align-items: stretch;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: 0 0.75rem 2.4rem rgb(16 35 63 / 6%);
}

.library-empty > span {
  display: grid;
  place-items: center;
  background: var(--brand);
  color: #fff;
  font-family: "Songti SC", "STSong", serif;
  font-weight: 700;
  letter-spacing: 0.18em;
  writing-mode: vertical-rl;
}

.library-empty > div {
  align-self: center;
  max-width: 35rem;
  padding: clamp(2rem, 6vw, 4rem);
}

.library-empty h2 {
  margin-bottom: 0.8rem;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
}

.library-empty h2 + p {
  margin-bottom: 1.4rem;
  color: var(--ink-soft);
  line-height: 1.8;
}

.library-empty .primary-link {
  width: fit-content;
}

.editor-content {
  width: min(100% - 3rem, 70rem);
  margin: 0 auto;
  padding: clamp(2.75rem, 6vw, 5rem) 0 7rem;
}

.editor-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 9rem;
  align-items: end;
  gap: clamp(1.5rem, 4vw, 3.5rem);
  margin-bottom: 2rem;
}

.editor-intro h1 {
  max-width: 17em;
  margin-bottom: 0.8rem;
  font-size: clamp(2.5rem, 6vw, 4.8rem);
  line-height: 1.04;
  letter-spacing: -0.04em;
}

.editor-intro > div:first-child > p:last-child {
  max-width: 40rem;
  margin-bottom: 0;
  color: var(--ink-soft);
  line-height: 1.8;
}

.version-seal {
  min-height: 8.4rem;
  display: grid;
  align-content: center;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-top: 0.35rem solid var(--brand);
  background: var(--paper);
  box-shadow: 0 0.8rem 2rem rgb(16 35 63 / 7%);
}

.version-seal span,
.version-seal small {
  color: var(--ink-soft);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
}

.version-seal strong {
  margin: 0.15rem 0;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 2rem;
}

.programme-editor {
  display: grid;
  gap: 1rem;
}

.editor-section {
  display: grid;
  grid-template-columns: 9.5rem minmax(0, 1fr);
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: 0 0.75rem 2.4rem rgb(16 35 63 / 5%);
}

.editor-section > header {
  grid-row: 1 / span 2;
  padding: 1.4rem 1.2rem;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, var(--brand-pale), #f7fafd);
}

.editor-section > header p {
  margin-bottom: 2.25rem;
  color: var(--brand-bright);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.editor-section > header h2 {
  margin-bottom: 0.45rem;
  font-size: 1.45rem;
  line-height: 1.2;
}

.editor-section > header span {
  display: block;
  color: var(--ink-soft);
  font-size: 0.68rem;
  line-height: 1.6;
}

.editor-fields {
  min-width: 0;
  display: grid;
  gap: 1.25rem 1.1rem;
  padding: clamp(1.4rem, 3vw, 2rem);
}

.editor-fields--two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.editor-fields label {
  min-width: 0;
}

.editor-fields label > span {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.45rem;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 700;
}

.editor-fields label em {
  color: var(--danger);
  font-size: 0.65rem;
  font-style: normal;
  font-weight: 650;
}

.editor-fields input,
.editor-fields select,
.editor-fields textarea {
  width: 100%;
  border: 1px solid #91a3b7;
  border-radius: 0.16rem;
  background: #fff;
  color: var(--ink);
}

.editor-fields input,
.editor-fields select {
  min-height: 2.85rem;
  padding: 0.65rem 0.75rem;
}

.editor-fields textarea {
  min-height: 6rem;
  padding: 0.75rem;
  line-height: 1.7;
  resize: vertical;
}

.editor-fields input::placeholder,
.editor-fields textarea::placeholder {
  color: #8290a2;
}

.editor-fields input[readonly],
.editor-fields textarea[readonly],
.editor-fields select:disabled {
  border-color: var(--line);
  background: #f1f4f8;
  color: var(--ink-soft);
  opacity: 1;
}

.field-wide {
  grid-column: 1 / -1;
}

.field-error {
  display: block;
  margin-top: 0.4rem;
  color: var(--danger);
  font-size: 0.68rem;
  line-height: 1.5;
}

.field-error--group {
  grid-column: 2;
  margin: 1.2rem 2rem 0;
  padding: 0.7rem 0.8rem;
  border-left: 0.2rem solid var(--danger);
  background: #fae9ea;
}

.form-notice {
  margin-bottom: 0;
  padding: 0.9rem 1rem;
  border-left: 0.25rem solid #27704e;
  background: #e9f5ef;
  color: #17533a;
  line-height: 1.6;
}

.form-notice--conflict {
  border-left-color: var(--signal);
  background: #fff8e6;
  color: #76520b;
}

.related-data-note {
  display: grid;
  grid-template-columns: 10rem minmax(0, 1fr);
  gap: 1.25rem;
  padding: 1rem 1.25rem;
  border: 1px dashed #9aabbc;
  background: rgb(251 252 254 / 65%);
}

.related-data-note strong {
  color: var(--brand);
  font-family: "Songti SC", "STSong", serif;
}

.related-data-note p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.76rem;
  line-height: 1.7;
}

.editor-actions {
  position: sticky;
  bottom: 1rem;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.2rem;
  border: 1px solid var(--line);
  border-top: 0.25rem solid var(--signal);
  background: rgb(251 252 254 / 96%);
  box-shadow: 0 1rem 3rem rgb(16 35 63 / 15%);
}

.editor-actions p {
  margin: 0;
}

.editor-actions p strong,
.editor-actions p span {
  display: block;
}

.editor-actions p strong {
  margin-bottom: 0.2rem;
  color: var(--ink);
  font-size: 0.76rem;
}

.editor-actions p span {
  color: var(--ink-soft);
  font-size: 0.68rem;
}

.editor-actions a,
.editor-actions button {
  min-height: 2.7rem;
  padding: 0.65rem 1.1rem;
  border-radius: 0.16rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
}

.editor-actions a {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  color: var(--ink-soft);
}

.editor-actions button {
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #fff;
  cursor: pointer;
}

.editor-actions button:hover {
  background: var(--brand-bright);
  border-color: var(--brand-bright);
}

.editor-actions .approval-button {
  border-color: #27704e;
  background: #27704e;
}

.editor-actions .approval-button:hover {
  border-color: #17533a;
  background: #17533a;
}

.editor-actions--readonly {
  position: static;
  grid-template-columns: minmax(0, 1fr) auto;
  border-top-color: var(--line);
  box-shadow: none;
}

@media (max-width: 52rem) {
  .workspace-intro {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .folio-note {
    width: fit-content;
  }

  .workflow-grid {
    grid-template-columns: 1fr;
  }

  .library-intro {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .library-index {
    width: fit-content;
  }

  .library-side-actions {
    width: fit-content;
  }

  .editor-intro {
    grid-template-columns: minmax(0, 1fr) 8rem;
  }

  .editor-section {
    grid-template-columns: 1fr;
  }

  .editor-section > header {
    grid-row: auto;
    display: grid;
    grid-template-columns: 5rem minmax(0, 1fr);
    align-items: center;
    padding: 1rem 1.25rem;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .editor-section > header p {
    margin: 0;
  }

  .field-error--group {
    grid-column: 1;
  }

  .programme-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workflow-card,
  .workflow-card--next {
    min-height: 13rem;
    transform: none;
  }
}

@media (max-width: 36rem) {
  .page-shell {
    padding: 1rem;
  }

  .login-card {
    padding: 2.25rem 1.5rem 2rem;
  }

  .workspace-header {
    align-items: flex-start;
    padding: 1rem 1.25rem;
  }

  .brand-lockup small,
  .advisor-controls p span,
  .workspace-nav {
    display: none;
  }

  .advisor-controls {
    gap: 0.6rem;
  }

  .workspace-content {
    width: min(100% - 2rem, 76rem);
    padding-top: 3.25rem;
  }

  .library-content {
    width: min(100% - 2rem, 76rem);
    padding-top: 3rem;
  }

  .editor-content {
    width: min(100% - 2rem, 70rem);
    padding-top: 3rem;
  }

  .editor-intro {
    grid-template-columns: 1fr;
  }

  .version-seal {
    width: 8.5rem;
    min-height: 0;
  }

  .editor-fields--two {
    grid-template-columns: 1fr;
  }

  .field-wide {
    grid-column: auto;
  }

  .related-data-note,
  .editor-actions,
  .editor-actions--readonly {
    grid-template-columns: 1fr;
  }

  .editor-actions {
    position: static;
  }

  .editor-actions a,
  .editor-actions button {
    justify-content: center;
    width: 100%;
    text-align: center;
  }

  .library-filters {
    grid-template-columns: repeat(2, 1fr);
  }

  .library-filters a:nth-child(2) {
    border-right: 0;
  }

  .library-filters a:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .library-filter-panel > header,
  .library-filter-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .library-filter-actions p {
    margin-right: 0;
  }

  .library-filter-actions a,
  .library-filter-actions button {
    justify-content: center;
    text-align: center;
  }

  .programme-card {
    grid-template-columns: 2.8rem minmax(0, 1fr);
  }

  .programme-heading,
  .programme-footer {
    display: block;
  }

  .open-record-link {
    display: inline-block;
    margin-top: 0.75rem;
  }

  .programme-facts {
    grid-template-columns: 1fr;
  }

  .programme-footer > p {
    margin-top: 1rem;
    text-align: left;
  }

  .workspace-intro h1 {
    font-size: clamp(2.75rem, 15vw, 4rem);
  }

  .workspace-footer {
    display: block;
  }

  .workspace-footer p + p {
    margin-top: 0.5rem;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .workflow-card {
    transition: transform 160ms ease, box-shadow 160ms ease;
  }

  .workflow-card:hover {
    transform: translateY(-0.3rem);
    box-shadow: 0 1.1rem 2.8rem rgb(16 35 63 / 11%);
  }

  .workflow-card--next:hover {
    transform: translateY(-0.95rem);
  }
}

/* Matching results: a saved selection docket with an explicit Agent seal. */
.match-workspace {
  padding-bottom: 7rem;
}

.match-masthead {
  align-items: end;
}

.matching-folio {
  min-width: 12rem;
  padding: 1rem 1.2rem;
  border: 1px solid var(--line);
  border-top: 0.25rem solid var(--brand);
  background: var(--paper);
  text-align: right;
}

.matching-folio span,
.matching-folio strong,
.matching-folio small {
  display: block;
}

.matching-folio span,
.matching-folio small {
  color: var(--ink-soft);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
}

.matching-folio strong {
  margin: 0.35rem 0;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 1.1rem;
}

.agent-status {
  display: grid;
  grid-template-columns: 4.25rem minmax(0, 1fr);
  align-items: stretch;
  margin-bottom: 1.25rem;
  border: 1px solid var(--line);
  background: var(--paper);
}

.agent-status__mark {
  display: grid;
  place-items: center;
  background: #245f3f;
  color: #fff;
  font-family: "Songti SC", "STSong", serif;
  font-size: 2rem;
  font-weight: 700;
}

.agent-status > div {
  padding: 1.1rem 1.3rem;
}

.agent-status .eyebrow {
  margin-bottom: 0.35rem;
}

.agent-status h2 {
  margin-bottom: 0.25rem;
  font-size: 1.25rem;
}

.agent-status p:last-child {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.82rem;
  line-height: 1.65;
}

.agent-status--warning {
  border-color: #d2b56e;
  background: #fffaf0;
}

.agent-status--warning .agent-status__mark {
  background: #9a6b13;
}

.agent-status--warning .eyebrow,
.agent-status--warning h2 {
  color: #76520b;
}

.matching-list {
  display: grid;
  gap: 1rem;
}

.matching-card {
  display: grid;
  grid-template-columns: 5rem minmax(0, 1fr);
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: 0 0.8rem 2.5rem rgb(16 35 63 / 6%);
}

.rank-spine {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0.25rem;
  padding: 1.35rem 0.5rem;
  border-right: 1px solid #244d80;
  background: var(--brand);
  color: #fff;
}

.rank-spine small {
  font-size: 0.58rem;
  letter-spacing: 0.16em;
  writing-mode: vertical-rl;
}

.rank-spine strong {
  margin-top: 0.65rem;
  font-family: "Songti SC", "STSong", serif;
  font-size: 2.1rem;
  line-height: 1;
}

.matching-card__body {
  min-width: 0;
  padding: clamp(1.35rem, 3vw, 2rem);
}

.matching-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
}

.matching-card__type {
  margin-bottom: 0.4rem;
  color: var(--brand-bright);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.matching-card__header h2 {
  margin-bottom: 0.35rem;
  font-size: clamp(1.45rem, 3vw, 2.15rem);
}

.matching-card__header > div > p:last-child {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.8rem;
}

.match-score {
  flex: none;
  width: 7rem;
  padding: 0.7rem 0.8rem;
  border-left: 0.2rem solid var(--signal);
  background: #f5f8fc;
  text-align: right;
}

.match-score span,
.match-score strong,
.match-score small {
  display: block;
}

.match-score span,
.match-score small {
  color: var(--ink-soft);
  font-size: 0.62rem;
}

.match-score strong {
  color: var(--brand);
  font-family: "Songti SC", "STSong", serif;
  font-size: 2rem;
  line-height: 1.05;
}

.matching-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 1.3rem 0 0;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.matching-facts div {
  padding: 0.8rem 0.9rem;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.matching-facts dt {
  margin-bottom: 0.3rem;
  color: var(--ink-soft);
  font-size: 0.65rem;
}

.matching-facts dd {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.55;
}

.matching-intro,
.matching-reason {
  margin: 1rem 0 0;
  line-height: 1.75;
}

.matching-intro {
  color: var(--ink-soft);
  font-size: 0.84rem;
}

.matching-reason {
  padding: 0.75rem 0.9rem;
  background: var(--brand-pale);
  font-size: 0.8rem;
}

.matching-reason strong {
  margin-right: 0.75rem;
  color: var(--brand);
}

.matching-warnings {
  margin: 0.9rem 0 0;
  padding: 0;
  list-style: none;
}

.matching-warnings li {
  padding: 0.55rem 0.75rem;
  border-left: 0.2rem solid #b28a32;
  background: #fff8e6;
  color: #76520b;
  font-size: 0.75rem;
}

.matching-warnings li + li {
  margin-top: 0.35rem;
}

.matching-actions {
  position: sticky;
  bottom: 1rem;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: 1.25rem;
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--line);
  border-top: 0.25rem solid var(--signal);
  background: rgb(251 252 254 / 96%);
  box-shadow: 0 1rem 3rem rgb(16 35 63 / 14%);
}

.matching-actions .quiet-link {
  margin-right: auto;
}

.matching-actions form {
  margin: 0;
}

.match-empty {
  margin-top: 0;
}

@media (max-width: 52rem) {
  .matching-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 36rem) {
  .matching-folio {
    width: 100%;
    text-align: left;
  }

  .agent-status {
    grid-template-columns: 3.25rem minmax(0, 1fr);
  }

  .matching-card {
    grid-template-columns: 3.5rem minmax(0, 1fr);
  }

  .matching-card__header {
    display: block;
  }

  .match-score {
    width: 100%;
    margin-top: 1rem;
    text-align: left;
  }

  .matching-facts {
    grid-template-columns: 1fr;
  }

  .matching-actions {
    position: static;
    flex-direction: column;
    align-items: stretch;
  }

  .matching-actions .quiet-link {
    margin-right: 0;
  }

  .matching-actions button {
    width: 100%;
  }
}

/* Plan adjustment: an editorial desk, not a generic settings form. */
.primary-button--signal {
  background: var(--signal);
  color: var(--ink);
}

.primary-button--signal:hover {
  background: #cda63d;
}

.plan-editor {
  padding-bottom: 7rem;
}

.plan-editor__masthead {
  align-items: end;
}

.flash-banner {
  margin-bottom: 1rem;
  padding: 0.9rem 1.1rem;
  border-left: 0.25rem solid var(--brand);
  background: var(--paper);
  font-size: 0.82rem;
}

.flash-banner--success {
  border-color: #2d7650;
  background: #f1faf5;
  color: #245f3f;
}

.flash-banner--error {
  border-color: #a23434;
  background: #fff3f2;
  color: #7a2424;
}

.plan-adjustment-list {
  display: grid;
  gap: 1rem;
}

.plan-adjustment-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-left: 0.35rem solid var(--brand);
  background: var(--paper);
  box-shadow: 0 0.8rem 2.5rem rgb(16 35 63 / 6%);
}

.plan-adjustment-card--excluded {
  border-left-color: #9ca7b5;
  background: #f4f6f8;
  opacity: 0.78;
}

.plan-adjustment-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 1.2rem;
  border-bottom: 1px solid var(--line);
  background: var(--brand-pale);
}

.plan-adjustment-card--excluded .plan-adjustment-card__header {
  background: #e9edf1;
}

.include-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--brand);
  font-size: 0.8rem;
  font-weight: 700;
}

.include-switch input {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--brand);
}

.priority-field {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--ink-soft);
  font-size: 0.72rem;
}

.priority-field input {
  width: 4.5rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--line-dark);
  background: #fff;
  color: var(--ink);
  text-align: center;
}

.plan-adjustment-card__identity {
  padding: 1.35rem 1.5rem 1rem;
}

.plan-adjustment-card__identity p {
  margin-bottom: 0.35rem;
  color: var(--brand-bright);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.plan-adjustment-card__identity h2 {
  margin-bottom: 0.3rem;
  font-size: clamp(1.4rem, 3vw, 2rem);
}

.plan-adjustment-card__identity span {
  color: var(--ink-soft);
  font-size: 0.8rem;
}

.plan-copy-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  padding: 0 1.5rem;
}

.plan-copy-grid label,
.plan-warning-field,
.quote-fields label {
  color: var(--ink-soft);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.plan-copy-grid textarea,
.plan-warning-field textarea,
.quote-fields input,
.quote-fields select {
  display: block;
  width: 100%;
  margin-top: 0.4rem;
  border: 1px solid var(--line-dark);
  border-radius: 0;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 400;
}

.plan-copy-grid textarea,
.plan-warning-field textarea {
  resize: vertical;
  padding: 0.75rem;
  line-height: 1.65;
}

.plan-warning-field {
  display: block;
  padding: 1rem 1.5rem 0;
}

.quote-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin: 1.25rem 1.5rem 1.5rem;
  padding: 1rem;
  border: 1px solid var(--line);
  background: #f7f9fc;
}

.quote-fields legend {
  padding: 0 0.45rem;
  color: var(--brand);
  font-family: "Songti SC", "STSong", serif;
  font-size: 0.95rem;
  font-weight: 700;
}

.quote-fields legend small {
  color: var(--ink-soft);
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 0.65rem;
  font-weight: 400;
}

.quote-fields input,
.quote-fields select {
  min-height: 2.6rem;
  padding: 0.55rem 0.65rem;
}

.plan-editor__actions {
  flex-wrap: wrap;
}

@media (max-width: 46rem) {
  .plan-copy-grid,
  .quote-fields {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 36rem) {
  .plan-adjustment-card__header {
    align-items: flex-start;
  }

  .plan-adjustment-card__identity,
  .plan-copy-grid,
  .plan-warning-field {
    padding-right: 1rem;
    padding-left: 1rem;
  }

  .quote-fields {
    margin-right: 1rem;
    margin-left: 1rem;
  }
}

/* Customer preview: an A4-minded document surface with print-safe controls. */
.plan-preview-page {
  min-height: 100vh;
  padding: 1.5rem;
  background: #e8edf3;
}

.preview-toolbar {
  position: sticky;
  top: 1rem;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 66rem;
  margin: 0 auto 1rem;
  padding: 0.8rem 1rem;
  border: 1px solid var(--line);
  background: rgb(255 255 255 / 96%);
  box-shadow: 0 0.75rem 2rem rgb(16 35 63 / 10%);
}

.preview-toolbar div {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.preview-toolbar strong {
  color: var(--brand);
  font-family: "Songti SC", "STSong", serif;
}

.preview-toolbar span {
  color: var(--ink-soft);
  font-size: 0.72rem;
}

.preview-toolbar__actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.preview-toolbar__actions form {
  margin: 0;
}

.customer-plan {
  max-width: 66rem;
  margin: 0 auto;
  background: #fff;
  box-shadow: 0 1.5rem 5rem rgb(16 35 63 / 14%);
}

.customer-plan__cover {
  position: relative;
  overflow: hidden;
  min-height: 28rem;
  padding: clamp(2.5rem, 7vw, 5rem);
  background: var(--brand);
  color: #fff;
}

.customer-plan__cover::after {
  position: absolute;
  right: -8rem;
  bottom: -13rem;
  width: 34rem;
  height: 34rem;
  border: 1px solid rgb(255 255 255 / 18%);
  border-radius: 50%;
  box-shadow: 0 0 0 4rem rgb(255 255 255 / 4%),
    0 0 0 8rem rgb(255 255 255 / 3%);
  content: "";
}

.customer-plan__brand {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.customer-plan__brand span {
  display: grid;
  width: 2.6rem;
  height: 2.6rem;
  place-items: center;
  background: var(--signal);
  color: var(--brand);
  font-family: "Songti SC", "STSong", serif;
  font-size: 1.3rem;
}

.customer-plan__brand strong {
  font-family: "Songti SC", "STSong", serif;
  font-size: 1.25rem;
  letter-spacing: 0.12em;
}

.customer-plan__cover > p {
  position: relative;
  z-index: 1;
  margin: clamp(4rem, 10vw, 7rem) 0 0.75rem;
  color: #cbd8ea;
  font-size: 0.7rem;
  letter-spacing: 0.28em;
}

.customer-plan__cover h1 {
  position: relative;
  z-index: 1;
  margin: 0;
  color: #fff;
  font-size: clamp(3.8rem, 11vw, 7.5rem);
  letter-spacing: 0.08em;
  line-height: 1;
}

.customer-plan__meta {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 0.45rem 1rem;
  max-width: 25rem;
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 0.2rem solid var(--signal);
}

.customer-plan__meta span {
  color: #aebfd4;
  font-size: 0.7rem;
}

.customer-plan__meta strong {
  font-size: 0.85rem;
}

.customer-plan__requirements {
  display: grid;
  grid-template-columns: 8rem minmax(0, 1fr);
  gap: 0 2rem;
  padding: clamp(2rem, 6vw, 4rem) clamp(1.5rem, 7vw, 5rem);
  border-bottom: 1px solid var(--line);
}

.customer-plan__requirements > p {
  grid-row: span 2;
  margin: 0;
  padding-top: 0.2rem;
  color: var(--brand-bright);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.15em;
}

.customer-plan__requirements h2 {
  margin-bottom: 0.75rem;
  font-size: 1.8rem;
}

.customer-plan__requirements div {
  color: var(--ink-soft);
  line-height: 1.8;
}

.customer-programmes {
  padding: clamp(2rem, 6vw, 4rem) clamp(1.5rem, 7vw, 5rem);
}

.customer-programme {
  display: grid;
  grid-template-columns: 5rem minmax(0, 1fr);
  border: 1px solid var(--line);
  break-inside: avoid;
}

.customer-programme + .customer-programme {
  margin-top: 1.5rem;
}

.customer-programme__number {
  padding: 1.4rem 0.75rem;
  background: var(--brand);
  color: #fff;
  text-align: center;
}

.customer-programme__number small,
.customer-programme__number strong {
  display: block;
}

.customer-programme__number small {
  color: #cbd8ea;
  font-size: 0.55rem;
  letter-spacing: 0.14em;
  writing-mode: vertical-rl;
  margin: 0 auto 1rem;
}

.customer-programme__number strong {
  font-family: "Songti SC", "STSong", serif;
  font-size: 2rem;
}

.customer-programme__body {
  min-width: 0;
  padding: clamp(1.4rem, 4vw, 2.25rem);
}

.customer-programme__body > header > p {
  margin-bottom: 0.4rem;
  color: var(--brand-bright);
  font-size: 0.7rem;
  font-weight: 700;
}

.customer-programme__body > header h2 {
  margin-bottom: 0.35rem;
  font-size: clamp(1.6rem, 4vw, 2.35rem);
}

.customer-programme__body > header span {
  color: var(--ink-soft);
  font-size: 0.8rem;
}

.customer-programme__facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 1.4rem 0;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.customer-programme__facts div {
  padding: 0.85rem;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.customer-programme__facts dt {
  margin-bottom: 0.25rem;
  color: var(--ink-soft);
  font-size: 0.65rem;
}

.customer-programme__facts dd {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.5;
}

.customer-programme__section {
  margin-top: 1rem;
}

.customer-programme__section h3,
.customer-programme__warnings h3 {
  margin-bottom: 0.35rem;
  color: var(--brand);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
}

.customer-programme__section p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.84rem;
  line-height: 1.8;
}

.customer-programme__reason {
  padding: 0.9rem 1rem;
  background: var(--brand-pale);
}

.customer-programme__warnings {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border-left: 0.2rem solid #b28a32;
  background: #fff8e6;
}

.customer-programme__warnings h3 {
  color: #76520b;
}

.customer-programme__warnings ul {
  margin: 0;
  padding-left: 1.15rem;
  color: #76520b;
  font-size: 0.78rem;
  line-height: 1.7;
}

.customer-plan__footer {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  padding: 2rem clamp(1.5rem, 7vw, 5rem);
  background: #f4f7fa;
  color: var(--ink-soft);
  font-size: 0.7rem;
  line-height: 1.7;
}

.customer-plan__footer p {
  max-width: 38rem;
  margin: 0;
}

.customer-plan__footer strong {
  color: var(--brand);
  white-space: nowrap;
}

@media (max-width: 40rem) {
  .plan-preview-page {
    padding: 0;
  }

  .preview-toolbar {
    top: 0;
    margin-bottom: 0;
    border-right: 0;
    border-left: 0;
  }

  .preview-toolbar div {
    display: block;
  }

  .preview-toolbar span {
    display: block;
    margin-top: 0.2rem;
  }

  .customer-plan {
    box-shadow: none;
  }

  .customer-plan__cover {
    min-height: 25rem;
  }

  .customer-plan__requirements {
    display: block;
  }

  .customer-plan__requirements > p {
    margin-bottom: 0.5rem;
  }

  .customer-programme {
    grid-template-columns: 3.5rem minmax(0, 1fr);
  }

  .customer-programme__facts {
    grid-template-columns: 1fr;
  }

  .customer-plan__footer {
    display: block;
  }

  .customer-plan__footer strong {
    display: block;
    margin-top: 0.75rem;
    white-space: normal;
  }
}

@media print {
  .plan-preview-page {
    padding: 0;
    background: #fff;
  }

  .preview-toolbar {
    display: none;
  }

  .customer-plan {
    max-width: none;
    box-shadow: none;
  }
}

.is-generating {
  overflow: hidden;
}

.generation-overlay {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: rgb(8 27 51 / 72%);
  backdrop-filter: blur(0.35rem);
}

.generation-overlay[hidden] {
  display: none;
}

.generation-dialog {
  width: min(100%, 32rem);
  padding: 2.4rem;
  border-top: 0.35rem solid var(--brand-bright);
  background: var(--paper);
  box-shadow: 0 2rem 6rem rgb(4 16 31 / 45%);
  text-align: center;
  outline: none;
}

.generation-dialog h2 {
  margin-bottom: 0.6rem;
  font-size: clamp(1.8rem, 5vw, 2.6rem);
}

.generation-stage {
  min-height: 1.5rem;
  margin-bottom: 1.25rem;
  color: var(--brand);
  font-weight: 750;
}

.generation-dialog > small {
  display: block;
  margin-top: 1rem;
  color: var(--ink-soft);
  line-height: 1.6;
}

.generation-progress {
  position: relative;
  height: 0.28rem;
  overflow: hidden;
  background: var(--line);
}

.generation-progress span {
  position: absolute;
  width: 40%;
  height: 100%;
  background: var(--brand-bright);
  animation: generation-sweep 1.35s ease-in-out infinite;
}

.generation-orbit {
  position: relative;
  width: 4.25rem;
  height: 4.25rem;
  margin: 0 auto 1.25rem;
  border: 1px solid var(--line);
  border-radius: 50%;
  animation: generation-spin 2.4s linear infinite;
}

.generation-orbit span {
  position: absolute;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: var(--brand-bright);
}

.generation-orbit span:nth-child(1) { top: -0.35rem; left: 1.75rem; }
.generation-orbit span:nth-child(2) { right: -0.15rem; bottom: 0.65rem; opacity: 0.72; }
.generation-orbit span:nth-child(3) { bottom: 0.15rem; left: 0.3rem; opacity: 0.45; }

@keyframes generation-spin {
  to { transform: rotate(360deg); }
}

@keyframes generation-sweep {
  0% { left: -45%; }
  55% { left: 60%; }
  100% { left: 105%; }
}

@media (prefers-reduced-motion: reduce) {
  .generation-orbit,
  .generation-progress span {
    animation-duration: 4s;
  }
}
