:root {
  --ink: #1d2730;
  --muted: #6e7a85;
  --soft: #eef3f4;
  --panel: #ffffff;
  --paper: #fffefa;
  --rule: #dce3e5;
  --accent: #0d6672;
  --accent-strong: #074b54;
  --wine: #8b2f49;
  --gold: #a97926;
  --shadow: 0 18px 55px rgba(29, 39, 48, 0.16);
  --body-font: "Georgia", "Times New Roman", "SimSun", serif;
  --heading-font: "Palatino Linotype", "Book Antiqua", "Songti SC", serif;
  --page-width: 185mm;
  --font-size: 10.5pt;
  --title-size: 21pt;
  --line-height: 1.5;
  --columns: 1;
  --margin-y: 21mm;
  --margin-x: 20mm;
  --column-gap: 8mm;
  --paragraph-indent: 1.5em;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: #eef2f3;
  font-family: "Aptos", "Segoe UI", "Microsoft YaHei", sans-serif;
}

body.auth-locked {
  overflow: hidden;
}

body.auth-locked .app-shell {
  filter: blur(3px);
  pointer-events: none;
  user-select: none;
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(13, 102, 114, 0.18), rgba(255, 254, 250, 0.86)),
    rgba(238, 242, 243, 0.92);
  backdrop-filter: blur(8px);
}

body:not(.auth-locked) .auth-gate {
  display: none;
}

.auth-card {
  width: min(460px, 100%);
  padding: 28px;
  background: #fffefa;
  border: 1px solid #d4dedf;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-card-copy h2 {
  margin: 0 0 8px;
  font-family: var(--heading-font);
  font-size: 28px;
  line-height: 1.1;
}

.auth-card-copy p {
  margin-bottom: 10px;
  color: var(--muted);
  line-height: 1.7;
}

.auth-card-copy small {
  display: inline-flex;
  padding: 5px 8px;
  color: var(--accent-strong);
  background: #e6f3f3;
  border: 1px solid #c5e3e5;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.auth-view-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 20px 0 14px;
}

.auth-view-button {
  min-height: 46px;
  color: var(--muted);
  background: #f3f7f8;
  border: 1px solid #d1dedf;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 900;
}

.auth-view-button.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 8px 20px rgba(13, 102, 114, 0.18);
}

.auth-view-button:not(.active):hover {
  color: var(--accent-strong);
  background: #e8f2f3;
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-slider {
  overflow: hidden;
  margin-top: 14px;
  border-radius: 8px;
}

.auth-track {
  display: flex;
  width: 200%;
  transition: transform 320ms cubic-bezier(0.22, 1, 0.36, 1);
}

.auth-slider.show-register .auth-track {
  transform: translateX(-50%);
}

.auth-page {
  flex: 0 0 50%;
  min-width: 0;
}

.auth-page[aria-hidden="true"] {
  pointer-events: none;
}

.auth-form-head {
  display: grid;
  gap: 5px;
  padding: 14px;
  background: #f5f9f9;
  border: 1px solid #dce7e8;
  border-radius: 8px;
}

.auth-form-head h3 {
  margin: 0;
  font-family: var(--heading-font);
  font-size: 21px;
}

.auth-form-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.auth-form label {
  display: grid;
  gap: 6px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 850;
}

.auth-message {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--wine);
  font-size: 13px;
  font-weight: 850;
  line-height: 1.5;
}

.auth-switch {
  min-height: 34px;
  color: var(--accent-strong);
  background: transparent;
  border: 0;
  font-size: 13px;
  font-weight: 900;
  text-align: center;
}

.auth-switch:hover {
  text-decoration: underline;
}

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

[hidden] {
  display: none !important;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(520px, 650px) 1fr;
  min-height: 100vh;
}

.control-panel {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  padding: 22px 24px 30px;
  background: var(--panel);
  border-right: 1px solid #d8e0e3;
}

.brand-strip,
.workspace-toolbar,
.section-title,
.section-title > div,
.inline-actions,
.toolbar-actions {
  display: flex;
  align-items: center;
}

.brand-strip,
.workspace-toolbar,
.section-title.with-meta {
  justify-content: space-between;
  gap: 16px;
}

.brand-strip {
  flex-wrap: wrap;
}

.account-actions {
  display: flex;
  flex: 1 0 100%;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

.account-pill {
  min-width: 0;
  max-width: 260px;
  overflow: hidden;
  padding: 7px 10px;
  color: #4b3941;
  background: #f7edf0;
  border: 1px solid #e8ccd5;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 25px;
  line-height: 1.05;
  letter-spacing: 0;
}

.status-pill {
  flex: 0 0 auto;
  padding: 7px 11px;
  color: var(--accent-strong);
  background: #dceff0;
  border: 1px solid #b8dfe2;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 16px;
}

.metric-row span {
  min-width: 0;
  padding: 10px 11px;
  color: var(--muted);
  background: #f5f8f9;
  border: 1px solid #dce5e7;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 750;
}

.metric-row b {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 15px;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversion-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.conversion-strip div {
  min-width: 0;
  padding: 10px 11px;
  background: #fffefa;
  border: 1px solid #dfe7e9;
  border-radius: 6px;
}

.conversion-strip b {
  display: block;
  margin-bottom: 4px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 950;
}

.conversion-strip span {
  display: block;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.45;
}

.workflow-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-top: 10px;
  padding: 7px;
  background: #eef5f6;
  border: 1px solid #d6e2e4;
  border-radius: 7px;
}

.workflow-step {
  min-width: 0;
  padding: 7px 6px;
  color: #617179;
  background: transparent;
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: 900;
  text-align: center;
  white-space: nowrap;
}

.workflow-step.active {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 6px 16px rgba(13, 102, 114, 0.18);
}

.panel-block {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid #e0e7e9;
}

.section-title {
  gap: 10px;
  margin-bottom: 12px;
}

.section-title > div {
  gap: 10px;
}

.section-title span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
}

.section-title h2 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0;
}

.section-title small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.upload-zone {
  display: grid;
  min-height: 104px;
  place-items: center;
  gap: 6px;
  padding: 18px;
  text-align: center;
  background: #f7fbfb;
  border: 1.5px dashed #8eb8bd;
  border-radius: 8px;
  transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}

.upload-zone.drag-over {
  background: #e9f6f7;
  border-color: var(--accent);
  transform: translateY(-1px);
}

.upload-zone input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.upload-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  color: #fff;
  background: var(--accent);
  border-radius: 50%;
  font-size: 22px;
  font-weight: 900;
}

.upload-zone small {
  color: var(--muted);
}

textarea,
input,
select {
  width: 100%;
  color: var(--ink);
  background: #fffefa;
  border: 1px solid #cfd6d7;
  border-radius: 6px;
  outline: 0;
}

textarea {
  margin-top: 12px;
  padding: 11px 12px;
  resize: vertical;
  line-height: 1.55;
}

input,
select {
  height: 38px;
  padding: 0 10px;
}

textarea:focus,
input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(10, 111, 123, 0.14);
}

.inline-actions {
  gap: 10px;
  margin-top: 12px;
}

.primary-btn,
.ghost-btn {
  min-height: 40px;
  padding: 0 15px;
  border-radius: 6px;
  font-weight: 900;
}

.ghost-btn.is-active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.primary-btn {
  color: white;
  background: var(--accent);
}

.primary-btn:hover {
  background: var(--accent-strong);
}

.ghost-btn {
  color: var(--ink);
  background: transparent;
  border: 1px solid #b9c2c4;
}

.compact-btn {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.admin-panel,
.profile-panel {
  position: fixed;
  top: 84px;
  left: 50%;
  z-index: 30;
  padding: 18px;
  background: #f7fbfb;
  border: 1px solid #d8e5e6;
  border-radius: 8px;
  box-shadow: 0 22px 70px rgba(29, 39, 48, 0.24);
  transform: translateX(-50%);
}

.admin-panel {
  width: min(620px, calc(100vw - 32px));
  max-height: calc(100vh - 120px);
  overflow: auto;
}

.profile-panel {
  width: min(360px, calc(100vw - 32px));
}

.profile-panel label {
  display: grid;
  gap: 7px;
  margin-top: 14px;
}

.profile-panel input {
  width: 100%;
}

.admin-panel[hidden],
.profile-panel[hidden] {
  display: none;
}

.admin-panel-header,
.admin-panel-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.admin-panel-header {
  margin-bottom: 12px;
}

.admin-panel-header h2 {
  margin: 0;
  font-family: var(--heading-font);
  font-size: 22px;
}

.admin-panel-toolbar {
  margin-bottom: 12px;
  padding: 10px;
  background: #fffefa;
  border: 1px solid #dce7e8;
  border-radius: 7px;
}

.admin-panel-toolbar small {
  color: var(--muted);
  font-weight: 900;
}

.admin-panel-toolbar > div {
  display: flex;
  gap: 8px;
}

.admin-user-list {
  display: grid;
  gap: 10px;
}

.admin-user-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: #fffefa;
  border: 1px solid #dbe4e5;
  border-radius: 7px;
}

.admin-user-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.admin-user-card h3 {
  margin: 0 0 4px;
  font-size: 14px;
}

.admin-user-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.admin-user-actions {
  display: flex;
  gap: 8px;
}

.danger-btn {
  color: #7d263a;
  background: #fff2f5;
  border-color: #e6bac6;
}

.announcement-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(29, 39, 48, 0.34);
  backdrop-filter: blur(6px);
}

.payment-modal {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(29, 39, 48, 0.38);
  backdrop-filter: blur(6px);
}

.template-request-modal {
  position: fixed;
  inset: 0;
  z-index: 56;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(29, 39, 48, 0.38);
  backdrop-filter: blur(6px);
}

.template-request-modal[hidden] {
  display: none;
}

.template-request-card {
  width: min(520px, 100%);
  max-height: min(680px, calc(100dvh - 48px));
  overflow: auto;
  padding: 20px;
  background: #fffefa;
  border: 1px solid #d8e1e2;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.template-request-card label {
  display: grid;
  gap: 7px;
  margin-top: 13px;
  color: #3b454c;
  font-size: 12px;
  font-weight: 900;
}

.template-request-card input,
.template-request-card textarea {
  width: 100%;
}

.template-request-message {
  min-height: 20px;
  margin: 12px 0 0;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.announcement-card,
.payment-card {
  width: min(560px, 100%);
  max-height: min(680px, calc(100vh - 48px));
  overflow: auto;
  padding: 20px;
  background: #fffefa;
  border: 1px solid #d8e1e2;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.payment-card {
  width: min(620px, 100%);
}

.payment-modal[hidden] {
  display: none;
}

.announcement-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.announcement-header h2 {
  margin: 0;
  font-family: var(--heading-font);
  font-size: 24px;
}

.announcement-list,
.admin-announcement-list,
.admin-payment-list {
  display: grid;
  gap: 10px;
}

.announcement-item,
.admin-announcement-card,
.admin-payment-card {
  padding: 13px;
  background: #f7fbfb;
  border: 1px solid #dce7e8;
  border-radius: 7px;
}

.announcement-item h3,
.admin-announcement-card h3 {
  margin: 0 0 7px;
  font-size: 15px;
}

.announcement-item p,
.admin-announcement-card p {
  margin: 0 0 8px;
  color: #41505a;
  line-height: 1.7;
}

.announcement-item small,
.admin-announcement-card small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.admin-announcement-box {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #dce7e8;
}

.admin-payment-box {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #dce7e8;
}

.admin-template-request-box {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #dce7e8;
}

.admin-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.admin-metrics span {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 10px;
  color: var(--muted);
  background: #fffefa;
  border: 1px solid #dce7e8;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 800;
}

.admin-metrics b {
  overflow: hidden;
  color: var(--ink);
  font-family: var(--heading-font);
  font-size: 17px;
  text-overflow: ellipsis;
}

.admin-template-request-list {
  display: grid;
  gap: 10px;
}

.admin-template-request-card {
  display: grid;
  gap: 9px;
  padding: 13px;
  background: #fffefa;
  border: 1px solid #dce7e8;
  border-radius: 7px;
}

.admin-template-request-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.admin-template-request-card h3,
.admin-template-request-card p {
  margin: 0;
}

.admin-template-request-card h3 {
  font-size: 14px;
}

.admin-template-request-card p,
.admin-template-request-card a {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.admin-payment-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.admin-payment-card h3 {
  margin: 0 0 4px;
  font-size: 14px;
}

.admin-payment-card p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.payment-summary {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  background: #f7fbfb;
  border: 1px solid #dce7e8;
  border-radius: 7px;
}

.payment-summary span {
  color: var(--accent);
  font-family: var(--heading-font);
  font-size: 34px;
  font-weight: 900;
  line-height: 1;
}

.payment-summary small,
.payment-note {
  color: var(--muted);
  font-weight: 800;
}

.payment-methods {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0;
}

.payment-method-card {
  min-height: 178px;
  display: grid;
  place-items: center;
  gap: 10px;
  padding: 14px;
  text-align: center;
  background: #fff;
  border: 1px solid #dbe4e5;
  border-radius: 7px;
}

.payment-method-card strong {
  font-size: 15px;
}

.payment-method-card img {
  width: min(150px, 100%);
  aspect-ratio: 1;
  object-fit: contain;
  border: 1px solid #e0e7e8;
  border-radius: 6px;
}

.payment-method-card.disabled {
  color: var(--muted);
  background: #f7f8f6;
}

.payment-actions {
  justify-content: flex-end;
}

.compact-header {
  margin-bottom: 0;
}

.admin-announcement-box label {
  display: grid;
  gap: 6px;
  color: #3b454c;
  font-size: 12px;
  font-weight: 900;
}

.admin-announcement-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  background: #fffefa;
}

.subject-board {
  display: grid;
  margin-bottom: 14px;
  border: 1px solid #d9e3e5;
  border-radius: 6px;
  overflow: hidden;
  background: #fffefa;
}

.template-mode-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 12px;
  padding: 4px;
  background: #eef3f4;
  border: 1px solid #d8e1e2;
  border-radius: 7px;
}

.mode-tab {
  min-height: 34px;
  padding: 7px 8px;
  color: #526069;
  background: transparent;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 900;
}

.mode-tab:hover,
.mode-tab.active {
  color: var(--accent-strong);
  background: #fffefa;
  box-shadow: 0 1px 5px rgba(29, 39, 48, 0.08);
}

.template-search {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
  color: #3b454c;
  font-size: 13px;
  font-weight: 900;
}

.template-search input {
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  color: var(--ink);
  background: #fffefa;
  border: 1px solid #cfdadd;
  border-radius: 6px;
  outline: none;
}

.template-request-link {
  min-height: 34px;
  margin: -2px 0 10px;
  padding: 0;
  color: var(--accent);
  background: transparent;
  border: 0;
  font-size: 12px;
  font-weight: 850;
  text-align: left;
}

.template-request-link:hover {
  color: var(--wine);
  text-decoration: underline;
}

.template-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13, 102, 114, 0.12);
}

.subject-section {
  display: grid;
  grid-template-columns: 58px 1fr;
  border-bottom: 1px solid #e3e8e8;
}

.subject-section:last-child {
  border-bottom: 0;
}

.subject-label {
  display: grid;
  place-items: center;
  padding: 10px 8px;
  color: #0b5660;
  background: #eef7f8;
  font-size: 12px;
  font-weight: 950;
  text-align: center;
}

.subject-links {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0;
  padding: 7px;
}

.subject-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: 29px;
  padding: 4px 7px;
  color: var(--ink);
  background: transparent;
  border-radius: 5px;
  text-align: left;
}

.subject-link:hover:not(:disabled),
.subject-link.active {
  color: var(--accent-strong);
  background: #e4f4f5;
}

.subject-link:disabled {
  color: #a2aaad;
  cursor: default;
}

.subject-link span {
  min-width: 0;
  overflow: hidden;
  font-size: 11.5px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.subject-link small {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 10px;
}

.subject-link.active small {
  color: var(--accent-strong);
  font-weight: 900;
}

.school-focus {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
}

.school-focus div {
  min-width: 0;
}

.school-focus span,
.school-focus small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.school-focus strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 15px;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.school-back {
  padding: 7px 9px;
  color: var(--accent-strong);
  background: #e4f4f5;
  border: 1px solid #bfdee1;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 900;
}

.journal-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
  padding: 12px;
  background: #f6fafb;
  border: 1px solid #d8e1e2;
  border-radius: 6px;
}

.journal-picker label {
  display: grid;
  gap: 7px;
  color: #3b454c;
  font-size: 13px;
  font-weight: 850;
}

.template-list {
  display: grid;
  padding: 0;
  background: transparent;
  border-top: 1px solid #d9dddc;
}

.template-list.search-results-active {
  margin-top: 4px;
  border-top: 0;
}

.search-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  position: sticky;
  top: -22px;
  z-index: 2;
  margin: 0 0 6px;
  padding: 9px 10px;
  color: var(--muted);
  background: #f6fafb;
  border: 1px solid #d8e1e2;
  border-radius: 6px;
  font-size: 12px;
}

.search-summary strong {
  color: var(--accent-strong);
  font-size: 13px;
}

.search-summary.is-empty {
  display: grid;
  justify-items: start;
}

.school-filter-panel {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 10px;
  margin: 12px 0 4px;
  padding: 10px;
  background: #f6fafb;
  border: 1px solid #d8e1e2;
  border-radius: 6px;
}

.school-filter-panel label {
  display: grid;
  gap: 6px;
  color: #3b454c;
  font-size: 12px;
  font-weight: 900;
}

.custom-template-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  margin-top: 12px;
  padding: 12px;
  background: #fffefa;
  border: 1px solid #d8e1e2;
  border-radius: 6px;
}

.custom-template-box[hidden] {
  display: none;
}

.custom-template-box label {
  display: grid;
  gap: 7px;
  color: #3b454c;
  font-size: 13px;
  font-weight: 850;
}

.custom-template-box .ghost-btn {
  align-self: end;
}

.custom-description-field {
  grid-column: 1 / -1;
}

.custom-template-box small {
  align-self: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.overview-prompt {
  margin-top: 14px;
  padding: 14px;
  background: #fffefa;
  border: 1px solid #d8e1e2;
  border-radius: 6px;
}

.overview-prompt strong {
  display: block;
  margin-bottom: 6px;
  color: var(--accent-strong);
  font-size: 14px;
}

.overview-prompt p {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.accuracy-note {
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
  padding: 10px;
  color: #66501b;
  background: #fff6dc;
  border: 1px solid #e4cf91;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.45;
}

.accuracy-note b {
  color: #523d08;
  font-size: 12px;
}

.overview-counts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.overview-counts span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 9px;
  background: #f6fafb;
  border-radius: 5px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 850;
}

.overview-counts b {
  color: var(--wine);
}

.template-category {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding: 7px 2px 6px;
  color: var(--accent-strong);
  background: transparent;
  border-bottom: 1px solid #dde7e8;
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0;
}

.template-category span {
  display: grid;
  min-width: 24px;
  height: 20px;
  place-items: center;
  color: #fff;
  background: var(--accent);
  border-radius: 999px;
  font-size: 11px;
}

.template-row {
  display: grid;
  grid-template-columns: 26px minmax(170px, 1.35fr) minmax(96px, 0.48fr) auto;
  gap: 4px 8px;
  align-items: center;
  min-height: 38px;
  padding: 7px 9px;
  text-align: left;
  color: var(--ink);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  border-bottom: 1px solid rgba(217, 221, 220, 0.55);
}

.template-row:hover {
  background: #fffefa;
  border-color: #cdd9db;
}

.template-row.active {
  background: #e9f6f7;
  border-color: var(--accent);
}

.template-row.review-row {
  color: #57646a;
  background: #fbfaf6;
}

.template-row.review-row .journal-name {
  font-weight: 800;
}

.template-row.review-row .journal-initial {
  color: #7a4b08;
  background: #fff2d6;
}

.template-row.review-row.active {
  background: #fff7df;
  border-color: #e4c47e;
}

.journal-initial {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  color: var(--wine);
  background: #f8e8ec;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 950;
}

.journal-name {
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.journal-meta {
  justify-self: end;
  max-width: 120px;
  overflow: hidden;
  color: var(--wine);
  font-size: 11px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.journal-update {
  justify-self: end;
  color: #68767c;
  font-size: 10.5px;
  font-weight: 800;
  white-space: nowrap;
}

.template-row.ready-row .journal-update {
  color: #0f6267;
}

.journal-desc {
  grid-column: 2 / -1;
  min-width: 0;
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.template-row.user-row .journal-desc {
  grid-column: 2 / 4;
}

.template-delete {
  grid-column: 4;
  grid-row: 2;
  justify-self: end;
  color: var(--wine);
  font-size: 11px;
  font-weight: 900;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.template-empty {
  margin: 8px;
  color: var(--muted);
  font-size: 13px;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field-grid.compact {
  gap: 10px;
}

.field-grid label,
.full-label {
  display: grid;
  gap: 7px;
  color: #3b454c;
  font-size: 13px;
  font-weight: 850;
}

.full-label {
  margin-top: 12px;
}

.workspace {
  min-width: 0;
  padding: 22px clamp(18px, 3vw, 40px);
}

.workspace-toolbar {
  margin-bottom: 18px;
}

.workspace-toolbar h2 {
  margin: 0;
  font-size: 25px;
  line-height: 1.1;
}

.template-rules {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.template-source-line {
  display: none;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 8px 0 0;
  color: #526069;
  font-size: 12px;
  font-weight: 850;
}

.template-source-line span {
  padding: 3px 7px;
  color: #0d6672;
  background: #e9f6f7;
  border: 1px solid #bcdfe4;
  border-radius: 999px;
}

.template-source-line a {
  color: #7d263a;
  text-decoration: none;
  border-bottom: 1px solid rgba(125, 38, 58, 0.35);
}

.toolbar-actions {
  gap: 10px;
}

.export-select {
  width: 128px;
  height: 42px;
  padding: 0 10px;
  color: var(--ink);
  background: #fffefa;
  border: 1px solid rgba(31, 42, 51, 0.18);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 850;
}

.tool-btn {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: var(--ink);
  background: #fffefa;
  border: 1px solid rgba(31, 42, 51, 0.18);
  border-radius: 6px;
  font-size: 20px;
}

.proof-inspector {
  display: grid;
  grid-template-columns: minmax(150px, 0.9fr) minmax(260px, 1.7fr) minmax(180px, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.inspector-score,
.inspector-grid,
.inspector-pay {
  min-width: 0;
  padding: 12px 13px;
  background: #fffefa;
  border: 1px solid #d8e2e4;
  border-radius: 7px;
}

.inspector-score span {
  display: inline-flex;
  margin-bottom: 8px;
  padding: 4px 7px;
  color: #fff;
  background: var(--accent);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 950;
}

.inspector-score b,
.inspector-pay strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
}

.inspector-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.inspector-grid span {
  min-width: 0;
  padding: 7px 8px;
  color: #536169;
  background: #f3f7f8;
  border: 1px solid #dfe8ea;
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: 850;
  line-height: 1.35;
}

.inspector-grid span.ok {
  color: #075c61;
  background: #e6f6f4;
  border-color: #b8dedb;
}

.inspector-grid span.warn {
  color: #7a4b08;
  background: #fff5dc;
  border-color: #e4c47e;
}

.inspector-pay p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.45;
}

.proof-stage {
  display: flex;
  justify-content: center;
  padding: clamp(14px, 3vw, 36px);
  overflow: auto;
  background: #f7f9fa;
  border: 1px solid #d8e0e3;
  border-radius: 8px;
}

.paper-page {
  width: min(100%, var(--page-width));
  min-height: 255mm;
  padding: var(--margin-y) var(--margin-x);
  background: var(--paper);
  box-shadow: var(--shadow);
  font-family: var(--body-font);
  font-size: var(--font-size);
  line-height: var(--line-height);
}

.paper-page.nature,
.paper-page.science,
.paper-page.cell,
.paper-page.elsevier,
.paper-page.mdpi,
.paper-page.frontiers,
.paper-page.wiley,
.paper-page.taylor,
.paper-page.sage,
.paper-page.apa {
  --body-font: "Georgia", "Times New Roman", "SimSun", serif;
  --heading-font: "Palatino Linotype", "Book Antiqua", "Songti SC", serif;
}

.paper-page.ieee,
.paper-page.acm,
.paper-page.springer,
.paper-page.acs,
.paper-page.angewandte {
  --body-font: "Times New Roman", "SimSun", serif;
  --heading-font: "Times New Roman", "SimSun", serif;
}

.paper-page.china,
.paper-page.cscd,
.paper-page.cssci {
  --body-font: "SimSun", "Songti SC", serif;
  --heading-font: "SimHei", "Microsoft YaHei", sans-serif;
}

.paper-header {
  margin-bottom: 14px;
}

.paper-title {
  margin: 0 0 8px;
  font-family: var(--heading-font);
  font-size: var(--title-size);
  line-height: 1.14;
  text-align: center;
}

.authors,
.affiliation {
  margin: 0;
  text-align: center;
}

.authors {
  font-size: calc(var(--font-size) + 0.5pt);
  font-weight: 700;
}

.affiliation {
  margin-top: 4px;
  color: #5d666d;
  font-size: calc(var(--font-size) - 1pt);
  font-style: italic;
}

.template-proof-note {
  margin: 12px 0 14px;
  padding: 10px 12px;
  color: #3f4b52;
  background: #f7fbfb;
  border: 1px solid #d5e3e5;
  border-left: 4px solid #0d6672;
  border-radius: 6px;
  font-family: "Aptos", "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: calc(var(--font-size) - 1.5pt);
}

.template-proof-note.needs-source {
  background: #fff8ec;
  border-color: #ecd5a5;
  border-left-color: #a65d1a;
}

.template-proof-note div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}

.template-proof-note a {
  color: #7d263a;
  font-weight: 800;
  text-decoration: none;
}

.template-proof-note ul {
  margin: 0;
  padding-left: 18px;
}

.journal-structure-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 12px;
  font-family: "Aptos", "Segoe UI", "Microsoft YaHei", sans-serif;
}

.journal-structure-strip span {
  padding: 4px 7px;
  color: #334148;
  background: #eef4f4;
  border: 1px solid #d4e0e1;
  border-radius: 999px;
  font-size: calc(var(--font-size) - 2pt);
  font-weight: 850;
}

.paper-page.nature .paper-title {
  text-align: left;
  padding-bottom: 8px;
  border-bottom: 2px solid #111;
}

.paper-page.science .paper-title {
  text-align: left;
}

.paper-page.science .abstract-box {
  border-top: 3px solid #b21f2d;
  border-bottom: 1px solid #b21f2d;
}

.paper-page.cell .paper-title {
  color: #6f1f45;
}

.paper-page.cell .journal-structure-strip span {
  color: #6f1f45;
  background: #fff0f6;
  border-color: #e7bfd0;
}

.paper-page.ieee .authors::after {
  content: "Member, IEEE";
  display: block;
  margin-top: 3px;
  font-size: calc(var(--font-size) - 1.5pt);
  font-weight: 400;
}

.paper-page.acm .journal-structure-strip span {
  border-radius: 4px;
}

.paper-page.elsevier .paper-header {
  padding-bottom: 10px;
  border-bottom: 1px solid #d0d8da;
}

.paper-page.acs .abstract-box {
  border-left-color: #c43b2b;
}

.paper-page.mdpi .paper-title {
  color: #1e5b90;
}

.paper-page.frontiers .paper-title {
  color: #e36c0a;
}

.submission-manuscript {
  color: #161b1f;
  background: #fff;
}

.submission-topline {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 18px;
  padding: 0 0 8px;
  color: #35424a;
  border-bottom: 2px solid #16212a;
  font-family: "Aptos", "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: calc(var(--font-size) - 1pt);
  letter-spacing: 0;
  text-transform: uppercase;
}

.submission-topline b {
  color: #111;
  font-weight: 900;
  text-align: right;
}

.submission-header {
  margin-bottom: 16px;
}

.submission-header .paper-title {
  margin-bottom: 10px;
  line-height: 1.16;
}

.submission-required {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0 0 14px;
  font-family: "Aptos", "Segoe UI", "Microsoft YaHei", sans-serif;
}

.submission-required span {
  padding: 4px 7px;
  color: #27343a;
  background: #eef4f4;
  border: 1px solid #d2dedf;
  border-radius: 5px;
  font-size: calc(var(--font-size) - 1.8pt);
  font-weight: 850;
}

.submission-extra {
  margin: 0 0 14px;
  padding: 10px 12px;
  background: #f7f9f9;
  border: 1px solid #d8e1e2;
}

.submission-extra h2,
.submission-declarations h2 {
  margin: 0 0 6px;
  font-family: "Aptos", "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: calc(var(--font-size) + 1pt);
}

.submission-extra ul {
  margin: 0;
  padding-left: 18px;
}

.submission-extra p,
.submission-extra li {
  margin: 0 0 4px;
  text-indent: 0;
}

.submission-body.two-column {
  column-count: 2;
  column-gap: var(--column-gap);
}

.submission-body.single-column {
  column-count: 1;
}

.submission-body.compact p {
  margin-bottom: 5px;
}

.submission-declarations {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--rule);
}

.submission-declarations p {
  text-indent: 0;
}

.submission-nature .submission-topline {
  border-bottom-color: #111;
}

.submission-nature .paper-title {
  text-align: left;
  font-weight: 900;
}

.submission-science .submission-topline {
  border-bottom-color: #b21f2d;
}

.submission-science .submission-abstract {
  background: transparent;
  border-top: 2px solid #b21f2d;
  border-right: 0;
  border-bottom: 1px solid #b21f2d;
  border-left: 0;
}

.submission-pnas .submission-topline {
  border-bottom-color: #1b4f8f;
}

.submission-pnas .submission-required span {
  color: #173e70;
  background: #eef5fb;
  border-color: #cbddeb;
}

.submission-pnas .submission-abstract {
  background: #f8fafc;
  border-left-color: #1b4f8f;
}

.submission-cell .submission-topline {
  border-bottom-color: #6f1f45;
}

.submission-cell .paper-title,
.submission-cell .submission-extra h2 {
  color: #6f1f45;
}

.submission-ieee {
  font-family: "Times New Roman", Times, serif;
}

.submission-ieee .submission-topline {
  border-bottom-color: #0b4f9c;
  font-family: Arial, sans-serif;
}

.submission-ieee .paper-title,
.submission-acm .paper-title {
  text-align: center;
}

.submission-ieee .submission-abstract,
.submission-ieee .submission-keywords,
.submission-acm .submission-abstract,
.submission-acm .submission-keywords {
  column-span: all;
}

.submission-acm .submission-topline {
  border-bottom-color: #0076c0;
}

.submission-acm .submission-required span {
  border-radius: 2px;
}

.submission-elsevier .submission-topline {
  border-bottom-color: #f06c00;
}

.submission-elsevier .submission-extra {
  border-left: 4px solid #f06c00;
}

.submission-springer .submission-topline {
  border-bottom-color: #c4001a;
}

.submission-acs .submission-topline {
  border-bottom-color: #c43b2b;
}

.submission-acs .submission-abstract {
  border-left-color: #c43b2b;
}

.submission-rsc .submission-topline {
  border-bottom-color: #005a8b;
}

.submission-rsc .submission-required span {
  color: #004b72;
  background: #eef8fb;
  border-color: #c8e2ea;
}

.submission-rsc .submission-abstract {
  background: #f7fbfc;
  border-left-color: #005a8b;
}

.submission-rsc .paper-body h2 {
  color: #004b72;
}

.submission-mdpi .submission-topline {
  border-bottom-color: #1e5b90;
}

.submission-frontiers .submission-topline {
  border-bottom-color: #e36c0a;
}

.submission-taylor .submission-topline {
  border-bottom-color: #006f62;
}

.submission-sage .submission-topline {
  border-bottom-color: #7d263a;
}

.submission-apa {
  font-family: "Times New Roman", Times, serif;
}

.submission-apa .paper-title {
  text-align: center;
}

.paper-page.custom-extracted {
  color: #182025;
  background: #fff;
  border-top: 5px solid #0f777d;
}

.paper-page.custom-extracted .paper-title {
  padding-bottom: 8px;
  border-bottom: 1px solid #c8d9dc;
}

.paper-page.custom-extracted .abstract-box {
  background: #f4faf9;
  border-left-color: #0f777d;
}

.paper-page.custom-extracted .paper-body h2 {
  color: #0a5960;
}

.extracted-header,
.extracted-footer {
  display: flex;
  justify-content: space-between;
  gap: 10mm;
  color: #52646b;
  font-size: calc(var(--font-size) - 2pt);
  line-height: 1.25;
}

.extracted-header {
  margin: -4mm 0 7mm;
  padding-bottom: 2mm;
  border-bottom: 1px solid #d3dde0;
}

.extracted-footer {
  margin-top: 8mm;
  padding-top: 2mm;
  border-top: 1px solid #d3dde0;
}

.extracted-header span,
.extracted-footer span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.extracted-caption-guide {
  break-inside: avoid;
  margin: 12px 0;
  padding: 9px 11px;
  background: #f7fbfc;
  border-left: 3px solid #0f777d;
}

.extracted-caption-guide h2 {
  margin: 0 0 6px;
  color: #0a5960;
  font-family: var(--heading-font);
  font-size: calc(var(--font-size) + 1pt);
}

.extracted-caption-guide p,
.extracted-caption-guide li {
  margin: 0 0 4px;
  text-indent: 0;
}

.extracted-caption-guide ul {
  margin: 0;
  padding-left: 18px;
}

.paper-page.angewandte {
  --font-size: 9.6pt;
  --line-height: 1.18;
  --paragraph-indent: 0;
  width: min(100%, 190mm);
  padding: 0 14mm 16mm;
  color: #050505;
  background: #fff;
}

.angew-page-top {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  align-items: start;
  gap: 10mm;
  margin: 0 -14mm 7mm;
  padding: 4.8mm 14mm 3mm;
  background: #d6d6d6;
}

.angew-logo-mark {
  position: relative;
  width: fit-content;
  padding: 1mm 0 2mm;
  font-family: Arial, sans-serif;
  font-size: 16pt;
  letter-spacing: 0;
}

.angew-logo-mark::after {
  content: "";
  position: absolute;
  left: 0;
  right: -4mm;
  bottom: 0;
  height: 2mm;
  border-bottom: 1.2pt solid #111;
  border-radius: 50%;
}

.angew-article-type {
  justify-self: center;
  margin-top: 2mm;
  font-family: Arial, sans-serif;
  font-size: 15pt;
  font-style: italic;
  font-weight: 800;
}

.angew-journal-lockup {
  justify-self: end;
  text-align: right;
  font-family: Arial, sans-serif;
  line-height: 0.92;
}

.angew-journal-lockup strong {
  display: block;
  font-size: 14pt;
  font-style: italic;
  line-height: 0.95;
}

.angew-journal-lockup span,
.angew-journal-lockup small {
  display: block;
  margin-top: 1mm;
  font-size: 5.5pt;
}

.angew-topic {
  display: inline-block;
  margin-bottom: 4mm;
  padding: 1.6mm 2.6mm;
  color: #fff;
  background: #1f1f1f;
  font-family: Arial, sans-serif;
  font-size: 10.5pt;
  font-style: italic;
  font-weight: 900;
}

.paper-page.angewandte .paper-header {
  margin-bottom: 7mm;
}

.paper-page.angewandte .paper-title {
  margin: 0 0 4mm;
  font-size: 17pt;
  line-height: 1.08;
  text-align: left;
  border: 0;
}

.paper-page.angewandte .authors {
  max-width: 164mm;
  text-align: left;
  font-size: 12.5pt;
  font-style: italic;
  font-weight: 400;
  line-height: 1.42;
}

.angew-first-spread {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1fr);
  gap: 5.5mm;
  align-items: start;
}

.paper-page.angewandte .abstract-box {
  margin: 0;
  padding: 3mm;
  background: #fff;
  border: 1.2pt solid #111;
  border-radius: 4mm;
  font-size: 9.2pt;
  line-height: 1.18;
}

.paper-page.angewandte .abstract-box p {
  margin: 0;
  text-align: justify;
}

.paper-page.angewandte .label {
  font-weight: 900;
}

.paper-page.angewandte .paper-body {
  column-count: 1;
  margin-top: 0;
}

.paper-page.angewandte .paper-body h2 {
  margin: 0 0 4mm;
  font-family: Arial, sans-serif;
  font-size: 10.5pt;
  font-style: italic;
  font-weight: 900;
}

.paper-page.angewandte .paper-body p {
  margin: 0 0 2.6mm;
  text-align: justify;
  text-indent: 0;
}

.paper-page.angewandte .angew-rest {
  margin-top: 5mm;
  column-count: 2;
  column-gap: 5.5mm;
}

.paper-page.angewandte .references {
  font-size: 8pt;
  column-count: 2;
  column-gap: 5.5mm;
}

.abstract-box {
  margin: 16px 0 12px;
}

.abstract-box p,
.keywords p {
  margin: 0;
}

.abstract-box {
  padding: 11px 13px;
  background: rgba(232, 239, 239, 0.72);
  border-left: 4px solid var(--accent);
}

.abstract-plain .abstract-box {
  padding: 0;
  background: transparent;
  border-left: 0;
}

.abstract-rule .abstract-box {
  padding: 10px 0;
  background: transparent;
  border-top: 1px solid var(--rule);
  border-right: 0;
  border-bottom: 1px solid var(--rule);
  border-left: 0;
}

.label {
  font-weight: 800;
}

.paper-body {
  column-count: var(--columns);
  column-gap: var(--column-gap);
  margin-top: 12px;
}

.paper-body h2 {
  break-after: avoid;
  margin: 14px 0 6px;
  font-family: var(--heading-font);
  font-size: calc(var(--font-size) + 2pt);
  line-height: 1.25;
}

.paper-page[data-section-case="upper"] .paper-body h2 {
  text-align: center;
  text-transform: uppercase;
}

.paper-body p {
  margin: 0 0 8px;
  text-align: justify;
  text-indent: var(--paragraph-indent);
}

.references {
  margin-top: 16px;
  padding-top: 10px;
  border-top: 1px solid var(--rule);
  break-inside: avoid;
}

.references h2 {
  margin: 0 0 8px;
  font-family: var(--heading-font);
  font-size: calc(var(--font-size) + 2pt);
}

.references ol,
.references div {
  margin: 0;
  padding-left: 18px;
}

.references li,
.references p {
  margin: 0 0 6px;
}

.references-author-year div,
.references-apa div {
  padding-left: 0;
}

.custom-note {
  margin-top: 16px;
  padding: 10px 12px;
  color: #4c3c24;
  background: #fff5db;
  border: 1px solid #e6cc82;
  border-radius: 6px;
  font-family: "Aptos", "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 9pt;
}

.empty-state {
  display: grid;
  min-height: 210mm;
  align-content: center;
  gap: 10px;
  color: #56626a;
  text-align: center;
}

.empty-state h2 {
  max-width: 560px;
  margin: 0 auto;
  color: var(--ink);
  font-family: "Georgia", "SimSun", serif;
  font-size: 28px;
  line-height: 1.2;
}

.empty-state p {
  max-width: 610px;
  margin-inline: auto;
  line-height: 1.7;
}

.empty-kicker {
  margin-bottom: 0;
  color: var(--accent);
  font-weight: 900;
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .control-panel {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid rgba(31, 42, 51, 0.14);
  }

  .paper-page {
    padding: 15mm 10mm;
  }

  .proof-inspector {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1280px) {
  .app-shell {
    grid-template-columns: minmax(470px, 560px) 1fr;
  }

  .subject-links {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 660px) {
  .control-panel,
  .workspace {
    padding: 16px;
  }

  .brand-strip,
  .workspace-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .conversion-strip,
  .workflow-strip,
  .metric-row,
  .inspector-grid {
    grid-template-columns: 1fr;
  }

  .workflow-step {
    text-align: left;
  }

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

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

  .subject-label {
    place-items: start;
    text-align: left;
  }

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

  .paper-body {
    column-count: 1;
  }
}

/* Refined editorial workspace */
:root {
  --ink: #20272d;
  --muted: #66727a;
  --soft: #f1f3f3;
  --panel: #fbfbfa;
  --paper: #fff;
  --rule: #d9dedd;
  --accent: #176b68;
  --accent-strong: #105451;
  --wine: #8b3a4b;
  --gold: #9a712b;
  --shadow: 0 18px 48px rgba(32, 39, 45, 0.12);
}

body {
  background: #e9eceb;
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
}

.auth-gate {
  background: rgba(234, 237, 236, 0.96);
  backdrop-filter: blur(4px);
}

.auth-card {
  width: min(420px, 100%);
  padding: 30px;
  background: #fff;
  border-color: #d7dcda;
  border-radius: 6px;
  box-shadow: 0 24px 70px rgba(32, 39, 45, 0.14);
}

.auth-card-copy h2 {
  font-family: "Songti SC", "SimSun", Georgia, serif;
  font-size: 27px;
}

.auth-card-copy small {
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 0;
  font-weight: 600;
}

.auth-form-head {
  padding: 0 0 4px;
  background: transparent;
  border: 0;
}

.auth-view-switch {
  gap: 0;
  padding: 3px;
  background: #f0f2f1;
  border: 1px solid #dce0de;
  border-radius: 5px;
}

.auth-view-button {
  min-height: 40px;
  background: transparent;
  border: 0;
  border-radius: 3px;
}

.auth-view-button.active {
  color: var(--ink);
  background: #fff;
  box-shadow: 0 1px 4px rgba(32, 39, 45, 0.08);
}

.login-preferences {
  display: flex;
  gap: 22px;
  margin: 2px 0;
}

.check-option {
  display: inline-flex !important;
  grid-template-columns: none !important;
  align-items: center;
  gap: 8px !important;
  color: var(--muted) !important;
  font-size: 12px !important;
  font-weight: 600 !important;
}

.check-option input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--accent);
}

.app-shell {
  --control-width: 520px;
  grid-template-columns: 76px minmax(360px, var(--control-width)) 8px minmax(0, 1fr);
}

.control-panel {
  padding: 18px 20px 28px;
  background: #fbfbfa;
  border-right: 0;
  scrollbar-width: thin;
}

.pane-resizer {
  position: relative;
  z-index: 8;
  display: grid;
  height: 100vh;
  place-items: center;
  cursor: col-resize;
  background: #e4e8e6;
  border-inline: 1px solid #d8dddb;
  touch-action: none;
}

.pane-resizer span {
  width: 2px;
  height: 46px;
  background: #a9b2af;
  border-radius: 2px;
  transition: height 160ms ease, background 160ms ease;
}

.pane-resizer:hover span,
.pane-resizer:focus span {
  height: 70px;
  background: var(--accent);
}

body.resizing-panes {
  cursor: col-resize;
  user-select: none;
}

.brand-strip {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--rule);
}

.brand-strip h1 {
  font-family: "Songti SC", "SimSun", Georgia, serif;
  font-size: 23px;
  font-weight: 700;
}

.account-actions {
  flex: 0 0 auto;
  justify-content: flex-end;
}

.account-pill,
.status-pill {
  color: #3d4a4e;
  background: #eef1f0;
  border-color: #d9dfdd;
  border-radius: 4px;
  font-weight: 700;
}

.metric-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 12px;
  border-bottom: 1px solid var(--rule);
}

.metric-row span {
  padding: 7px 0 10px;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.metric-row b {
  font-size: 14px;
}

.conversion-strip,
.workflow-strip {
  display: none;
}

.work-tabs {
  position: sticky;
  top: 0;
  z-index: 12;
  display: flex;
  height: 100vh;
  padding: 14px 8px;
  flex-direction: column;
  gap: 4px;
  background: #20292c;
  border-right: 1px solid #141b1d;
}

.work-tab {
  display: grid;
  min-height: 58px;
  place-items: center;
  gap: 2px;
  padding: 8px 4px;
  color: #b9c2c1;
  background: transparent;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
}

.work-tab span {
  margin: 0;
  color: #7f918f;
  font-size: 10px;
}

.work-tab:hover,
.work-tab.active {
  color: #fff;
  background: #314044;
}

.work-tab.active span {
  color: #82c3bd;
}

.nav-mark {
  display: grid;
  width: 42px;
  height: 42px;
  margin: 2px auto 18px;
  place-items: center;
  color: #fff;
  border: 1px solid #506164;
  border-radius: 4px;
  font-family: Georgia, serif;
  font-size: 15px;
  font-weight: 700;
}

.work-panel {
  margin-top: 0;
  padding-top: 20px;
  border-top: 0;
  animation: panel-in 180ms ease both;
}

@keyframes panel-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-title {
  margin-bottom: 14px;
}

.privacy-status {
  display: inline-flex;
  min-height: 28px;
  margin-left: auto;
  padding: 0 8px;
  align-items: center;
  gap: 6px;
  color: #285d59;
  background: #e9f2f0;
  border: 1px solid #c9ddda;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 750;
}

.privacy-status span {
  width: 7px;
  height: 7px;
  background: #2b8a72;
  border-radius: 50%;
}

.local-processing-note {
  display: flex;
  margin-bottom: 12px;
  padding: 9px 10px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #40504f;
  background: #f1f5f4;
  border-left: 3px solid #3c8178;
  font-size: 12px;
}

.local-processing-note button {
  color: var(--accent-strong);
  background: transparent;
  font-size: 11px;
  font-weight: 750;
}

.section-title span {
  color: #939c9f;
}

.section-title h2 {
  font-family: "Songti SC", "SimSun", Georgia, serif;
  font-size: 18px;
  font-weight: 700;
}

.upload-zone {
  min-height: 92px;
  background: #fff;
  border: 1px dashed #aeb8b5;
  border-radius: 5px;
}

.upload-icon {
  width: 30px;
  height: 30px;
  color: var(--accent);
  background: #e9f1f0;
  border-radius: 4px;
  font-size: 18px;
}

textarea,
input,
select {
  background: #fff;
  border-color: #cfd6d3;
  border-radius: 4px;
}

textarea:focus,
input:focus,
select:focus {
  box-shadow: 0 0 0 2px rgba(23, 107, 104, 0.12);
}

.primary-btn,
.ghost-btn {
  border-radius: 4px;
  font-weight: 750;
}

.template-mode-tabs {
  background: #eef1f0;
  border-color: #d8dddb;
  border-radius: 5px;
}

.mode-tab,
.mode-tab:hover,
.mode-tab.active {
  border-radius: 3px;
}

.subject-board,
.journal-picker,
.custom-template-box,
.overview-prompt {
  background: #fff;
  border-color: var(--rule);
  border-radius: 4px;
}

.subject-label {
  color: #455354;
  background: #f0f3f2;
}

.subject-link:hover:not(:disabled),
.subject-link.active {
  background: #e9f1f0;
}

.overview-prompt p,
.accuracy-note {
  display: none;
}

.overview-prompt {
  padding: 12px;
}

.overview-prompt strong {
  margin: 0;
  color: var(--ink);
}

.workspace {
  padding: 18px clamp(18px, 2.5vw, 36px);
  background: #ecefee;
}

.workspace-toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  margin: -18px calc(clamp(18px, 2.5vw, 36px) * -1) 14px;
  padding: 15px clamp(18px, 2.5vw, 36px);
  background: rgba(236, 239, 238, 0.94);
  border-bottom: 1px solid #d6dcda;
  backdrop-filter: blur(10px);
}

.workspace-toolbar h2 {
  font-family: "Songti SC", "SimSun", Georgia, serif;
  font-size: 23px;
}

.template-rules {
  margin-top: 5px;
  font-size: 12px;
  font-weight: 600;
}

.export-select,
.tool-btn {
  background: #fff;
  border-color: #cfd6d3;
  border-radius: 4px;
}

.proof-inspector {
  grid-template-columns: minmax(160px, 0.65fr) minmax(280px, 1.35fr);
  margin-bottom: 12px;
}

.inspector-score,
.inspector-grid {
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.76);
  border-color: #d7dddb;
  border-radius: 4px;
}

.inspector-score span {
  border-radius: 3px;
}

.inspector-grid span {
  background: #f3f5f4;
  border-color: #e0e4e2;
  border-radius: 3px;
}

.proof-stage {
  min-height: calc(100vh - 160px);
  padding: clamp(18px, 3vw, 42px);
  background: #e5e8e7;
  border: 0;
  border-radius: 0;
}

.paper-page {
  box-shadow: 0 12px 38px rgba(30, 38, 42, 0.14);
}

.rich-import-content {
  overflow-wrap: anywhere;
}

.rich-import-content img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 12px auto 5px;
  object-fit: contain;
  break-inside: avoid;
}

.rich-import-content figure,
.rich-import-content table,
.rich-import-content math,
.rich-import-content .imported-equation {
  break-inside: avoid;
}

.rich-import-content figure {
  margin: 14px 0;
}

.rich-import-content figcaption {
  margin-top: 5px;
  font-size: 0.9em;
  line-height: 1.35;
  text-align: center;
}

.rich-import-content table {
  width: 100%;
  margin: 12px 0;
  border-collapse: collapse;
  font-size: 0.92em;
}

.rich-import-content th,
.rich-import-content td {
  padding: 5px 7px;
  border: 1px solid #777;
  vertical-align: top;
}

.rich-import-content sup,
.rich-import-content sub {
  font-size: 0.72em;
  line-height: 0;
}

.rich-import-content math,
.rich-import-content .imported-equation {
  display: block;
  max-width: 100%;
  margin: 10px auto;
  overflow-x: auto;
  text-align: center;
}

.rich-import-content p {
  min-height: 1em;
}

.custom-privacy-line {
  grid-column: 1 / -1;
  color: #3f6460;
  font-size: 11px;
  font-weight: 700;
}

.privacy-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  padding: 20px;
  place-items: center;
  background: rgba(24, 31, 33, 0.48);
  backdrop-filter: blur(5px);
}

.privacy-card {
  width: min(520px, 100%);
  padding: 22px;
  background: #fff;
  border: 1px solid #d5dcda;
  border-radius: 6px;
  box-shadow: 0 26px 80px rgba(20, 28, 30, 0.24);
}

.privacy-facts {
  display: grid;
  margin: 16px 0 18px;
  border-top: 1px solid var(--rule);
}

.privacy-facts p {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 14px;
  margin: 0;
  padding: 12px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 13px;
  line-height: 1.5;
}

.privacy-facts span {
  color: var(--muted);
}

.privacy-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

@media (max-width: 1280px) {
  .app-shell {
    grid-template-columns: 70px minmax(400px, var(--control-width)) 8px minmax(0, 1fr);
  }

  .subject-links {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 1100px) {
  .app-shell {
    display: grid;
    grid-template-columns: 1fr;
  }

  .work-tabs {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    width: 100%;
    height: auto;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    padding: 5px 8px;
    flex-direction: row;
    border-right: 0;
    border-bottom: 1px solid #141b1d;
  }

  .nav-mark {
    display: none;
  }

  .work-tab {
    min-height: 42px;
    grid-template-columns: auto auto;
    place-content: center;
    gap: 5px;
  }

  .control-panel {
    position: static;
    height: auto;
    max-height: none;
    border-bottom: 1px solid var(--rule);
  }

  .pane-resizer {
    display: none;
  }

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

@media (max-width: 660px) {
  .auth-gate {
    align-items: start;
    padding: 12px;
    overflow: auto;
  }

  .auth-card {
    margin-top: 3vh;
    padding: 22px 18px;
  }

  .control-panel,
  .workspace {
    padding: 12px;
  }

  .brand-strip {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
  }

  .brand-strip > div:first-child {
    min-width: 0;
  }

  .brand-strip h1 {
    font-size: 20px;
  }

  .account-actions {
    grid-column: 1 / -1;
    width: 100%;
    overflow-x: auto;
    justify-content: flex-start;
  }

  .metric-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .metric-row span {
    font-size: 10px;
  }

  .metric-row b {
    font-size: 12px;
  }

  .work-tabs {
    padding-inline: 6px;
  }

  .work-tab {
    min-height: 40px;
    padding-inline: 3px;
    font-size: 12px;
  }

  .work-tab span {
    display: none;
  }

  .field-grid,
  .journal-picker,
  .custom-template-box,
  .school-filter-panel {
    grid-template-columns: 1fr;
  }

  .custom-description-field {
    grid-column: auto;
  }

  .custom-privacy-line {
    grid-column: auto;
  }

  .privacy-facts p {
    grid-template-columns: 1fr;
    gap: 4px;
  }

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

  .workspace-toolbar {
    position: sticky;
    margin: -12px -12px 10px;
    padding: 12px;
    align-items: stretch;
    flex-direction: column;
  }

  .workspace-toolbar h2 {
    font-size: 20px;
  }

  .toolbar-actions {
    width: 100%;
  }

  .export-select {
    flex: 1;
    width: auto;
  }

  .proof-inspector {
    grid-template-columns: 1fr;
  }

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

  .proof-stage {
    min-height: 70vh;
    margin-inline: -12px;
    padding: 12px;
    overflow-x: auto;
  }

  .paper-page {
    width: min(var(--page-width), calc(100vw - 24px));
    min-width: 0;
    min-height: 210mm;
    padding: 12mm 8mm;
    font-size: min(var(--font-size), 10pt);
  }
}

/* University library workspace */
:root {
  --ink: #18242f;
  --muted: #66727c;
  --soft: #f2f1ed;
  --panel: #fbfaf7;
  --paper: #fffefb;
  --rule: #d8d5cc;
  --accent: #173b5c;
  --accent-strong: #102f4b;
  --wine: #8d3341;
  --gold: #a0772d;
  --shadow: 0 22px 56px rgba(29, 39, 48, 0.14);
}

html,
body {
  min-width: 0;
  min-height: 100%;
  overflow-x: hidden;
}

body {
  background: #e9e7e1;
  font-family: "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}

.app-shell {
  min-height: 100dvh;
  grid-template-columns: 78px minmax(380px, var(--control-width)) 8px minmax(0, 1fr);
}

.work-tabs {
  height: 100dvh;
  padding: 18px 9px max(14px, env(safe-area-inset-bottom));
  background: #142f49;
  border-right-color: #0d2438;
}

.nav-mark {
  width: 44px;
  height: 44px;
  margin-bottom: 22px;
  border-color: rgba(255, 255, 255, 0.36);
  font-family: "Palatino Linotype", "Songti SC", serif;
}

.work-tab {
  min-height: 62px;
  color: #c5d0d9;
  border-left: 2px solid transparent;
  border-radius: 2px;
}

.work-tab:hover,
.work-tab.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border-left-color: #c89a4b;
}

.work-tab.active span {
  color: #e2bd78;
}

.preview-tab {
  display: none;
}

.nav-spacer {
  flex: 1;
}

.nav-account {
  display: grid;
  gap: 5px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
}

.nav-account button {
  min-height: 38px;
  color: #bfcbd4;
  background: transparent;
  border-radius: 2px;
  font-size: 11px;
  font-weight: 700;
}

.nav-account button:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.control-panel {
  height: 100dvh;
  padding: 20px 22px 32px;
  background: var(--panel);
  box-shadow: 5px 0 20px rgba(24, 36, 47, 0.035);
}

.brand-strip {
  align-items: center;
  border-bottom: 2px solid #203e58;
}

.brand-strip h1,
.section-title h2,
.workspace-toolbar h2,
.auth-card-copy h2 {
  color: #172b3e;
  font-family: "Songti SC", "STSong", "SimSun", Georgia, serif;
  font-weight: 700;
}

.brand-strip h1 {
  font-size: 24px;
}

.account-actions {
  display: none;
}

.status-pill {
  color: #6e2935;
  background: #f7ecec;
  border-color: #dec3c6;
}

.metric-row {
  border-bottom-color: #cbc7bd;
}

.metric-row span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.section-title > span,
.section-title > div > span {
  color: var(--wine);
  font-family: Georgia, serif;
  font-weight: 700;
}

.primary-btn {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.primary-btn:hover {
  background: var(--accent-strong);
}

.ghost-btn {
  color: var(--accent);
  background: #fff;
  border-color: #c9ced0;
}

.privacy-status {
  color: #285c4d;
  background: #edf5ef;
  border-color: #cbded1;
}

.privacy-status span {
  background: #397b61;
}

.local-processing-note {
  color: #324e44;
  background: #eef4ef;
  border-left-color: #397b61;
}

.upload-zone {
  min-height: 104px;
  background: #fffefb;
  border-color: #9ea9ae;
}

.upload-icon {
  color: #fff;
  background: var(--accent);
}

.local-draft-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
}

.local-draft-actions button {
  min-height: 32px;
  padding: 0 9px;
  color: #56636b;
  background: transparent;
  border: 1px solid #d4d4ce;
  border-radius: 3px;
  font-size: 11px;
}

#localDraftStatus {
  margin-left: auto;
  align-self: center;
  color: var(--muted);
  font-size: 11px;
}

.template-mode-tabs {
  background: #eae9e4;
  border-color: #d1cec5;
}

.mode-tab.active {
  color: #fff;
  background: var(--accent);
}

.template-search {
  position: sticky;
  top: -1px;
  z-index: 8;
  padding: 10px 0 8px;
  background: var(--panel);
}

.template-search input {
  height: 44px;
  border-color: #aeb6ba;
}

.mobile-filter-toggle {
  display: none;
}

.subject-board,
.journal-picker,
.custom-template-box,
.overview-prompt {
  border-color: #d6d2c8;
}

.subject-label {
  color: #273f54;
  background: #efeee9;
}

.subject-link:hover:not(:disabled),
.subject-link.active {
  color: #102f4b;
  background: #e5ecf1;
}

.overview-prompt {
  margin-bottom: 10px;
  border-left: 3px solid var(--wine);
}

.overview-prompt p,
.accuracy-note {
  display: block;
}

.overview-counts {
  display: none;
}

.accuracy-note {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.accuracy-note b {
  margin-right: 8px;
  color: var(--wine);
}

.template-list {
  border-top: 1px solid #cfcac0;
}

.template-category {
  position: sticky;
  top: 72px;
  z-index: 5;
  display: flex;
  min-height: 34px;
  padding: 8px 10px;
  align-items: center;
  justify-content: space-between;
  color: #233d54;
  background: #efeee9;
  border-bottom: 1px solid #d8d5cc;
  font-family: "Songti SC", "SimSun", serif;
  font-weight: 700;
}

.template-row {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 68px;
  grid-template-columns: 30px minmax(0, 1.5fr) auto minmax(90px, 0.65fr) auto;
  grid-template-areas:
    "initial name trust meta update"
    "initial desc desc desc delete";
  column-gap: 10px;
  row-gap: 4px;
  padding: 11px 10px;
  align-items: center;
  color: var(--ink);
  background: transparent;
  border-bottom: 1px solid #e2dfd7;
  border-left: 3px solid transparent;
  text-align: left;
}

.template-row:hover {
  background: #f4f2ed;
}

.template-row.active {
  background: #e8eef2;
  border-left-color: var(--wine);
}

.journal-initial {
  grid-area: initial;
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  color: #fff;
  background: #294b67;
  border-radius: 2px;
  font-family: Georgia, serif;
  font-size: 12px;
  font-weight: 700;
}

.journal-name {
  grid-area: name;
  min-width: 0;
  overflow: hidden;
  color: #172b3e;
  font-family: "Palatino Linotype", "Songti SC", serif;
  font-size: 14px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.journal-meta {
  grid-area: meta;
  min-width: 0;
  overflow: hidden;
  color: #66727c;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.journal-update {
  grid-area: update;
  color: #7b7469;
  font-size: 10px;
  white-space: nowrap;
}

.journal-desc {
  grid-area: desc;
  min-width: 0;
  overflow: hidden;
  color: #737b80;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-delete {
  grid-area: delete;
  color: var(--wine);
  font-size: 11px;
}

.template-trust-badge {
  grid-area: trust;
  display: inline-flex;
  min-height: 23px;
  padding: 0 7px;
  align-items: center;
  border: 1px solid;
  border-radius: 2px;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.template-trust-badge.official {
  color: #7a2b36;
  background: #f7e9ea;
  border-color: #dfbdc2;
}

.template-trust-badge.verified {
  color: #265a49;
  background: #e9f3ed;
  border-color: #bdd5c7;
}

.template-trust-badge.adapted {
  color: #70561d;
  background: #f7f0dd;
  border-color: #dfcf9f;
}

.workspace {
  min-width: 0;
  padding: 20px clamp(20px, 2.6vw, 42px);
  background: #e6e4de;
}

.workspace-toolbar {
  margin: -20px calc(clamp(20px, 2.6vw, 42px) * -1) 12px;
  padding: 15px clamp(20px, 2.6vw, 42px);
  background: rgba(246, 245, 241, 0.96);
  border-bottom-color: #cbc7bd;
}

.workspace-toolbar h2 {
  max-width: min(54vw, 760px);
  overflow: hidden;
  font-size: 22px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-source-line {
  display: flex;
  margin: 5px 0 0;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
}

.template-source-line span {
  padding: 3px 6px;
  color: #6e2935;
  background: #f7ecec;
  border: 1px solid #dec3c6;
  border-radius: 2px;
  font-weight: 800;
}

.template-source-line a {
  color: var(--accent);
}

.export-select,
.tool-btn,
.report-btn,
.preview-scale-btn {
  min-height: 42px;
  color: #20384d;
  background: #fff;
  border: 1px solid #c9c7c0;
  border-radius: 3px;
}

.report-btn,
.preview-scale-btn {
  padding: 0 12px;
  font-size: 12px;
  font-weight: 700;
}

.preview-scale-btn {
  display: none;
}

.proof-inspector {
  display: block;
  margin-bottom: 10px;
  border: 1px solid #d0cdc4;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.72);
}

.inspector-score {
  display: flex;
  min-height: 48px;
  padding: 8px 10px;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: 0;
}

.inspector-score b {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inspector-toggle {
  min-height: 32px;
  padding: 0 8px;
  color: var(--accent);
  background: transparent;
  font-size: 11px;
  font-weight: 700;
}

.inspector-grid {
  margin: 0 10px 10px;
  padding: 0;
  background: transparent;
  border: 0;
}

.proof-inspector.is-compact .inspector-grid {
  display: none;
}

.proof-stage {
  min-width: 0;
  min-height: calc(100dvh - 144px);
  background:
    linear-gradient(rgba(35, 61, 82, 0.025) 1px, transparent 1px),
    #dcdad4;
  background-size: 100% 32px;
}

.paper-page {
  background: var(--paper);
  box-shadow: 0 18px 45px rgba(28, 39, 48, 0.15);
}

.admin-panel,
.profile-panel {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 45;
  width: min(620px, calc(100vw - 24px));
  height: 100dvh;
  margin: 0;
  padding: 24px;
  overflow-y: auto;
  background: #fbfaf7;
  border: 0;
  border-left: 1px solid #cfcac0;
  border-radius: 0;
  box-shadow: -22px 0 64px rgba(20, 34, 47, 0.2);
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 44;
  width: 100%;
  height: 100%;
  background: rgba(18, 32, 44, 0.32);
  border: 0;
  backdrop-filter: blur(2px);
}

body.drawer-open {
  overflow: hidden;
}

.profile-panel {
  width: min(420px, calc(100vw - 24px));
}

.admin-panel-header {
  position: sticky;
  top: -24px;
  z-index: 4;
  padding: 10px 0;
  background: #fbfaf7;
  border-bottom: 1px solid var(--rule);
}

.template-confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  padding: 18px;
  place-items: center;
  background: rgba(17, 35, 51, 0.62);
  backdrop-filter: blur(5px);
}

.template-confirm-card {
  width: min(500px, 100%);
  max-height: calc(100dvh - 36px);
  padding: 28px;
  overflow-y: auto;
  color: var(--ink);
  background: #fffefb;
  border-top: 4px solid var(--wine);
  box-shadow: 0 30px 90px rgba(10, 24, 36, 0.32);
}

.confirmation-mark {
  display: grid;
  width: 42px;
  height: 42px;
  margin-bottom: 16px;
  place-items: center;
  color: #fff;
  background: var(--wine);
  font-family: "Songti SC", "SimSun", serif;
  font-size: 20px;
}

.template-confirm-card h2 {
  margin-bottom: 10px;
  font-family: "Songti SC", "SimSun", serif;
}

.template-confirm-card > p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.7;
}

.template-confirm-facts {
  display: grid;
  margin: 18px 0;
  border-top: 1px solid var(--rule);
}

.template-confirm-facts span {
  padding: 10px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 13px;
}

.confirm-choice {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 12px;
}

.confirmation-actions {
  display: flex;
  margin-top: 20px;
  justify-content: flex-end;
  gap: 10px;
}

@media (min-width: 769px) and (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 66px minmax(340px, 43vw) 6px minmax(0, 1fr);
  }

  .work-tabs {
    position: sticky;
    top: 0;
    display: flex;
    width: auto;
    height: 100dvh;
    padding: 14px 7px;
    flex-direction: column;
    border-right: 1px solid #0d2438;
    border-bottom: 0;
  }

  .nav-mark {
    display: grid;
  }

  .work-tab {
    min-height: 56px;
    grid-template-columns: 1fr;
  }

  .control-panel {
    position: sticky;
    height: 100dvh;
    overflow-y: auto;
    border-bottom: 0;
  }

  .pane-resizer {
    display: grid;
  }

  .workspace {
    min-height: 100dvh;
    padding-inline: 14px;
  }
}

@media (max-width: 768px) {
  body {
    padding-bottom: calc(64px + env(safe-area-inset-bottom));
    background: var(--panel);
  }

  .app-shell {
    display: block;
    min-height: 100dvh;
  }

  .work-tabs {
    position: fixed;
    inset: auto 0 0;
    z-index: 40;
    display: grid;
    width: 100%;
    height: calc(62px + env(safe-area-inset-bottom));
    grid-template-columns: repeat(5, minmax(0, 1fr));
    padding: 4px 4px env(safe-area-inset-bottom);
    background: #142f49;
    border: 0;
    box-shadow: 0 -8px 28px rgba(14, 31, 47, 0.18);
  }

  .nav-mark,
  .nav-spacer,
  .nav-account {
    display: none;
  }

  .preview-tab {
    display: grid;
  }

  .work-tab {
    min-width: 0;
    min-height: 54px;
    grid-template-columns: 1fr;
    place-content: center;
    padding: 5px 2px;
    border-left: 0;
    border-top: 2px solid transparent;
    font-size: 11px;
  }

  .work-tab span {
    display: block;
    font-size: 9px;
  }

  .work-tab.active {
    border-top-color: #e2bd78;
    border-left: 0;
  }

  .control-panel {
    position: static;
    display: block;
    width: 100%;
    height: auto;
    min-height: calc(100dvh - 64px);
    padding: 14px 14px 26px;
    overflow: visible;
    border: 0;
    box-shadow: none;
  }

  body.mobile-preview-active .control-panel,
  body:not(.mobile-preview-active) .workspace {
    display: none;
  }

  body.mobile-preview-active .workspace {
    display: block;
  }

  .pane-resizer {
    display: none;
  }

  .brand-strip {
    grid-template-columns: minmax(0, 1fr) auto;
    padding-bottom: 12px;
  }

  .account-actions {
    display: flex;
    grid-column: 1 / -1;
    width: 100%;
    gap: 6px;
    overflow-x: auto;
  }

  .account-actions .account-pill {
    flex: 1;
    max-width: none;
  }

  .brand-strip h1 {
    font-size: 21px;
  }

  .metric-row {
    margin-top: 8px;
  }

  .metric-row span {
    padding-block: 8px;
  }

  .work-panel {
    padding-top: 16px;
  }

  input,
  textarea,
  select {
    min-height: 44px;
    font-size: 16px;
  }

  textarea {
    min-height: 112px;
  }

  button,
  .mode-tab,
  .subject-link {
    min-height: 44px;
  }

  .field-grid,
  .field-grid.compact,
  .journal-picker,
  .custom-template-box,
  .school-filter-panel {
    grid-template-columns: 1fr;
  }

  .inline-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .template-search {
    top: 0;
    padding-top: 8px;
  }

  .mobile-filter-toggle {
    display: flex;
    width: 100%;
    margin-bottom: 8px;
    padding: 0 12px;
    align-items: center;
    justify-content: space-between;
    color: var(--accent);
    background: #eeece6;
    border: 1px solid #d4d0c6;
    border-radius: 3px;
    font-weight: 700;
  }

  .mobile-filter-toggle::after {
    content: "+";
    font-size: 18px;
  }

  .mobile-filter-toggle[aria-expanded="true"]::after {
    content: "−";
  }

  .template-filters {
    display: none;
  }

  .template-filters.is-open {
    display: block;
  }

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

  .subject-label {
    place-items: start;
    padding: 8px 10px;
  }

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

  .overview-prompt {
    padding: 10px;
  }

  .template-category {
    top: 71px;
  }

  .template-row {
    min-height: 82px;
    grid-template-columns: 28px minmax(0, 1fr) auto;
    grid-template-areas:
      "initial name trust"
      "initial meta update"
      "initial desc delete";
    column-gap: 8px;
    padding: 10px 8px;
  }

  .journal-name {
    font-size: 13px;
  }

  .journal-desc,
  .journal-meta {
    max-width: 100%;
  }

  .workspace {
    min-height: calc(100dvh - 64px);
    padding: 0;
    background: #dcdad4;
  }

  .workspace-toolbar {
    position: fixed;
    inset: auto 0 calc(62px + env(safe-area-inset-bottom));
    z-index: 32;
    display: block;
    margin: 0;
    padding: 8px 10px;
    background: rgba(250, 249, 246, 0.98);
    border-top: 1px solid #c9c5ba;
    border-bottom: 0;
    box-shadow: 0 -8px 22px rgba(28, 39, 48, 0.12);
  }

  .workspace-toolbar > div:first-child {
    display: none;
  }

  .toolbar-actions {
    display: grid;
    width: 100%;
    grid-template-columns: auto minmax(118px, 1fr) auto 44px 44px;
    gap: 6px;
  }

  .preview-scale-btn {
    display: inline-flex;
    padding: 0 8px;
    align-items: center;
    justify-content: center;
  }

  .report-btn {
    padding-inline: 8px;
  }

  .proof-inspector {
    position: sticky;
    top: 0;
    z-index: 12;
    margin: 0;
    border-width: 0 0 1px;
  }

  .inspector-score {
    min-height: 50px;
  }

  .inspector-score b {
    font-size: 12px;
  }

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

  .proof-stage {
    min-height: calc(100dvh - 64px);
    padding: 12px 10px 88px;
    overflow: hidden auto;
  }

  .proof-stage .paper-page {
    width: calc(100vw - 20px);
    max-width: none;
    min-width: 0;
    min-height: 140vw;
    padding: clamp(18px, 5vw, 34px);
    font-size: clamp(9px, 2.7vw, 11px);
    transform: none;
    transform-origin: top left;
  }

  .proof-stage.preview-original {
    overflow: auto;
  }

  .proof-stage.preview-original .paper-page {
    width: var(--page-width);
    min-width: var(--page-width);
    min-height: 260mm;
    padding: var(--margin-y) var(--margin-x);
    font-size: var(--font-size);
  }

  .paper-body {
    column-count: 1 !important;
  }

  .rich-import-content img,
  .rich-import-content table,
  .rich-import-content math,
  .rich-import-content .imported-equation {
    max-width: 100%;
    overflow-x: auto;
  }

  .admin-panel,
  .profile-panel {
    width: 100%;
    max-width: none;
    height: calc(100dvh - 62px - env(safe-area-inset-bottom));
    padding: 16px;
    border-left: 0;
  }

  .admin-panel-header {
    top: -16px;
  }

  .template-confirm-modal,
  .privacy-modal,
  .announcement-modal,
  .payment-modal,
  .template-request-modal {
    align-items: end;
    padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
  }

  .template-confirm-card,
  .privacy-card,
  .announcement-card,
  .payment-card,
  .template-request-card {
    width: 100%;
    max-height: calc(100dvh - 20px);
    padding: 20px 16px;
    border-radius: 4px 4px 0 0;
  }

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

  .confirmation-actions,
  .privacy-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 390px) {
  .toolbar-actions {
    grid-template-columns: auto minmax(90px, 1fr) 44px 44px;
  }

  .toolbar-actions .report-btn {
    display: none;
  }

  .status-pill {
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .metric-row span:last-child {
    display: none;
  }

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

@media (orientation: landscape) and (min-width: 700px) and (max-width: 1000px) {
  body {
    padding-bottom: 0;
  }

  .app-shell {
    display: grid;
    grid-template-columns: 60px minmax(330px, 43vw) 1fr;
  }

  .work-tabs {
    position: sticky;
    inset: 0 auto auto 0;
    width: 60px;
    height: 100dvh;
    grid-template-columns: 1fr;
    padding: 5px;
  }

  .control-panel,
  body.mobile-preview-active .control-panel {
    display: block;
    height: 100dvh;
    overflow-y: auto;
  }

  .workspace,
  body:not(.mobile-preview-active) .workspace {
    display: block;
    min-width: 0;
  }

  .preview-tab {
    display: none;
  }

  .workspace-toolbar {
    position: sticky;
    inset: 0 auto auto;
  }
}

@media print {
  body {
    background: white;
  }

  .control-panel,
  .work-tabs,
  .pane-resizer,
  .workspace-toolbar {
    display: none;
  }

  .app-shell,
  .workspace,
  .proof-stage {
    display: block;
    padding: 0;
    min-height: auto;
    border: 0;
    background: white;
  }

  .paper-page {
    width: auto;
    min-height: auto;
    padding: 0;
    box-shadow: none;
  }
}
