:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #5b6673;
  --line: #d8dde4;
  --paper: #f7f8fa;
  --panel: #ffffff;
  --accent: #0c7a75;
  --accent-strong: #075b57;
  --warn: #a34810;
  --shadow: 0 14px 36px rgba(28, 39, 49, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

a {
  color: inherit;
}

.shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px clamp(18px, 4vw, 56px);
  background: rgba(247, 248, 250, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-decoration: none;
}

.mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
  font-weight: 900;
}

.nav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.account-nav {
  position: relative;
  display: flex;
  justify-content: flex-end;
}

.account-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--panel);
  font: inherit;
  font-weight: 750;
  cursor: pointer;
  list-style: none;
}

.account-button::-webkit-details-marker {
  display: none;
}

.account-button b {
  min-width: 34px;
  min-height: 26px;
  display: inline-grid;
  place-items: center;
  padding: 0 8px;
  border-radius: 999px;
  color: #fff;
  background: var(--accent);
  font-size: 13px;
}

.account-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 20;
  width: 220px;
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.account-nav[open] .account-menu {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.account-nav:not([open]) .account-menu {
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
  animation: none !important;
}

.account-menu-profile {
  display: grid;
  gap: 2px;
  padding: 10px;
  border-radius: 8px;
  background: #eef9f7;
}

.account-menu-profile span {
  color: var(--muted);
  font-size: 12px;
}

.account-menu a {
  padding: 9px 10px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 650;
}

.account-menu a:hover {
  background: #f1f4f6;
}

.nav a,
.button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  text-decoration: none;
  font-weight: 650;
  cursor: pointer;
}

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

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

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: clamp(28px, 5vw, 70px);
  align-items: center;
  padding: clamp(56px, 9vw, 112px) clamp(18px, 4vw, 56px) 44px;
  background:
    linear-gradient(135deg, rgba(12, 122, 117, 0.12), rgba(247, 248, 250, 0) 42%),
    radial-gradient(circle at 80% 30%, rgba(232, 184, 77, 0.24), rgba(247, 248, 250, 0) 34%);
}

.hero h1 {
  margin: 0;
  max-width: 760px;
  font-size: clamp(38px, 7vw, 86px);
  line-height: 0.95;
  letter-spacing: 0;
}

.hero p {
  max-width: 680px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.75;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.status-panel {
  display: grid;
  gap: 14px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
}

.metric {
  display: grid;
  grid-template-columns: 118px 1fr;
  gap: 10px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  font-size: 16px;
}

.section {
  padding: 34px clamp(18px, 4vw, 56px) 60px;
}

.section h2 {
  margin: 0 0 18px;
  font-size: 26px;
}

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

.card {
  min-height: 160px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 7px 18px rgba(28, 39, 49, 0.06);
}

.card h3 {
  margin: 0;
  font-size: 19px;
}

.card p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.card a {
  align-self: flex-start;
}

.login-wrap {
  min-height: calc(100vh - 75px);
  display: grid;
  place-items: center;
  padding: 34px 18px;
}

.login-panel {
  width: min(440px, 100%);
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.secure-login-panel {
  width: min(500px, 100%);
}

.login-panel h1 {
  margin: 0 0 8px;
  font-size: 30px;
}

.login-panel p {
  margin: 0 0 24px;
  color: var(--muted);
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 16px;
}

.field label {
  font-weight: 700;
}

.field input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}

.password-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 74px;
  gap: 10px;
}

.password-toggle {
  min-height: 44px;
  padding: 0 10px;
}

.alert {
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid #e6c1aa;
  border-radius: 8px;
  color: var(--warn);
  background: #fff4ed;
}

.captcha-row {
  display: grid;
  grid-template-columns: 170px minmax(110px, 1fr) 74px;
  gap: 10px;
  align-items: center;
}

.captcha-row img {
  width: 170px;
  height: 56px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef9f7;
  object-fit: cover;
}

.captcha-row input {
  min-height: 56px;
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 2px;
  text-align: center;
}

.captcha-refresh {
  min-height: 56px;
  padding: 0 10px;
}

.human-check {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 4px 0 16px;
  color: var(--muted);
  font-weight: 650;
}

.human-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.password-rule {
  margin: -4px 0 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.footer {
  margin-top: auto;
  padding: 24px clamp(18px, 4vw, 56px);
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 18px;
}

.panel {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 7px 18px rgba(28, 39, 49, 0.06);
}

.panel h3 {
  margin: 0 0 14px;
  font-size: 19px;
}

.toolbar,
.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.toolbar input,
.toolbar select,
.form-grid input,
.form-grid select,
.form-grid textarea {
  min-height: 42px;
  width: 100%;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font: inherit;
}

.form-grid textarea {
  grid-column: 1 / -1;
  min-height: 110px;
  padding: 12px;
  resize: vertical;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.data-table th,
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.data-table th {
  color: var(--muted);
  background: #f1f4f6;
  font-size: 13px;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.task-list {
  display: grid;
  gap: 12px;
}

.task-list label {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.kanban {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.mini-card {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-weight: 650;
}

.note {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.research-grid {
  margin-top: 16px;
}

.research-home {
  min-height: calc(100vh - 84px);
  background:
    linear-gradient(135deg, rgba(12, 122, 117, 0.10), rgba(247, 248, 250, 0) 38%),
    linear-gradient(180deg, #fff 0, var(--paper) 320px);
}

.home-head {
  align-items: center;
}

.tool-dock {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 18px;
  align-items: stretch;
  margin-top: 28px;
}

.tool-icon {
  position: relative;
  min-height: 150px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  padding: 18px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 12px 28px rgba(28, 39, 49, 0.08);
  text-align: center;
  text-decoration: none;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.tool-icon:hover,
.tool-icon:focus-visible {
  transform: translateY(-6px);
  border-color: rgba(12, 122, 117, 0.45);
  box-shadow: 0 18px 42px rgba(28, 39, 49, 0.14);
}

.tool-icon::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  width: min(260px, 72vw);
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 12px 28px rgba(28, 39, 49, 0.14);
  font-size: 13px;
  line-height: 1.5;
  opacity: 0;
  transform: translate(-50%, 6px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.tool-icon:hover::after,
.tool-icon:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.tool-symbol {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--accent);
  background: #eef9f7;
}

.tool-icon.primary .tool-symbol {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #284661);
}

.tool-symbol svg {
  width: 34px;
  height: 34px;
}

.tool-name {
  font-weight: 800;
}

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

.writing-page {
  min-height: calc(100vh - 84px);
  padding-top: 22px;
  background: linear-gradient(180deg, #fff 0, var(--paper) 260px);
}

.writer-frame {
  width: min(1120px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 12px;
}

.writer-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.writer-title {
  min-height: 48px;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  font: inherit;
  font-size: 24px;
  font-weight: 800;
  outline: 0;
}

.save-state {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.writer-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
}

.writer-toolbar button,
.writer-toolbar select {
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font: inherit;
  cursor: pointer;
}

.writing-editor {
  min-height: calc(100vh - 260px);
  padding: clamp(18px, 4vw, 44px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  outline: 0;
  overflow-wrap: anywhere;
}

.writing-editor.font-serif {
  font-family: Georgia, "Times New Roman", "Songti SC", SimSun, serif;
}

.writing-editor.font-sans {
  font-family: Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

.writing-editor.font-mono {
  font-family: Consolas, "SFMono-Regular", monospace;
}

.mindmap-page {
  min-height: calc(100vh - 84px);
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  background: #fff;
}

.mind-sidebar {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 22px;
  border-right: 1px solid var(--line);
  background: #f7f8fa;
}

.mind-sidebar h2 {
  margin: 0 0 10px;
  font-size: 22px;
}

.mind-sidebar label {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.mind-sidebar select {
  min-height: 40px;
  width: 100%;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font: inherit;
}

.mind-actions {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.mind-workspace {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(640px, 1fr);
  gap: 12px;
  padding: 22px;
  background:
    linear-gradient(rgba(216, 221, 228, 0.45) 1px, transparent 1px),
    linear-gradient(90deg, rgba(216, 221, 228, 0.45) 1px, transparent 1px);
  background-size: 28px 28px;
}

.mind-title {
  width: min(520px, 100%);
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  font: inherit;
  font-weight: 800;
}

.mind-canvas {
  position: relative;
  overflow: auto;
  min-height: 640px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.mind-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.mind-line {
  fill: none;
  stroke: rgba(12, 122, 117, 0.46);
  stroke-width: 2.2;
}

.mind-node {
  position: absolute;
  width: 148px;
  min-height: 52px;
  display: grid;
  place-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(28, 39, 49, 0.10);
  text-align: center;
  font-weight: 760;
  outline: 0;
  cursor: grab;
  touch-action: none;
  user-select: text;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.mind-node.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(12, 122, 117, 0.14), 0 10px 24px rgba(28, 39, 49, 0.10);
}

.mind-node:active {
  cursor: grabbing;
  transform: scale(1.01);
}

/* Research launcher */
.workspace-home {
  width: min(1420px, 100%);
  margin: 0 auto;
  display: block;
  padding: 40px clamp(18px, 4vw, 56px) 72px;
}

.workspace-identity {
  position: sticky;
  top: 104px;
  align-self: start;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
}

.workspace-avatar {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: #17202a;
  font-weight: 850;
}

.workspace-identity span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.workspace-identity h1 {
  margin: 2px 0 0;
  font-size: 24px;
}

.workspace-identity p,
.workspace-identity nav {
  grid-column: 1 / -1;
}

.workspace-identity p {
  margin: 10px 0 4px;
  color: var(--muted);
  line-height: 1.6;
}

.workspace-identity nav {
  display: grid;
  gap: 4px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.workspace-identity nav a {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 700;
}

.workspace-identity nav a:hover {
  color: var(--accent-strong);
  background: #eef6f5;
}

.workspace-identity nav svg {
  width: 18px;
  height: 18px;
}

.workspace-sections {
  min-width: 0;
  display: grid;
  gap: 38px;
}

.workspace-welcome {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.workspace-welcome p {
  margin: 0 0 6px;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 800;
}

.workspace-welcome h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.25;
}

.workspace-welcome > span {
  color: var(--muted);
  font: 700 13px/1.4 Consolas, "SFMono-Regular", monospace;
}

.workspace-group {
  scroll-margin-top: 104px;
}

.workspace-group > header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.workspace-group > header svg {
  width: 20px;
  height: 20px;
  color: var(--accent);
}

.ui-icon {
  display: block;
  flex: 0 0 auto;
  overflow: visible;
}

.workspace-group h2 {
  margin: 0;
  font-size: 18px;
}

.workspace-tools {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.workspace-tool {
  position: relative;
  min-height: 92px;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 20px;
  gap: 13px;
  align-items: center;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 5px 16px rgba(28, 39, 49, 0.055);
  text-decoration: none;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.workspace-tool:hover,
.workspace-tool:focus-visible {
  z-index: 2;
  transform: translateY(-3px);
  border-color: #8ebbb7;
  box-shadow: 0 12px 28px rgba(28, 39, 49, 0.12);
}

.workspace-tool.primary {
  border-color: #c8a455;
  background: #fffdf7;
}

.workspace-tool-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #096b67;
  background: #e9f5f3;
}

.workspace-tool.primary .workspace-tool-icon {
  color: #704d00;
  background: #fff0c7;
}

.workspace-tool-icon svg {
  width: 25px;
  height: 25px;
}

.workspace-tool strong {
  min-width: 0;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.workspace-tool-arrow {
  width: 17px;
  height: 17px;
  color: #8a949f;
}

.workspace-tool::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 14px;
  bottom: calc(100% + 8px);
  z-index: 4;
  width: min(300px, 74vw);
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
  box-shadow: var(--shadow);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.55;
  opacity: 0;
  transform: translateY(5px);
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
}

.workspace-tool:hover::after,
.workspace-tool:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

/* Research design and manuscript studio */
.icon-button {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
}

.icon-button:hover {
  color: var(--accent-strong);
  border-color: #9fc3bf;
  background: #eef9f7;
}

.icon-button svg,
.button svg {
  width: 17px;
  height: 17px;
}

.button svg {
  margin-right: 7px;
}

.writing-studio {
  min-height: calc(100vh - 76px);
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  background: #fff;
}

.writing-projects {
  min-width: 0;
  padding: 20px 16px;
  border-right: 1px solid var(--line);
  background: #f4f6f7;
}

.writing-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding: 0 4px;
  font-weight: 800;
}

.writing-create-form {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.writing-create-form[hidden] {
  display: none;
}

.writing-create-form input,
.writing-create-form select,
.writing-settings input,
.writing-settings select,
.citation-search input {
  width: 100%;
  min-height: 42px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  font: inherit;
}

.writing-project-list {
  display: grid;
  gap: 5px;
}

.writing-project-list a {
  display: grid;
  gap: 5px;
  padding: 11px;
  border: 1px solid transparent;
  border-radius: 7px;
  text-decoration: none;
}

.writing-project-list a:hover {
  background: #fff;
}

.writing-project-list a.active {
  border-color: #a9ccc8;
  background: #e8f4f2;
}

.writing-project-list strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.writing-project-list span,
.writing-sidebar-meta span,
.writing-sidebar-meta small {
  color: var(--muted);
  font-size: 12px;
}

.writing-sidebar-meta {
  display: grid;
  gap: 5px;
  margin-top: 22px;
  padding: 14px 4px 0;
  border-top: 1px solid var(--line);
}

.writing-sidebar-meta strong {
  overflow-wrap: anywhere;
}

.writing-main {
  min-width: 0;
  padding: 28px clamp(18px, 3vw, 46px) 64px;
  background: #fafbfc;
}

.writing-main-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.writing-main-head h1 {
  margin: 3px 0 0;
  font-size: 26px;
  overflow-wrap: anywhere;
}

.eyebrow {
  margin: 0;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
}

.save-state.failed {
  color: #9d1c1c;
  border-color: #e1b7b4;
  background: #fff2f1;
}

.writing-tabs {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  margin-bottom: 26px;
  border-bottom: 1px solid var(--line);
}

.writing-tabs button {
  min-width: 128px;
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 15px;
  border: 0;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-weight: 750;
  white-space: nowrap;
  cursor: pointer;
}

.writing-tabs button.active {
  color: var(--accent-strong);
  border-bottom-color: var(--accent);
}

.writing-tabs svg {
  width: 18px;
  height: 18px;
}

.writing-tab-panel {
  display: none;
}

.writing-tab-panel.active {
  display: block;
}

.writing-settings {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.writing-settings label {
  display: grid;
  gap: 7px;
}

.writing-settings label > span,
.protocol-block > label {
  color: #404b56;
  font-size: 13px;
  font-weight: 800;
}

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

.protocol-block {
  position: relative;
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.protocol-block.wide {
  grid-column: 1 / -1;
}

.protocol-block.ethics {
  border-left: 4px solid #c4932c;
  background: #fffdf7;
}

.protocol-block textarea {
  width: 100%;
  min-height: 112px;
  padding: 10px 11px;
  border: 1px solid #e0e4e8;
  border-radius: 6px;
  background: #fbfcfd;
  resize: vertical;
  font: inherit;
  line-height: 1.65;
}

.protocol-block.wide textarea {
  min-height: 126px;
}

.protocol-block p {
  margin: 0;
  color: #85600f;
  font-size: 12px;
}

.inline-link {
  justify-self: start;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 750;
}

.manuscript-layout {
  display: grid;
  grid-template-columns: 190px minmax(360px, 1fr) 210px;
  gap: 14px;
  align-items: start;
}

.section-list,
.version-panel {
  display: grid;
  gap: 5px;
}

.section-list button {
  min-height: 45px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--ink);
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.section-list button.active {
  border-color: #abd0cc;
  color: var(--accent-strong);
  background: #eaf6f4;
  font-weight: 800;
}

.section-list small {
  color: var(--muted);
}

.manuscript-editor-wrap {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(28, 39, 49, 0.07);
}

.manuscript-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.manuscript-editor-head input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  font-size: 19px;
  font-weight: 850;
}

.manuscript-toolbar {
  margin: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: #f7f9fa;
}

.manuscript-toolbar svg {
  width: 16px;
  height: 16px;
}

.manuscript-editor {
  min-height: 610px;
  padding: 32px clamp(20px, 4vw, 58px);
  outline: 0;
  font: 17px/1.85 Georgia, "Times New Roman", "Songti SC", SimSun, serif;
  overflow-wrap: anywhere;
}

.manuscript-editor p {
  margin: 0 0 1em;
}

.editor-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.version-panel {
  max-height: 710px;
  overflow: auto;
  padding: 13px;
  border-left: 1px solid var(--line);
}

.version-panel h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.version-panel div {
  display: grid;
  gap: 4px;
  padding: 9px 0;
  border-bottom: 1px solid #e7eaed;
}

.version-panel strong {
  font-size: 13px;
}

.version-panel span,
.version-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.citation-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr);
  gap: 18px;
}

.citation-search-panel,
.selected-citations,
.export-settings,
.export-actions-panel {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.citation-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.citation-head h2,
.selected-citations h2,
.export-layout h2 {
  margin: 0;
  font-size: 18px;
}

.citation-head p,
.export-settings > p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.citation-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 9px;
  margin-bottom: 14px;
}

.literature-picker,
#selectedCitationList {
  display: grid;
  gap: 8px;
}

.literature-picker {
  max-height: 640px;
  overflow: auto;
}

.literature-picker article,
#selectedCitationList article {
  position: relative;
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfd;
}

.literature-picker article {
  grid-template-columns: minmax(0, 1fr) auto;
}

.literature-picker strong,
.literature-picker span {
  grid-column: 1;
}

.literature-picker button {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
}

.literature-picker span,
#selectedCitationList span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.selected-citations h2 {
  margin-bottom: 14px;
}

.selected-citations h2 span {
  color: var(--accent);
}

#selectedCitationList article {
  padding-right: 46px;
}

#selectedCitationList .icon-button {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 30px;
  height: 30px;
  min-height: 30px;
}

.empty-copy {
  margin: 0;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 7px;
  color: var(--muted);
  text-align: center;
}

.export-layout {
  display: grid;
  grid-template-columns: minmax(300px, .7fr) minmax(420px, 1.3fr);
  gap: 18px;
}

.citation-style-options {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.citation-style-options label {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  cursor: pointer;
}

.citation-style-options input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.export-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 18px;
}

.export-summary div {
  display: grid;
  gap: 4px;
  padding: 11px;
  border-radius: 7px;
  background: #f1f4f5;
}

.export-summary span {
  color: var(--muted);
  font-size: 11px;
}

.export-summary b {
  font-size: 20px;
}

.export-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.export-actions a {
  min-height: 116px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-content: center;
  gap: 4px 12px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-decoration: none;
}

.export-actions a:hover {
  border-color: #91bcb8;
  background: #f4faf9;
}

.export-actions svg {
  grid-row: 1 / span 2;
  align-self: center;
  width: 30px;
  height: 30px;
  color: var(--accent);
}

.export-actions span {
  color: var(--muted);
  font-size: 12px;
}

.button.danger {
  color: #9b2c2c;
  border-color: #e0b7b4;
  background: #fff7f6;
}

.ai-stage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.ai-stage-head h2 {
  margin: 4px 0 0;
  font-size: 22px;
}

.ai-model-badge {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  border: 1px solid #c8d2d8;
  border-radius: 7px;
  color: #42505c;
  background: #fff;
  font: 700 12px/1.2 Consolas, "SFMono-Regular", monospace;
}

.ai-model-badge svg {
  width: 16px;
  height: 16px;
  color: var(--accent);
}

.ai-task-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.ai-task-card {
  position: relative;
  min-height: 104px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 18px;
  gap: 11px;
  align-items: start;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.ai-task-card:hover {
  border-color: #9fc5c1;
  box-shadow: 0 8px 20px rgba(28, 39, 49, .07);
}

.ai-task-card.active {
  border-color: var(--accent);
  background: #f1f9f8;
  box-shadow: 0 0 0 3px rgba(12, 122, 117, .09);
}

.ai-task-card > svg:first-child {
  width: 27px;
  height: 27px;
  color: var(--accent);
}

.ai-task-card > span {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.ai-task-card strong {
  font-size: 14px;
}

.ai-task-card small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.ai-task-card .task-check {
  width: 17px;
  height: 17px;
  color: var(--accent);
  opacity: 0;
}

.ai-task-card.active .task-check {
  opacity: 1;
}

.ai-request-bar {
  display: grid;
  grid-template-columns: minmax(170px, .35fr) minmax(360px, 1fr) auto;
  gap: 12px;
  align-items: end;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.ai-request-bar label {
  display: grid;
  gap: 7px;
}

.ai-request-bar label > span {
  color: #44515d;
  font-size: 12px;
  font-weight: 800;
}

.ai-request-bar select,
.ai-request-bar textarea {
  width: 100%;
  min-height: 46px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfd;
  font: inherit;
}

.ai-request-bar select:disabled {
  color: #929ba4;
  background: #eef1f3;
}

.ai-request-bar textarea {
  height: 70px;
  padding-block: 10px;
  resize: vertical;
  line-height: 1.5;
}

.ai-run-button {
  min-height: 46px;
  white-space: nowrap;
}

.ai-privacy-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 20px;
  color: #7b5b15;
  font-size: 12px;
}

.ai-privacy-note svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

.ai-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 16px;
  align-items: start;
}

.ai-job-panel,
.ai-history-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.ai-job-panel {
  min-height: 430px;
  overflow: hidden;
}

.ai-job-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
}

.ai-job-head > div {
  display: grid;
  gap: 4px;
}

.ai-job-head span {
  color: var(--muted);
  font-size: 12px;
}

.ai-job-head strong {
  font-size: 16px;
}

.ai-job-head > b {
  color: var(--accent-strong);
  font: 800 14px/1 Consolas, "SFMono-Regular", monospace;
}

.ai-progress {
  height: 4px;
  background: #e7ecef;
}

.ai-progress i {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 260ms ease;
}

.ai-waiting {
  min-height: 330px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  color: var(--muted);
}

.ai-waiting[hidden],
.ai-compare[hidden],
.ai-result-actions[hidden],
.ai-result-actions button[hidden] {
  display: none;
}

.ai-spinner {
  width: 38px;
  height: 38px;
  border: 3px solid #dce4e7;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 850ms linear infinite;
}

.ai-compare {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-height: 340px;
}

.ai-compare article {
  min-width: 0;
  padding: 0 18px 20px;
}

.ai-compare article + article {
  border-left: 1px solid var(--line);
}

.ai-compare header {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid #e7ebee;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.ai-compare pre,
#aiResultText {
  max-height: 520px;
  margin: 0;
  padding-top: 16px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #303b45;
  font: 14px/1.75 Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

#aiResultText p,
#aiResultText ul,
#aiResultText ol,
#aiResultText h3,
#aiResultText h4 {
  margin-top: 0;
  margin-bottom: 12px;
}

#aiResultText.failed {
  color: #9b2c2c;
}

.ai-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  background: #f8fafb;
}

.ai-history-panel {
  overflow: hidden;
}

.ai-history-head {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
}

.ai-history-head h3 {
  margin: 0;
  font-size: 15px;
}

.ai-history-head span {
  min-width: 26px;
  padding: 4px 7px;
  border-radius: 999px;
  color: var(--accent-strong);
  background: #e8f4f2;
  text-align: center;
  font-size: 11px;
  font-weight: 800;
}

#aiHistoryList {
  max-height: 540px;
  overflow: auto;
}

#aiHistoryList > button {
  width: 100%;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  padding: 12px 13px;
  border: 0;
  border-bottom: 1px solid #e9ecef;
  color: var(--ink);
  background: #fff;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

#aiHistoryList > button:hover {
  background: #f3f8f7;
}

#aiHistoryList > button > svg {
  width: 19px;
  height: 19px;
  color: var(--accent);
}

#aiHistoryList > button > span {
  min-width: 0;
  display: grid;
  gap: 4px;
}

#aiHistoryList strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#aiHistoryList small {
  color: var(--muted);
  font-size: 10px;
}

#aiHistoryList b {
  padding: 4px 6px;
  border-radius: 5px;
  font-size: 10px;
  white-space: nowrap;
}

#aiHistoryList .status-queued,
#aiHistoryList .status-running {
  color: #7a590d;
  background: #fff1c8;
}

#aiHistoryList .status-completed {
  color: #075b57;
  background: #dff4f1;
}

#aiHistoryList .status-failed {
  color: #982d2d;
  background: #ffe7e5;
}

.status-page {
  background:
    linear-gradient(135deg, rgba(12, 122, 117, 0.08), rgba(247, 248, 250, 0) 36%),
    linear-gradient(180deg, #ffffff 0, var(--paper) 260px);
}

.status-heading {
  align-items: center;
}

.status-timestamp {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
}

.status-overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.status-tile {
  display: grid;
  gap: 12px;
  min-height: 176px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 12px 26px rgba(28, 39, 49, 0.08);
}

.status-tile.primary {
  color: #fff;
  border-color: #075b57;
  background: linear-gradient(135deg, #0c7a75, #284661);
}

.status-tile span,
.traffic-box span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.status-tile.primary span,
.status-tile.primary small {
  color: rgba(255, 255, 255, 0.78);
}

.status-tile strong {
  font-size: clamp(28px, 3vw, 42px);
  line-height: 1;
}

.status-tile small,
.traffic-box small {
  color: var(--muted);
  line-height: 1.5;
}

.progress {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf1;
}

.progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0c7a75, #e0a93a);
}

.status-tile.primary .progress {
  background: rgba(255, 255, 255, 0.22);
}

.status-tile.primary .progress i {
  background: #ffffff;
}

.status-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 16px;
}

.status-card {
  min-height: 240px;
}

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

.traffic-box {
  display: grid;
  gap: 7px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.traffic-box strong {
  font-size: 26px;
}

.compact-table th,
.compact-table td {
  padding: 10px 12px;
}

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

.service-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.service-row span {
  font-weight: 750;
}

.service-badge {
  min-width: 72px;
  padding: 6px 10px;
  border-radius: 999px;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
}

.service-badge.ok {
  color: #075b57;
  background: #dff5f1;
}

.service-badge.warn {
  color: #8a5b00;
  background: #fff2c7;
}

.service-badge.bad {
  color: #9d1c1c;
  background: #ffe1df;
}

.status-facts {
  display: grid;
  gap: 10px;
  margin: 0;
}

.status-facts div {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.status-facts dt {
  color: var(--muted);
  font-weight: 750;
}

.status-facts dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.translate-page {
  background:
    linear-gradient(135deg, rgba(12, 122, 117, 0.08), rgba(247, 248, 250, 0) 34%),
    linear-gradient(180deg, #ffffff 0, var(--paper) 280px);
}

.translate-layout {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(320px, 1fr);
  gap: 16px;
  align-items: stretch;
}

.translate-input,
.translate-output {
  min-height: 620px;
  display: flex;
  flex-direction: column;
}

.translate-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.translate-panel-head h3 {
  margin: 0;
}

.mini-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.mini-actions .button {
  min-height: 34px;
  padding: 0 11px;
  font-size: 13px;
}

.translate-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 10px;
  margin-bottom: 14px;
}

.translate-controls select {
  min-height: 42px;
  width: 100%;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font: inherit;
}

.translate-input textarea {
  width: 100%;
  min-height: 500px;
  flex: 1;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  resize: vertical;
  font: inherit;
  line-height: 1.7;
  box-shadow: inset 0 1px 0 rgba(28, 39, 49, 0.03);
}

.translate-output {
  position: relative;
}

.result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.result-meta span {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #fbfcfd;
  font-size: 12px;
  font-weight: 750;
}

.result-label {
  margin: 8px 0 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.result-box {
  min-height: 500px;
  flex: 1;
  margin: 0 0 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: inherit;
  line-height: 1.75;
}

.loading-result {
  min-height: 500px;
  flex: 1;
  display: grid;
  place-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: linear-gradient(180deg, #fff, #f6fbfa);
}

.loading-result[hidden] {
  display: none;
}

.translate-output.is-loading #translationResult,
.translate-output.is-loading .result-meta,
.translate-output.is-loading .compact-alert {
  display: none !important;
}

.loading-result span {
  width: 42px;
  height: 42px;
  border: 4px solid #d8dde4;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 900ms linear infinite;
}

.loading-result b {
  font-weight: 800;
}

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

.result-box.corrected {
  border-color: #b7d9cf;
  background: #f4fbf9;
}

.correction-list {
  display: grid;
  gap: 8px;
  margin-top: 2px;
}

.correction-list div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.correction-list strong {
  color: #9d1c1c;
}

.correction-list b {
  color: #075b57;
}

.empty-result {
  min-height: 500px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fbfcfd;
  font-weight: 750;
}

.compact-alert {
  margin: 10px 0 0;
}

.landing-only {
  min-height: 100vh;
}

.landing-hero {
  min-height: 100vh;
  grid-template-columns: 1fr;
  align-items: center;
}

.landing-brand {
  margin-bottom: 24px;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.section-head h2,
.section-head p {
  margin: 0;
}

.section-head p {
  color: var(--muted);
}

.notebook-layout {
  display: grid;
  gap: 18px;
}

.notebook-upload {
  display: grid;
  gap: 12px;
}

.upload-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.upload-row input,
.compact-form input,
.compact-form select {
  min-height: 42px;
  width: 100%;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font: inherit;
}

.notebook-grid {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(360px, 1.5fr) minmax(220px, 0.8fr);
  gap: 16px;
  align-items: stretch;
}

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

.list-item {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-decoration: none;
}

.list-item strong {
  line-height: 1.35;
}

.list-item span {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.list-item.active {
  border-color: var(--accent);
  background: #eef9f7;
}

.document-preview {
  min-height: 560px;
  display: flex;
  flex-direction: column;
}

.document-preview iframe {
  width: 100%;
  min-height: 480px;
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.preview-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.full-button {
  width: 100%;
  margin-bottom: 12px;
}

.note-list {
  max-height: 520px;
  overflow: auto;
  padding-right: 2px;
}

.notebook-editor textarea {
  width: 100%;
  min-height: 360px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  resize: vertical;
  font: inherit;
  line-height: 1.65;
}

.compact-form {
  grid-template-columns: minmax(0, 1fr) minmax(180px, 0.75fr);
}

.note-preview {
  min-height: 448px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  line-height: 1.75;
  overflow-wrap: anywhere;
}

.note-preview h1,
.note-preview h2,
.note-preview h3 {
  margin: 0 0 10px;
}

.notice {
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid #b7d9cf;
  border-radius: 8px;
  color: #075b57;
  background: #eef9f7;
}

.literature-page {
  min-height: calc(100vh - 84px);
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  background:
    linear-gradient(135deg, rgba(12, 122, 117, 0.08), rgba(247, 248, 250, 0) 34%),
    linear-gradient(180deg, #fff 0, var(--paper) 320px);
}

.lit-sidebar {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.lit-title,
.lit-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.lit-title {
  align-items: center;
}

.lit-title h2 {
  margin: 0;
  font-size: 22px;
}

.lit-title span,
.lit-tags a {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 12px;
  font-weight: 800;
}

.lit-title span {
  padding: 6px 10px;
  color: #075b57;
  background: #dff5f1;
}

.lit-search,
.lit-import,
.lit-editor,
.lit-list,
.lit-preview {
  display: grid;
  gap: 10px;
}

.lit-search {
  grid-template-columns: minmax(0, 1fr) auto;
}

.lit-search input,
.lit-import input,
.lit-editor input,
.lit-editor select,
.lit-editor textarea {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font: inherit;
}

.lit-editor textarea {
  min-height: 110px;
  padding: 12px;
  resize: vertical;
  line-height: 1.65;
}

.lit-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.lit-tags a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  text-decoration: none;
}

.lit-tags b,
.lit-item span,
.lit-item small,
.lit-detail-head p,
.lit-citation p,
.lit-history span,
.lit-history small,
.lit-empty p {
  color: var(--muted);
}

.lit-list {
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.lit-item {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-decoration: none;
  box-shadow: 0 6px 16px rgba(28, 39, 49, 0.05);
}

.lit-item strong {
  line-height: 1.36;
}

.lit-item span,
.lit-item small {
  font-size: 12px;
  line-height: 1.45;
}

.lit-item.active {
  border-color: var(--accent);
  background: #eef9f7;
}

.lit-main {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 16px;
  padding: 18px;
}

.lit-tools {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.lit-import h3,
.lit-preview h3,
.lit-history h3 {
  margin: 0;
}

.lit-detail {
  display: grid;
  gap: 16px;
}

.lit-detail-head h1 {
  margin: 0 0 8px;
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.15;
}

.lit-detail-head p {
  margin: 0;
  line-height: 1.55;
}

.lit-meta-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.lit-meta-grid div {
  min-height: 74px;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.lit-meta-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.lit-meta-grid b {
  min-width: 0;
  overflow-wrap: anywhere;
}

.lit-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(360px, 1.05fr);
  gap: 16px;
}

.lit-editor label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.lit-citation,
.markdown-preview,
.lit-extract {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.lit-citation p {
  margin: 5px 0 12px;
  line-height: 1.55;
}

.lit-citation p:last-child {
  margin-bottom: 0;
}

.markdown-preview {
  min-height: 180px;
  line-height: 1.75;
  overflow-wrap: anywhere;
}

.markdown-preview h2,
.markdown-preview h3,
.markdown-preview h4 {
  margin: 6px 0 8px;
}

.markdown-preview code {
  padding: 2px 5px;
  border-radius: 6px;
  background: #eef9f7;
  color: #075b57;
}

.lit-extract {
  max-height: 320px;
  overflow: auto;
  white-space: pre-wrap;
  color: var(--muted);
  font: 13px/1.6 Consolas, "SFMono-Regular", monospace;
}

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

.lit-history section {
  display: grid;
  gap: 8px;
}

.lit-history div {
  display: grid;
  grid-template-columns: 72px 150px minmax(0, 1fr);
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  font-size: 13px;
}

.lit-empty {
  min-height: 420px;
  display: grid;
  place-content: center;
  text-align: center;
}

.lit-empty h1 {
  margin: 0 0 12px;
  font-size: 34px;
}

.lit-empty p {
  max-width: 680px;
  margin: 0;
  line-height: 1.75;
}

@media (max-width: 860px) {
  .hero {
    grid-template-columns: 1fr;
  }

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

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

  .tool-icon::after {
    display: none;
  }

  .account-nav {
    width: 100%;
  }

  .account-menu {
    left: 0;
    right: auto;
    width: min(260px, 100%);
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav {
    justify-content: flex-start;
  }

  .split,
  .kanban,
  .toolbar,
  .form-grid,
  .notebook-grid,
  .upload-row,
  .captcha-row,
  .section-head,
  .status-overview,
  .status-layout,
  .traffic-grid,
  .translate-layout,
  .translate-controls,
  .account-layout {
    grid-template-columns: 1fr;
  }

  .writer-top {
    grid-template-columns: 1fr;
  }

  .mindmap-page {
    grid-template-columns: 1fr;
  }

  .literature-page,
  .lit-tools,
  .lit-grid,
  .lit-history,
  .lit-meta-grid {
    grid-template-columns: 1fr;
  }

  .lit-sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .lit-detail-head {
    display: grid;
  }

  .mind-sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .mind-workspace {
    grid-template-rows: auto minmax(520px, 1fr);
    padding: 14px;
  }

  .mind-canvas {
    min-height: 520px;
  }

  .translate-input,
  .translate-output {
    min-height: auto;
  }

  .translate-input textarea,
  .empty-result {
    min-height: 360px;
  }

  .section-head {
    display: grid;
  }

  .document-preview {
    min-height: auto;
  }

  .document-preview iframe {
    min-height: 420px;
  }

  .captcha-row {
    grid-template-columns: 1fr 82px;
  }

  .captcha-row img {
    width: 100%;
    grid-column: 1 / -1;
  }

  .workspace-home,
  .writing-studio,
  .writing-settings,
  .protocol-form,
  .citation-layout,
  .export-layout,
  .ai-request-bar,
  .ai-workbench,
  .ai-compare {
    grid-template-columns: 1fr;
  }

  .workspace-home {
    gap: 26px;
    padding-top: 22px;
  }

  .workspace-identity {
    position: static;
  }

  .workspace-identity nav {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .workspace-identity nav a {
    flex: 0 0 auto;
  }

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

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

  .ai-compare article + article {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .ai-history-panel {
    order: -1;
  }

  .workspace-tool::after {
    display: none;
  }

  .writing-projects {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .writing-project-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .protocol-block.wide {
    grid-column: auto;
  }

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

  .section-list {
    display: flex;
    overflow-x: auto;
  }

  .section-list button {
    flex: 0 0 auto;
  }

  .version-panel {
    max-height: 240px;
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}

/* File Browser aligned visual system. */
:root {
  --ink: #333333;
  --muted: #6f6f6f;
  --line: rgba(0, 0, 0, 0.12);
  --paper: #fafafa;
  --panel: #ffffff;
  --accent: #2196f3;
  --accent-strong: #1e88e5;
  --warn: #d32f2f;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.10);
}

body {
  color: var(--ink);
  background: var(--paper);
}

body * {
  border-radius: revert !important;
}

button,
input,
select,
textarea,
[contenteditable="true"],
.button,
.icon-button,
.account-button,
.nav a {
  border-radius: 4px !important;
}

.panel,
.card,
.login-panel,
.account-menu,
.status-tile,
.traffic-box,
.service-row,
.status-facts div,
.translate-input,
.translate-output,
.list-item,
.lit-item,
.lit-citation,
.markdown-preview,
.lit-extract,
.lit-meta-grid div,
.writing-projects,
.writing-main,
.writing-settings,
.protocol-block,
.ai-task-card,
.ai-request-bar,
.ai-job-panel,
.ai-history-panel,
.citation-search-panel,
.selected-citations,
.export-settings,
.export-summary,
.mind-node,
.workspace-tool,
.workspace-tool-icon {
  border-radius: 7px !important;
}

.loading-result span,
.ai-spinner,
.service-badge,
.result-meta span,
.ai-model-badge,
.status-timestamp,
.lit-tags a,
.account-button b,
.workspace-welcome > span {
  border-radius: 999px !important;
}

.topbar {
  min-height: 64px;
  padding-top: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(10px);
}

.mark {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 7px !important;
  background: var(--accent);
  box-shadow: none;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.brand:hover .mark {
  transform: rotate(-5deg) scale(1.05);
  box-shadow: 0 4px 10px rgba(33, 150, 243, 0.28);
}

.button,
.nav a,
.account-button,
.icon-button {
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: none;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.button:hover,
.nav a:hover,
.account-button:hover,
.icon-button:hover {
  border-color: rgba(33, 150, 243, 0.42);
  background: rgba(33, 150, 243, 0.08);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

.button.primary {
  border-color: var(--accent);
  background: var(--accent);
}

.button.primary:hover {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
}

.account-menu {
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
  animation: fb-menu-in 150ms ease-out both;
  transform-origin: top right;
}

.account-menu-profile {
  border-left: 3px solid var(--accent);
  background: rgba(33, 150, 243, 0.07);
}

@keyframes fb-menu-in {
  from { opacity: 0; transform: translateY(-6px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[contenteditable="true"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

input,
select,
textarea,
[contenteditable="true"],
.writing-editor,
.notebook-editor,
.result-box,
.empty-result,
.loading-result,
.document-preview iframe,
.note-preview,
.mind-canvas {
  border-color: rgba(0, 0, 0, 0.18) !important;
  background-color: #fff !important;
  box-shadow: none !important;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

input:focus,
select:focus,
textarea:focus,
[contenteditable="true"]:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.13) !important;
}

.panel,
.card,
.status-tile,
.traffic-box,
.service-row,
.status-facts div,
.writing-projects,
.writing-main,
.ai-job-panel,
.ai-history-panel,
.mind-node,
.lit-item {
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow);
  transition: box-shadow 180ms ease, transform 180ms ease, border-color 180ms ease;
}

.landing-hero,
.hero,
.status-page,
.translate-page,
.literature-page,
.writing-page,
.workspace-home-full {
  background: var(--paper);
}

.landing-hero {
  min-height: 100vh;
  padding-top: 15vh;
  padding-bottom: 15vh;
  border-bottom: 0;
}

.landing-hero > div {
  width: min(880px, 100%);
  padding: clamp(24px, 5vw, 54px);
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  border-radius: 8px !important;
  background: #fff;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.10);
  animation: fb-page-in 360ms ease-out both;
}

@keyframes fb-page-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.workspace-sections {
  gap: 30px;
}

.workspace-welcome {
  padding: 8px 0 22px;
  border-bottom: 1px solid var(--line);
  animation: fb-page-in 300ms ease-out both;
}

.workspace-welcome p {
  color: var(--accent);
  font-weight: 700;
  text-transform: none;
}

.workspace-welcome > span {
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: none;
}

.workspace-group {
  padding-top: 0;
  border-top: 0;
}

.workspace-group > header svg {
  color: var(--accent);
}

.workspace-tools {
  grid-template-columns: repeat(auto-fill, 320px) !important;
  justify-content: start;
  align-items: stretch;
  gap: 18px;
}

.workspace-tool {
  width: 320px !important;
  min-height: 104px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.08);
  animation: fb-card-in 320ms ease-out both;
  transition: color 180ms ease, background 180ms ease, border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.workspace-tool:nth-child(2) { animation-delay: 45ms; }
.workspace-tool:nth-child(3) { animation-delay: 90ms; }
.workspace-tool:nth-child(4) { animation-delay: 135ms; }

@keyframes fb-card-in {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.workspace-tool:hover,
.workspace-tool:focus-visible {
  border-color: rgba(33, 150, 243, 0.42);
  background: #fff;
  box-shadow: 0 7px 20px rgba(0, 0, 0, 0.13);
  transform: translateY(-3px);
}

.workspace-tool.primary,
.workspace-tool.primary:hover {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

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

.workspace-tool-icon {
  border: 0;
  color: var(--accent);
  background: rgba(33, 150, 243, 0.10);
}

.workspace-tool.primary .workspace-tool-icon {
  border: 0;
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
}

.workspace-tool::after {
  border: 1px solid var(--line);
  border-radius: 4px !important;
  background: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

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

.progress,
.progress i {
  border-radius: 999px !important;
}

.progress i,
.status-tile.primary .progress i {
  background: var(--accent);
}

.status-tile.primary .progress i {
  background: #fff;
}

.writing-projects,
.mind-sidebar,
.lit-sidebar {
  border-right: 1px solid var(--line);
  background: #f7f7f7;
}

.writing-tabs {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #f4f4f4;
}

.writing-tabs button.active {
  color: #fff;
  background: var(--accent);
}

.manuscript-toolbar,
.writer-toolbar {
  border: 1px solid var(--line);
  background: #f5f5f5;
}

.ai-task-card.active,
.writing-project-list a.active,
.lit-item.active,
.list-item.active,
.mind-node.selected {
  border-color: var(--accent);
  background: rgba(33, 150, 243, 0.08);
  box-shadow: 0 3px 10px rgba(33, 150, 243, 0.14);
}

pre.code,
.lit-extract {
  border: 1px solid rgba(0, 0, 0, 0.16);
  border-radius: 6px !important;
  background: #263238;
  color: #f5f7f8;
}

.footer {
  border-top: 1px solid var(--line);
  background: #fff;
}

@media (max-width: 720px) {
  .workspace-tools {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .workspace-tool {
    width: 100% !important;
  }

  .writing-projects,
  .mind-sidebar,
  .lit-sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (min-width: 861px) and (max-width: 1180px) {
  .workspace-tools {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .writing-studio {
    grid-template-columns: 220px minmax(0, 1fr);
  }

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

  .manuscript-layout {
    grid-template-columns: 170px minmax(360px, 1fr);
  }

  .version-panel {
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-height: 240px;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .version-panel h3 {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  .workspace-tools,
  .writing-project-list,
  .export-actions,
  .export-summary,
  .ai-task-grid {
    grid-template-columns: 1fr;
  }

  .workspace-tool {
    min-height: 78px;
  }

  .writing-main {
    padding-inline: 12px;
  }

  .writing-main-head {
    align-items: flex-start;
  }

  .workspace-welcome,
  .ai-stage-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .writing-tabs button {
    min-width: 108px;
    padding-inline: 10px;
  }

  .citation-head,
  .manuscript-editor-head,
  .editor-foot {
    align-items: stretch;
    flex-direction: column;
  }

  .citation-head {
    display: flex;
  }

  .literature-picker article {
    grid-template-columns: 1fr;
  }

  .literature-picker button {
    grid-column: 1;
    grid-row: auto;
    justify-self: start;
  }

  .manuscript-editor {
    min-height: 460px;
    padding: 22px 16px;
  }
}

/* Legacy hard-grid visual system disabled.
:root {
  --ink: #161b1f;
  --muted: #58636b;
  --line: #aeb7bd;
  --paper: #ecefed;
  --panel: #ffffff;
  --accent: #08766b;
  --accent-strong: #04584f;
  --warn: #9a3f16;
  --shadow: 4px 4px 0 #c4cbd0;
}

body {
  background: var(--paper);
}

body * {
  border-radius: 0 !important;
}

.loading-result span,
.ai-spinner {
  border-radius: 50% !important;
}

button,
input,
select,
textarea {
  accent-color: var(--accent);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[contenteditable="true"]:focus-visible {
  outline: 3px solid #e0aa21;
  outline-offset: 2px;
}

.topbar {
  min-height: 70px;
  padding-top: 13px;
  padding-bottom: 13px;
  border-bottom: 2px solid var(--ink);
  background: #fff;
  backdrop-filter: none;
}

.brand {
  gap: 10px;
  font-weight: 900;
}

.mark {
  width: 36px;
  height: 36px;
  border: 2px solid var(--ink);
  background: var(--accent);
  box-shadow: 3px 3px 0 var(--ink);
}

.button,
.nav a,
.account-button,
.icon-button {
  border: 1px solid var(--ink);
  box-shadow: 2px 2px 0 #b9c1c6;
  transition: color 130ms ease, background 130ms ease, box-shadow 130ms ease, transform 130ms ease;
}

.button:hover,
.nav a:hover,
.account-button:hover,
.icon-button:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 #aeb7bd;
}

.button.primary {
  border-color: var(--ink);
  background: var(--ink);
}

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

.account-button b,
.account-menu-profile,
.account-menu a,
.service-badge,
.result-meta span,
.ai-model-badge,
.status-timestamp,
.lit-title span,
.lit-tags a,
#aiHistoryList b {
  border-radius: 0 !important;
}

.account-menu {
  border: 2px solid var(--ink);
  box-shadow: 5px 5px 0 rgba(22, 27, 31, .24);
}

.account-menu-profile {
  border-left: 4px solid var(--accent);
  background: #e8f2ef;
}

.hero,
.landing-hero,
.status-page,
.translate-page,
.literature-page,
.writing-page {
  background: var(--paper);
}

.landing-hero {
  position: relative;
  min-height: 100vh;
  padding-top: 15vh;
  padding-bottom: 15vh;
  border-bottom: 12px solid var(--ink);
}

.landing-hero > div {
  width: min(920px, 100%);
  padding: clamp(24px, 5vw, 58px);
  border: 2px solid var(--ink);
  border-left: 12px solid var(--accent);
  background: #fff;
  box-shadow: 10px 10px 0 #bcc5c4;
}

.landing-hero h1 {
  max-width: none;
  font-size: clamp(42px, 7vw, 78px);
  line-height: 1;
}

.panel,
.card,
.status-panel,
.status-tile,
.traffic-box,
.service-row,
.status-facts div,
.translate-input,
.translate-output,
.list-item,
.lit-item,
.lit-citation,
.markdown-preview,
.lit-extract,
.lit-meta-grid div,
.writing-projects,
.writing-main,
.writing-settings,
.protocol-block,
.ai-task-card,
.ai-request-bar,
.ai-job-panel,
.ai-history-panel,
.citation-search-panel,
.selected-citations,
.export-settings,
.export-summary,
.mind-node {
  border-color: var(--line);
  background: #fff;
  box-shadow: var(--shadow);
}

.panel,
.card,
.status-tile,
.writing-projects,
.writing-main,
.ai-job-panel,
.ai-history-panel {
  border: 1px solid var(--ink);
}

input,
select,
textarea,
[contenteditable="true"],
.writing-editor,
.notebook-editor,
.result-box,
.empty-result,
.loading-result,
.document-preview iframe,
.note-preview,
.mind-canvas {
  border-color: #8f9aa1 !important;
  background-color: #fff !important;
  box-shadow: none !important;
}

input:focus,
select:focus,
textarea:focus,
[contenteditable="true"]:focus {
  border-color: var(--ink) !important;
}

.footer {
  border-top: 2px solid var(--ink);
  background: #fff;
}

.workspace-home-full {
  background: var(--paper);
}

.workspace-sections {
  gap: 26px;
}

.workspace-welcome {
  padding: 8px 0 22px;
  border-bottom: 3px solid var(--ink);
}

.workspace-welcome p {
  color: var(--accent);
  font-weight: 900;
  text-transform: uppercase;
}

.workspace-welcome > span {
  border: 1px solid var(--ink);
  background: #fff;
  box-shadow: 3px 3px 0 #c0c7cb;
}

.workspace-group {
  padding-top: 14px;
  border-top: 1px solid #bcc3c7;
}

.workspace-group > header svg {
  color: var(--accent);
}

.workspace-tool {
  min-height: 116px;
  border: 1px solid var(--ink);
  background: #fff;
  box-shadow: 4px 4px 0 #c2c9cd;
  transition: color 140ms ease, background 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.workspace-tool:hover,
.workspace-tool:focus-visible {
  border-color: var(--ink);
  background: #f7faf8;
  box-shadow: 7px 7px 0 #aeb8bc;
  transform: translate(-2px, -2px);
}

.workspace-tool.primary {
  border-color: var(--ink);
  color: #fff;
  background: var(--ink);
}

.workspace-tool.primary:hover {
  background: #242b30;
}

.workspace-tool-icon {
  border: 1px solid var(--ink);
  color: var(--accent);
  background: #e5f1ee;
}

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

.workspace-tool::after {
  border: 1px solid var(--ink);
  background: #fff;
  box-shadow: 3px 3px 0 rgba(22, 27, 31, .2);
}

.status-tile.primary {
  border-color: var(--ink);
  color: #fff;
  background: var(--ink);
}

.progress,
.progress i {
  border-radius: 0 !important;
}

.progress i {
  background: var(--accent);
}

.status-tile.primary .progress i {
  background: #e0aa21;
}

.writing-studio,
.mindmap-page,
.literature-page {
  border-top: 0;
}

.writing-projects,
.mind-sidebar,
.lit-sidebar {
  border-right: 2px solid var(--ink);
  background: #f7f8f7;
}

.writing-tabs {
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  background: #eef0ef;
}

.writing-tabs button {
  border-right: 1px solid #aeb7bd;
}

.writing-tabs button.active {
  color: #fff;
  background: var(--ink);
}

.manuscript-toolbar,
.writer-toolbar {
  border: 1px solid var(--ink);
  background: #edf0ee;
}

.ai-task-card.active,
.writing-project-list a.active,
.lit-item.active,
.list-item.active,
.mind-node.selected {
  border-color: var(--ink);
  background: #e1f0ec;
  box-shadow: 4px 4px 0 #6faaa2;
}

.ai-privacy-note,
.notice,
.hint,
.alert {
  border-left-width: 5px;
  box-shadow: none;
}

pre.code,
.lit-extract {
  border: 1px solid var(--ink);
  background: #1c2327;
  color: #e6eeeb;
}

@media (max-width: 860px) {
  .topbar {
    gap: 12px;
  }

  .landing-hero > div {
    box-shadow: 6px 6px 0 #bcc5c4;
  }

  .writing-projects,
  .mind-sidebar,
  .lit-sidebar {
    border-right: 0;
    border-bottom: 2px solid var(--ink);
  }

  .workspace-tool,
  .panel,
  .status-tile {
    box-shadow: 3px 3px 0 #c2c9cd;
  }
}
*/

/* Full-bleed landscape landing page. */
.landing-only {
  min-height: 100vh;
  min-height: 100svh;
  background: #132330;
}

.landing-hero {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  min-height: 100svh;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  overflow: hidden;
  padding: 72px clamp(28px, 8vw, 120px);
  border: 0;
  color: #fff;
  background-color: #132330;
  background-image:
    linear-gradient(90deg, rgba(6, 20, 30, 0.88) 0%, rgba(8, 25, 36, 0.72) 36%, rgba(8, 25, 36, 0.18) 72%, rgba(8, 25, 36, 0.08) 100%),
    linear-gradient(0deg, rgba(5, 16, 24, 0.28), rgba(5, 16, 24, 0) 42%),
    url("https://m-1252909623.cos.ap-chongqing.myqcloud.com/cdn-static-20260805/cdn-static-20260805/root-portal/assets/maligne-lake.jpg"),
    url("/assets/images/landing-maligne-lake.jpg");
  background-size: cover;
  background-position: center 48%;
  background-repeat: no-repeat;
}

.landing-hero > div {
  position: relative;
  z-index: 1;
  width: min(680px, 100%);
  padding: 0;
  border: 0;
  border-radius: 0 !important;
  background: transparent;
  box-shadow: none;
  animation: landing-content-in 520ms ease-out both;
}

.landing-brand {
  width: max-content;
  margin-bottom: 28px;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.3);
}

.landing-brand .mark {
  color: #173246;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.landing-brand:hover .mark {
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}

.landing-hero h1 {
  max-width: 680px;
  color: #fff;
  font-size: 72px;
  line-height: 1;
  text-shadow: 0 3px 24px rgba(0, 0, 0, 0.38);
}

.landing-hero .hero-actions {
  margin-top: 34px;
}

.landing-hero .button.primary {
  min-width: 118px;
  min-height: 46px;
  border-color: rgba(255, 255, 255, 0.96);
  color: #173246;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
}

.landing-hero .landing-action-icon {
  width: 17px;
  height: 17px;
  margin-right: 0;
}

.landing-hero .button.primary:hover {
  border-color: #fff;
  color: #0c2435;
  background: #fff;
  box-shadow: 0 13px 32px rgba(0, 0, 0, 0.28);
}

.landing-hero .landing-credit {
  position: absolute;
  right: 20px;
  bottom: 14px;
  z-index: 1;
  max-width: none;
  margin: 0;
  color: rgba(255, 255, 255, 0.68);
  font-size: 11px;
  line-height: 1.5;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.72);
}

.landing-hero .landing-credit a {
  color: inherit;
  text-underline-offset: 2px;
}

.landing-hero .landing-credit a:hover {
  color: #fff;
}

@keyframes landing-content-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 700px) {
  .landing-hero {
    align-items: end;
    padding: 64px 22px 94px;
    background-image:
      linear-gradient(0deg, rgba(5, 17, 26, 0.88) 0%, rgba(5, 17, 26, 0.57) 48%, rgba(5, 17, 26, 0.18) 100%),
      url("https://m-1252909623.cos.ap-chongqing.myqcloud.com/cdn-static-20260805/cdn-static-20260805/root-portal/assets/maligne-lake.jpg"),
      url("/assets/images/landing-maligne-lake.jpg");
    background-position: 58% center;
  }

  .landing-brand {
    margin-bottom: 20px;
  }

  .landing-hero h1 {
    font-size: 48px;
    line-height: 1.04;
  }

  .landing-hero .hero-actions {
    margin-top: 26px;
  }

  .landing-hero .landing-credit {
    right: 18px;
    bottom: 12px;
    left: 18px;
    width: calc(100% - 36px);
    font-size: 10px;
    text-align: right;
    white-space: normal;
    overflow-wrap: anywhere;
  }
}

@media (prefers-reduced-motion: reduce) {
  .landing-hero > div {
    animation: none;
  }
}

/* Experimental public-health research workflow. */
.ph-page {
  width: min(1520px, 100%);
  margin: 0 auto;
  padding: 30px clamp(18px, 3vw, 42px) 52px;
  animation: fb-page-in 320ms ease-out both;
}

.ph-page svg,
.lit-evidence-panel svg,
.writing-head-actions svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.ph-page-head,
.ph-section-head,
.ph-project-bar,
.ph-source-panel header,
.ph-dataset-detail > header,
.ph-job-detail > header,
.ph-linked-evidence article header,
.ph-code-head,
.lit-evidence-head,
.writing-head-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.ph-page-head {
  align-items: flex-end;
  margin-bottom: 22px;
}

.ph-page-head h1 {
  margin: 3px 0 7px;
  font-size: 32px;
  line-height: 1.15;
  letter-spacing: 0;
}

.ph-page-head > div > span,
.ph-section-head p,
.ph-source-panel header p,
.ph-dataset-detail header p,
.ph-job-detail header p {
  margin: 0;
  color: var(--muted);
}

.ph-head-actions,
.ph-form-actions,
.mini-actions,
.download-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
}

.ph-page .button,
.ph-page .icon-button,
.writing-head-actions .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.ph-project-bar {
  position: relative;
  z-index: 5;
  min-height: 66px;
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  box-shadow: var(--shadow);
}

.ph-project-bar > label {
  display: grid;
  grid-template-columns: auto minmax(220px, 420px);
  align-items: center;
  gap: 10px;
  margin: 0;
}

.ph-project-bar label > span,
.ph-design-form label > span,
.ph-analysis-form label > span,
.lit-evidence-form label > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.ph-project-bar select,
.ph-project-bar input,
.ph-create-project select,
.ph-create-project input {
  width: 100%;
  min-height: 40px;
}

.ph-project-status {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.ph-create-project {
  position: relative;
}

.ph-create-project summary {
  min-height: 40px;
  list-style: none;
  cursor: pointer;
}

.ph-create-project summary::-webkit-details-marker {
  display: none;
}

.ph-create-project form {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 20;
  width: min(380px, calc(100vw - 36px));
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .16);
}

.ph-create-project form label,
.ph-source-panel > label,
.ph-source-options label,
.ph-design-form label,
.ph-analysis-form label,
.lit-evidence-form label {
  display: grid;
  align-content: start;
  gap: 7px;
  margin: 0;
  font-weight: 700;
}

.ph-flash {
  margin: 14px 0;
}

.ph-steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0 30px;
}

.ph-steps a {
  position: relative;
  min-width: 0;
  min-height: 72px;
  display: grid;
  grid-template-columns: 28px 22px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
  text-decoration: none;
  box-shadow: 0 2px 7px rgba(0, 0, 0, .07);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.ph-steps a:hover {
  border-color: rgba(33, 150, 243, .42);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .11);
  transform: translateY(-2px);
}

.ph-steps a.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(33, 150, 243, .12);
}

.ph-steps a > b {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--muted);
  background: #f0f2f3;
  font-size: 12px;
}

.ph-steps a.active > b {
  color: #fff;
  background: var(--accent);
}

.ph-steps a.done:not(.active) > b {
  color: #fff;
  background: #198754;
}

.ph-steps a > span {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 750;
}

.ph-step-check {
  color: #198754;
}

.ph-workspace {
  min-width: 0;
}

.ph-section-head {
  align-items: flex-start;
  margin-bottom: 18px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--line);
}

.ph-section-head h2,
.ph-source-panel h3,
.ph-dataset-detail h3,
.ph-job-detail h3,
.ph-writing-panel h3,
.ph-audit h3,
.ph-onboarding h2,
.lit-evidence-panel h2 {
  margin: 0 0 6px;
  letter-spacing: 0;
}

.ph-readiness,
.ph-section-head > span,
.ph-project-status,
.lit-evidence-head > span,
.workspace-tool-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px !important;
  color: var(--muted);
  background: #fff;
  font-size: 11px;
  font-weight: 750;
}

.ph-readiness.ready {
  border-color: rgba(25, 135, 84, .32);
  color: #11663f;
  background: rgba(25, 135, 84, .08);
}

.ph-design-form,
.ph-analysis-form,
.lit-evidence-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.ph-design-form .wide,
.ph-analysis-form .wide,
.lit-evidence-form .wide {
  grid-column: 1 / -1;
}

.ph-design-form input,
.ph-design-form select,
.ph-design-form textarea,
.ph-analysis-form select,
.lit-evidence-form input,
.lit-evidence-form select,
.lit-evidence-form textarea {
  width: 100%;
}

.ph-source-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr);
  gap: 16px;
}

.ph-source-panel,
.ph-dataset-detail,
.ph-job-detail,
.ph-literature-results,
.ph-linked-evidence,
.ph-writing-panel,
.ph-audit,
.lit-evidence-panel,
.ph-onboarding {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  box-shadow: var(--shadow);
}

.ph-source-panel {
  display: grid;
  align-content: start;
  gap: 14px;
}

.ph-source-panel header {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
}

.ph-source-panel header > svg {
  width: 38px;
  height: 38px;
  padding: 9px;
  border-radius: 7px;
  color: var(--accent);
  background: rgba(33, 150, 243, .09);
}

.ph-source-panel header a,
.ph-linked-evidence article > a {
  color: var(--accent-strong);
  font-weight: 700;
  text-decoration: none;
}

.ph-indicator-list {
  max-height: 350px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  overflow-y: auto;
  padding-right: 4px;
}

.ph-indicator-list label {
  min-width: 0;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fafafa;
  cursor: pointer;
}

.ph-indicator-list input {
  margin: 3px 0 0;
  accent-color: var(--accent);
}

.ph-indicator-list span,
.ph-indicator-list b,
.ph-indicator-list small,
.ph-dataset-list span,
.ph-dataset-list small,
.ph-job-list span,
.ph-job-list small,
.ph-literature-results article span,
.ph-literature-results article small {
  min-width: 0;
  display: block;
  overflow-wrap: anywhere;
}

.ph-indicator-list small,
.ph-dataset-list small,
.ph-job-list small,
.ph-literature-results article span,
.ph-literature-results article small,
.ph-linked-evidence article > span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.ph-source-options {
  display: grid;
  grid-template-columns: 1.3fr repeat(2, .7fr);
  gap: 10px;
}

.ph-dataset-layout,
.ph-analysis-layout {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 16px;
  margin-top: 18px;
}

.ph-dataset-list,
.ph-job-list {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ph-dataset-list a,
.ph-job-list a {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
  text-decoration: none;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.ph-dataset-list a:hover,
.ph-job-list a:hover,
.ph-dataset-list a.active,
.ph-job-list a.active {
  border-color: var(--accent);
  background: rgba(33, 150, 243, .06);
}

.ph-dataset-list a.active,
.ph-job-list a.active {
  transform: translateX(2px);
}

.ph-job-list a {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
}

.ph-job-list em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 750;
}

.ph-job-list .status-completed {
  color: #198754;
}

.ph-job-list .status-failed {
  color: var(--warn);
}

.ph-dataset-detail > header,
.ph-job-detail > header {
  align-items: flex-start;
  margin-bottom: 18px;
}

.ph-facts {
  display: grid;
  grid-template-columns: 1.5fr repeat(3, minmax(120px, .7fr));
  gap: 10px;
  margin-bottom: 22px;
}

.ph-facts > div {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7f8f8;
}

.ph-facts span,
.ph-facts b,
.ph-facts code {
  display: block;
}

.ph-facts span {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
}

.ph-facts code {
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ph-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.ph-table-wrap table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

.ph-table-wrap th,
.ph-table-wrap td {
  max-width: 360px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  text-align: left;
  overflow-wrap: anywhere;
}

.ph-table-wrap th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--muted);
  background: #f4f5f5;
  font-size: 12px;
  white-space: nowrap;
}

.ph-table-wrap tr:last-child td {
  border-bottom: 0;
}

.ph-table-wrap td small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
}

.ph-dataset-detail > h3,
.ph-result-table h4 {
  margin: 20px 0 10px;
}

.ph-analysis-form {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 20px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.ph-analysis-form select[multiple] {
  min-height: 120px;
}

.ph-analysis-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-left: 4px solid #198754;
  border-radius: 5px;
  color: #24533b;
  background: rgba(25, 135, 84, .07);
}

.ph-analysis-note p {
  margin: 0;
  line-height: 1.6;
}

.ph-result-plot {
  margin: 20px 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
}

.ph-result-plot img {
  width: 100%;
  max-height: 620px;
  display: block;
  object-fit: contain;
  background: #fff;
}

.ph-result-plot figcaption {
  padding: 8px 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}

.ph-code-result {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.ph-code-result > section {
  min-width: 0;
}

.ph-code-result h4,
.ph-code-head h4 {
  margin: 0 0 9px;
}

.ph-code-result pre {
  height: 420px;
  margin: 0;
  overflow: auto;
  padding: 14px;
  border: 1px solid rgba(0, 0, 0, .16);
  border-radius: 6px;
  color: #eef3f5;
  background: #263238;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.ph-copy.copied {
  color: #fff;
  background: #198754;
}

.ph-lit-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-bottom: 16px;
}

.ph-evidence-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.ph-literature-results,
.ph-linked-evidence {
  display: grid;
  align-content: start;
  gap: 10px;
}

.ph-literature-results > h3,
.ph-linked-evidence > h3 {
  margin: 0 0 5px;
}

.ph-literature-results article,
.ph-linked-evidence article {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fafafa;
}

.ph-literature-results article {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
}

.ph-literature-results article form {
  display: flex;
  align-items: center;
  gap: 7px;
}

.ph-linked-evidence article p {
  margin: 10px 0;
  line-height: 1.6;
}

.ph-readiness-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 9px;
  margin-bottom: 16px;
}

.ph-readiness-grid > div {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: #fff;
}

.ph-readiness-grid > div.done {
  border-color: rgba(25, 135, 84, .3);
  color: #11663f;
  background: rgba(25, 135, 84, .06);
}

.ph-readiness-grid span,
.ph-readiness-grid b,
.ph-readiness-grid small {
  min-width: 0;
  display: block;
  overflow-wrap: anywhere;
}

.ph-readiness-grid small {
  margin-top: 3px;
  font-size: 10px;
}

.ph-writing-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 28px;
}

.ph-writing-panel p,
.ph-writing-panel li {
  line-height: 1.65;
}

.ph-audit {
  margin-top: 16px;
}

.ph-audit > div {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr) 150px;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.ph-audit > div:last-child {
  border-bottom: 0;
}

.ph-audit code,
.ph-audit time {
  color: var(--muted);
  font-size: 11px;
}

.ph-empty,
.ph-onboarding {
  min-height: 280px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  text-align: center;
}

.ph-empty > svg,
.ph-onboarding > svg {
  width: 48px;
  height: 48px;
  color: var(--accent);
}

.ph-onboarding details form {
  width: min(520px, calc(100vw - 64px));
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.lit-evidence-panel {
  margin-top: 18px;
}

.lit-evidence-head {
  align-items: flex-start;
  margin-bottom: 16px;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--line);
}

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

.lit-evidence-readonly {
  padding: 14px;
  border-left: 4px solid var(--accent);
  background: rgba(33, 150, 243, .06);
}

.lit-matrix-view {
  max-width: none;
}

.lit-matrix-view .ph-table-wrap {
  max-height: calc(100vh - 260px);
}

.workspace-tool-badge {
  position: absolute;
  top: 10px;
  right: 38px;
  min-height: 21px;
  padding: 2px 7px;
  border-color: rgba(202, 138, 4, .28);
  color: #875b04;
  background: #fff8df;
  font-size: 10px;
}

.writing-head-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.writing-head-actions .button {
  min-height: 36px;
}

@media (max-width: 1120px) {
  .ph-source-grid,
  .ph-evidence-layout {
    grid-template-columns: 1fr;
  }

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

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

@media (max-width: 860px) {
  .ph-page-head,
  .ph-section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .ph-project-bar {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .ph-project-bar > label {
    width: 100%;
  }

  .ph-project-status {
    margin-left: 0;
  }

  .ph-steps {
    grid-template-columns: repeat(5, 172px);
    overflow-x: auto;
    padding-bottom: 6px;
  }

  .ph-dataset-layout,
  .ph-analysis-layout,
  .ph-code-result {
    grid-template-columns: 1fr;
  }

  .ph-dataset-list,
  .ph-job-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    overflow-x: auto;
  }

  .ph-code-result pre {
    height: 330px;
  }

  .ph-writing-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .ph-page {
    padding: 22px 12px 38px;
  }

  .ph-page-head h1 {
    font-size: 27px;
  }

  .ph-head-actions,
  .ph-head-actions .button {
    width: 100%;
  }

  .ph-project-bar > label,
  .ph-design-form,
  .ph-analysis-form,
  .lit-evidence-form,
  .ph-source-options,
  .ph-indicator-list,
  .ph-facts,
  .ph-readiness-grid,
  .ph-lit-search {
    grid-template-columns: 1fr;
  }

  .ph-design-form .wide,
  .ph-analysis-form .wide,
  .lit-evidence-form .wide {
    grid-column: auto;
  }

  .ph-create-project {
    width: 100%;
  }

  .ph-create-project summary {
    width: 100%;
  }

  .ph-create-project form {
    position: static;
    width: 100%;
    margin-top: 8px;
    box-shadow: none;
  }

  .ph-dataset-list,
  .ph-job-list {
    grid-template-columns: minmax(230px, 1fr);
  }

  .ph-literature-results article,
  .ph-audit > div {
    grid-template-columns: 1fr;
  }

  .ph-literature-results article form {
    align-items: stretch;
  }

  .ph-literature-results article form select {
    min-width: 0;
    width: 100%;
  }

  .ph-result-plot img {
    max-height: 420px;
  }

  .writing-head-actions {
    width: 100%;
    justify-content: space-between;
  }
}

/* Academic AI workflows */
.academic-workbench {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 30px clamp(14px, 3vw, 42px) 56px;
}

.academic-module-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 10px 0 26px;
  border-bottom: 3px solid var(--ink);
}

.academic-module-identity {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.academic-module-icon {
  width: 68px;
  height: 68px;
  flex: 0 0 68px;
  display: grid;
  place-items: center;
  border: 1px solid var(--ink);
  border-radius: 6px;
  color: #fff;
  background: var(--ink);
  box-shadow: 5px 5px 0 #aeb8bc;
}

.academic-module-icon svg {
  width: 31px;
  height: 31px;
}

.academic-module-identity p,
.academic-module-identity h1,
.academic-module-identity strong,
.academic-module-meta span,
.academic-band-title h2,
.academic-band-title p {
  margin: 0;
}

.academic-module-identity p {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 850;
}

.academic-module-identity p span {
  padding: 2px 6px;
  border: 1px solid #d2a846;
  border-radius: 3px;
  color: #76540c;
  background: #fff8df;
  font-size: 10px;
}

.academic-module-identity h1 {
  margin-top: 3px;
  font-size: 32px;
  line-height: 1.15;
  letter-spacing: 0;
}

.academic-module-identity strong {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.academic-module-meta {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.academic-module-meta span {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.academic-module-meta svg {
  width: 15px;
  height: 15px;
  color: var(--accent);
}

.academic-switcher {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.academic-switcher a {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 12px;
  border-left: 1px solid var(--line);
  border-top: 1px solid var(--line);
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 750;
  transition: background 150ms ease, color 150ms ease;
}

.academic-switcher a:hover {
  color: var(--ink);
  background: #f1f5f4;
}

.academic-switcher a.active {
  color: #fff;
  background: var(--accent);
}

.academic-switcher svg {
  width: 18px;
  height: 18px;
}

.academic-compose-band,
.academic-history-band,
.academic-result-band {
  padding: 27px 0 32px;
  border-bottom: 1px solid #aeb7bd;
}

.academic-band-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 21px;
}

.academic-band-title > div {
  display: flex;
  align-items: center;
  gap: 11px;
}

.academic-band-title > div > span {
  min-width: 30px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--ink);
  border-radius: 3px;
  color: #fff;
  background: var(--ink);
  font-size: 10px;
  font-weight: 900;
}

.academic-band-title h2 {
  font-size: 20px;
  letter-spacing: 0;
}

.academic-band-title > p {
  max-width: 760px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  text-align: right;
}

.academic-band-title.compact {
  align-items: center;
  margin-bottom: 14px;
}

.academic-form {
  padding: 22px;
  border: 1px solid var(--ink);
  border-radius: 6px;
  background: #fff;
  box-shadow: 5px 5px 0 #c4cbcf;
}

.academic-fields {
  display: grid;
  gap: 15px;
}

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

.academic-field {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 7px;
}

.academic-field-wide {
  grid-column: span 2;
}

.academic-field-full {
  grid-column: 1 / -1;
}

.academic-field > span {
  color: #3d494f;
  font-size: 12px;
  font-weight: 800;
}

.academic-field input,
.academic-field select,
.academic-field textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid #99a4aa;
  border-radius: 4px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  font-size: 14px;
  letter-spacing: 0;
}

.academic-field textarea {
  min-height: 88px;
  resize: vertical;
  line-height: 1.65;
}

.academic-field input:focus,
.academic-field select:focus,
.academic-field textarea:focus {
  outline: 2px solid rgba(12, 122, 117, .18);
  outline-offset: 1px;
}

.academic-upload {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 15px;
  padding: 0 13px;
  border: 1px dashed #87949a;
  border-radius: 4px;
  color: var(--muted);
  background: #f8faf9;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.academic-upload:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.academic-upload input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.academic-upload svg,
.academic-boundary svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

.academic-source-picker {
  margin-top: 15px;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.academic-source-picker summary {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 13px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  list-style: none;
}

.academic-source-picker summary::-webkit-details-marker {
  display: none;
}

.academic-source-picker summary svg {
  width: 17px;
  height: 17px;
  color: var(--accent);
}

.academic-source-picker summary b {
  margin-left: auto;
  color: var(--muted);
  font-size: 11px;
}

.academic-source-options {
  max-height: 330px;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  padding: 1px;
  border-top: 1px solid var(--line);
  background: var(--line);
}

.academic-source-options > label {
  min-width: 0;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 9px;
  padding: 11px;
  background: #fff;
  cursor: pointer;
}

.academic-source-options > label:hover {
  background: #f3f8f6;
}

.academic-source-options input {
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: var(--accent);
}

.academic-source-options label span,
.academic-source-options label strong,
.academic-source-options label small {
  min-width: 0;
  display: block;
}

.academic-source-options label strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.academic-source-options label small {
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.academic-source-options > p {
  grid-column: 1 / -1;
  margin: 0;
  padding: 18px;
  background: #fff;
  color: var(--muted);
}

.academic-boundary {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 15px 0 0;
  padding: 10px 12px;
  border-left: 3px solid var(--accent);
  color: #49565c;
  background: #eef6f4;
  font-size: 12px;
  line-height: 1.6;
}

.academic-submit-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 13px;
  margin-top: 17px;
}

.academic-submit-row > span {
  margin-right: auto;
  color: var(--muted);
  font-size: 11px;
}

.academic-submit-row .button {
  min-width: 152px;
  min-height: 42px;
  gap: 8px;
}

.academic-submit-row svg {
  width: 17px;
  height: 17px;
}

.academic-submit-row button:disabled {
  opacity: .65;
  cursor: wait;
}

.academic-submit-row button:disabled svg,
.academic-running > svg,
.academic-job-state.running svg {
  animation: academic-spin 900ms linear infinite;
}

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

.academic-error {
  margin: 13px 0 0;
  padding: 10px 12px;
  border: 1px solid #d39a92;
  border-radius: 4px;
  color: #8d2820;
  background: #fff2f0;
  font-size: 12px;
}

.academic-history-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 10px;
}

.academic-history-item {
  min-width: 0;
  min-height: 67px;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  text-decoration: none;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.academic-history-item:hover,
.academic-history-item.active {
  border-color: var(--ink);
  box-shadow: 3px 3px 0 #c5cccf;
  transform: translate(-1px, -1px);
}

.academic-history-item.active {
  background: #f3f8f6;
}

.academic-job-state {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  background: #f7f8fa;
}

.academic-job-state.completed {
  border-color: #8ac0a7;
  color: #146a45;
  background: #edf8f2;
}

.academic-job-state.failed {
  border-color: #d4a19a;
  color: #9a3026;
  background: #fff1ef;
}

.academic-job-state svg {
  width: 15px;
  height: 15px;
}

.academic-history-item > span:nth-child(2),
.academic-history-item strong,
.academic-history-item small {
  min-width: 0;
  display: block;
}

.academic-history-item strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.academic-history-item small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.academic-history-item > b {
  color: var(--muted);
  font-size: 10px;
}

.academic-empty-row,
.academic-result-empty {
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px dashed #aeb7bd;
  color: var(--muted);
  background: rgba(255, 255, 255, .55);
}

.academic-empty-row svg,
.academic-result-empty svg {
  width: 22px;
  height: 22px;
}

.academic-result-empty h3 {
  margin: 0;
  font-size: 14px;
}

.academic-result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 0;
  border-top: 1px solid var(--ink);
}

.academic-result-head h2,
.academic-result-head p {
  margin: 0;
}

.academic-result-head h2 {
  margin-top: 7px;
  font-size: 21px;
  letter-spacing: 0;
}

.academic-result-head p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.academic-status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  border: 1px solid #9ca8ad;
  border-radius: 3px;
  color: var(--muted);
  background: #fff;
  font-size: 10px;
  font-weight: 850;
}

.academic-status-pill.completed {
  border-color: #69aa89;
  color: #12623f;
  background: #edf8f2;
}

.academic-status-pill.failed {
  border-color: #cc8f87;
  color: #942b23;
  background: #fff1ef;
}

.academic-result-metrics {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.academic-result-metrics span {
  min-height: 31px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #fff;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.academic-result-metrics svg {
  width: 14px;
  height: 14px;
  color: var(--accent);
}

.academic-progress {
  height: 5px;
  overflow: hidden;
  border: 1px solid #aeb8bc;
  background: #e8edef;
}

.academic-progress i {
  height: 100%;
  display: block;
  background: var(--accent);
  transition: width 240ms ease;
}

.academic-running {
  min-height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
}

.academic-running > svg {
  width: 24px;
  height: 24px;
  color: var(--accent);
}

.academic-running strong {
  margin-right: 4px;
  color: var(--ink);
  font-size: 13px;
}

.academic-running > span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  animation: academic-pulse 1s ease-in-out infinite;
}

.academic-running > span:nth-last-child(2) { animation-delay: 150ms; }
.academic-running > span:nth-last-child(1) { animation-delay: 300ms; }

@keyframes academic-pulse {
  0%, 100% { opacity: .25; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-3px); }
}

.academic-failed {
  min-height: 120px;
  display: flex;
  align-items: flex-start;
  gap: 13px;
  margin-top: 18px;
  padding: 18px;
  border: 1px solid #d4a19a;
  border-radius: 4px;
  color: #7e2d25;
  background: #fff4f2;
}

.academic-failed svg {
  width: 23px;
  height: 23px;
}

.academic-failed strong,
.academic-failed p {
  margin: 0;
}

.academic-failed p {
  margin-top: 5px;
  font-size: 12px;
  line-height: 1.6;
}

.academic-result-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.academic-result-actions .button,
.academic-result-actions .icon-button {
  min-height: 36px;
  gap: 7px;
}

.academic-result-actions svg {
  width: 16px;
  height: 16px;
}

.academic-result-actions .danger {
  color: #9b3028;
}

.academic-output {
  min-height: 240px;
  max-height: 900px;
  overflow: auto;
  padding: clamp(18px, 3vw, 38px);
  border-right: 1px solid #aeb8bc;
  border-bottom: 1px solid #aeb8bc;
  border-left: 1px solid #aeb8bc;
  color: #202a2f;
  background: #fff;
  font-family: Georgia, "Noto Serif SC", "Source Han Serif SC", serif;
  font-size: 15px;
  line-height: 1.85;
  overflow-wrap: anywhere;
}

.academic-output h2,
.academic-output h3,
.academic-output h4,
.academic-output h5,
.academic-output h6 {
  margin: 1.5em 0 .65em;
  font-family: Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  letter-spacing: 0;
  line-height: 1.35;
}

.academic-output h2:first-child,
.academic-output h3:first-child {
  margin-top: 0;
}

.academic-output h2 {
  padding-bottom: 8px;
  border-bottom: 2px solid var(--ink);
  font-size: 21px;
}

.academic-output h3 { font-size: 18px; }
.academic-output h4 { font-size: 15px; }
.academic-output h5,
.academic-output h6 { font-size: 14px; }

.academic-output p {
  margin: .8em 0;
}

.academic-output ul,
.academic-output ol {
  margin: .9em 0;
  padding-left: 1.6em;
}

.academic-output li {
  margin: .35em 0;
  padding-left: .2em;
}

.academic-output blockquote {
  margin: 1.1em 0;
  padding: 2px 0 2px 16px;
  border-left: 4px solid var(--accent);
  color: #4a5a61;
  background: #f4f8f7;
}

.academic-output blockquote p {
  margin: .65em 12px;
}

.academic-output hr {
  margin: 1.7em 0;
  border: 0;
  border-top: 1px solid #c8d0d3;
}

.academic-output a {
  color: var(--accent-strong);
  text-underline-offset: 3px;
}

.academic-output code {
  padding: 1px 4px;
  border-radius: 3px;
  background: #edf1f2;
  font-family: Consolas, monospace;
  font-size: .9em;
}

.academic-output pre {
  max-width: 100%;
  margin: 1.1em 0;
  overflow: auto;
  padding: 15px 16px;
  border: 1px solid #2f3a3f;
  border-radius: 3px;
  color: #edf4f2;
  background: #1d272b;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 13px;
  line-height: 1.65;
  tab-size: 2;
}

.academic-output pre code {
  padding: 0;
  color: inherit;
  background: transparent;
  font-size: inherit;
  white-space: pre;
}

.academic-table-scroll {
  max-width: 100%;
  margin: 1.25em 0;
  overflow-x: auto;
  border: 1px solid #b8c2c6;
}

.academic-output table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  background: #fff;
  font-family: Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  font-size: 12px;
  line-height: 1.55;
}

.academic-output th,
.academic-output td {
  padding: 10px 11px;
  border-right: 1px solid #d6dcdf;
  border-bottom: 1px solid #d6dcdf;
  text-align: left;
  vertical-align: top;
}

.academic-output th:last-child,
.academic-output td:last-child {
  border-right: 0;
}

.academic-output tr:last-child td {
  border-bottom: 0;
}

.academic-output th {
  color: #162126;
  background: #eaf2f0;
  font-weight: 800;
}

.academic-output tbody tr:nth-child(even) {
  background: #f7f9f9;
}

.academic-figure-preview {
  margin: 18px 0 0;
  border: 1px solid #aeb8bc;
  background: #fff;
}

.academic-figure-preview img {
  width: 100%;
  max-height: 680px;
  display: block;
  object-fit: contain;
  background: #fff;
}

.academic-figure-preview figcaption {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}

.academic-figure-preview a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-strong);
  font-weight: 800;
  text-decoration: none;
}

.academic-figure-preview svg {
  width: 15px;
  height: 15px;
}

.academic-sources {
  margin-top: 20px;
  border-top: 2px solid var(--ink);
}

.academic-sources > header {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 9px;
}

.academic-sources > header svg {
  width: 18px;
  height: 18px;
  color: var(--accent);
}

.academic-sources > header h3 {
  margin: 0;
  font-size: 15px;
}

.academic-sources > header span {
  min-width: 24px;
  height: 21px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--muted);
  background: #fff;
  font-size: 10px;
  font-weight: 800;
}

.academic-sources > div {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  padding: 1px;
  background: var(--line);
}

.academic-sources a {
  min-width: 0;
  min-height: 72px;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: #fff;
  text-decoration: none;
}

.academic-sources a:hover {
  background: #f2f7f5;
}

.academic-sources a > b {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  border: 1px solid var(--accent);
  border-radius: 3px;
  color: var(--accent-strong);
  background: #eaf5f2;
  font-size: 10px;
}

.academic-sources a > span,
.academic-sources a strong,
.academic-sources a small {
  min-width: 0;
  display: block;
}

.academic-sources a strong {
  display: -webkit-box;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.academic-sources a small {
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.academic-sources a > svg {
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.academic-license-note {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 17px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.6;
}

.academic-license-note svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

@media (max-width: 980px) {
  .academic-module-head,
  .academic-band-title,
  .academic-result-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .academic-module-meta,
  .academic-result-metrics {
    justify-content: flex-start;
  }

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

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

  .academic-field-wide {
    grid-column: span 1;
  }

  .academic-band-title > p {
    max-width: none;
    text-align: left;
  }

  .academic-source-options,
  .academic-sources > div {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 620px) {
  .academic-workbench {
    padding: 18px 10px 36px;
  }

  .academic-module-head {
    gap: 16px;
    padding-bottom: 20px;
  }

  .academic-module-identity {
    align-items: flex-start;
    gap: 13px;
  }

  .academic-module-icon {
    width: 50px;
    height: 50px;
    flex-basis: 50px;
    box-shadow: 3px 3px 0 #aeb8bc;
  }

  .academic-module-icon svg {
    width: 24px;
    height: 24px;
  }

  .academic-module-identity h1 {
    font-size: 24px;
  }

  .academic-module-meta span {
    flex: 1 1 150px;
    justify-content: center;
  }

  .academic-switcher a {
    min-height: 48px;
    font-size: 11px;
  }

  .academic-switcher svg {
    width: 16px;
    height: 16px;
  }

  .academic-compose-band,
  .academic-history-band,
  .academic-result-band {
    padding-block: 22px;
  }

  .academic-form {
    padding: 14px;
    box-shadow: 3px 3px 0 #c4cbcf;
  }

  .academic-fields-3 {
    grid-template-columns: minmax(0, 1fr);
  }

  .academic-field-wide,
  .academic-field-full {
    grid-column: 1;
  }

  .academic-submit-row {
    align-items: stretch;
    flex-direction: column;
  }

  .academic-submit-row > span {
    margin-right: 0;
  }

  .academic-submit-row .button {
    width: 100%;
  }

  .academic-history-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .academic-result-actions {
    justify-content: flex-start;
  }

  .academic-result-actions .button {
    flex: 1 1 130px;
  }

  .academic-output {
    padding: 17px 14px;
    font-size: 14px;
  }

  .academic-figure-preview figcaption {
    align-items: flex-start;
    flex-direction: column;
    padding-block: 10px;
  }
}

/* Workspace header polish. */
.workspace-welcome > #workspaceClock {
  padding: 0;
  border: 0;
  border-radius: 0 !important;
  background: transparent;
  box-shadow: none;
}

.account-button {
  border-color: rgba(33, 150, 243, 0.28);
  background: #edf7ff;
}

.account-button:hover,
.account-nav[open] .account-button {
  border-color: rgba(33, 150, 243, 0.46);
  background: #e1f1fd;
}

/* AI conversation workspace. */
.chat-body {
  overflow: hidden;
  background: #f3f5f6;
}

.chat-shell {
  min-height: 100vh;
  min-height: 100svh;
}

.chat-topbar {
  position: relative;
  z-index: 40;
}

.chat-page {
  height: calc(100vh - 70px);
  height: calc(100svh - 70px);
  min-height: 520px;
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
  overflow: hidden;
  border-top: 1px solid var(--line);
  background: #fff;
}

.chat-sidebar {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: hidden;
  padding: 20px 16px 16px;
  border-right: 1px solid var(--line);
  background: #f5f7f8;
}

.chat-sidebar-head,
.chat-main-head,
.chat-title-line,
.chat-meta,
.chat-head-actions,
.chat-message header,
.chat-message footer {
  display: flex;
  align-items: center;
}

.chat-sidebar-head {
  justify-content: space-between;
  gap: 12px;
}

.chat-sidebar-head span {
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.chat-sidebar-head h1 {
  margin: 2px 0 0;
  font-size: 22px;
}

.chat-sidebar-close,
.chat-sidebar-open {
  display: none;
}

.chat-mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #e9edef;
}

.chat-mode-switch button {
  min-width: 0;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  border-radius: 5px;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}

.chat-mode-switch button.active {
  color: var(--ink);
  background: #fff;
  box-shadow: 0 1px 4px rgba(28, 39, 49, 0.12);
}

.chat-mode-switch svg,
.chat-new svg {
  width: 16px;
  height: 16px;
}

.chat-new {
  width: 100%;
}

.chat-conversation-list {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 5px;
  overflow-y: auto;
  padding-right: 2px;
}

.chat-conversation-list > a {
  min-width: 0;
  display: grid;
  gap: 7px;
  padding: 11px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--ink);
  text-decoration: none;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.chat-conversation-list > a:hover {
  border-color: #cdd5da;
  background: #fff;
  transform: translateX(2px);
}

.chat-conversation-list > a.active {
  border-color: #9dc9c3;
  background: #e8f4f2;
}

.chat-conversation-list strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-conversation-list span {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 10px;
}

.chat-conversation-list b {
  overflow: hidden;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-list-empty {
  margin: 18px 8px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.chat-main {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  background: #fbfcfc;
}

.chat-main-head {
  min-width: 0;
  min-height: 78px;
  gap: 13px;
  padding: 12px clamp(16px, 3vw, 34px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

.chat-title-block {
  min-width: 0;
  flex: 1;
}

.chat-title-line {
  min-width: 0;
  gap: 7px;
}

.chat-title-line h2 {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  font-size: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-title-line .icon-button {
  width: 30px;
  height: 30px;
  min-width: 30px;
  flex-basis: 30px;
  border: 0;
  background: transparent;
}

.chat-meta {
  min-width: 0;
  gap: 7px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}

.chat-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-meta span + span::before {
  content: "·";
  margin-right: 7px;
}

.chat-head-actions {
  flex: 0 0 auto;
  gap: 7px;
}

.chat-head-actions [aria-disabled="true"] {
  opacity: 0.42;
  pointer-events: none;
}

.danger-icon {
  color: #a63b3b;
}

.danger-icon:hover {
  border-color: #e3a3a3;
  color: #8f2929;
  background: #fff0f0;
}

.chat-messages {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
  padding: 30px max(24px, calc((100% - 940px) / 2)) 36px;
  scroll-behavior: smooth;
}

.chat-empty {
  min-height: 100%;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  color: var(--muted);
  text-align: center;
}

.chat-empty svg {
  width: 34px;
  height: 34px;
  margin-bottom: 4px;
  color: var(--accent);
}

.chat-empty strong {
  color: var(--ink);
  font-size: 17px;
}

.chat-empty span {
  font-size: 12px;
}

.chat-message {
  width: min(760px, 86%);
  display: grid;
  gap: 9px;
  padding: 14px 16px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 3px 11px rgba(28, 39, 49, 0.06);
  animation: chat-message-in 180ms ease-out both;
}

.chat-message.user {
  align-self: flex-end;
  border-color: #28333a;
  color: #fff;
  background: #28333a;
}

.chat-message.assistant {
  align-self: flex-start;
  border-left: 4px solid var(--accent);
}

.chat-message.pending {
  opacity: 0.68;
}

.chat-message header,
.chat-message footer {
  justify-content: space-between;
  gap: 10px;
}

.chat-message header {
  color: var(--muted);
  font-size: 11px;
}

.chat-message.user header,
.chat-message.user footer {
  color: rgba(255, 255, 255, 0.68);
}

.chat-message header span {
  font-weight: 800;
}

.chat-message-content {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.75;
  white-space: pre-wrap;
}

.chat-message footer {
  min-height: 30px;
  color: var(--muted);
  font-size: 10px;
}

.chat-copy {
  width: 28px;
  height: 28px;
  min-width: 28px;
  flex-basis: 28px;
  border: 0;
  color: inherit;
  background: transparent;
}

.chat-message.user .chat-copy:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.chat-copy.copied {
  color: var(--accent);
}

.chat-error {
  margin: 0 max(24px, calc((100% - 940px) / 2)) 8px;
  padding: 9px 12px;
  border-left: 3px solid #c64d4d;
  color: #8f2929;
  background: #fff0f0;
  font-size: 12px;
}

.chat-composer {
  width: min(940px, calc(100% - 48px));
  min-height: 58px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  align-items: end;
  gap: 10px;
  margin: 0 auto 20px;
  padding: 8px 8px 8px 14px;
  border: 1px solid #aebbc2;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 6px 20px rgba(28, 39, 49, 0.10);
}

.chat-composer:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(12, 122, 117, 0.11), 0 7px 22px rgba(28, 39, 49, 0.10);
}

.chat-composer textarea {
  width: 100%;
  max-height: 160px;
  resize: none;
  overflow-y: auto;
  padding: 10px 0 8px;
  border: 0 !important;
  outline: 0;
  background: transparent !important;
  box-shadow: none !important;
  font: inherit;
  line-height: 1.55;
}

.chat-send {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 7px;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
  transition: background 150ms ease, transform 150ms ease;
}

.chat-send:hover {
  background: var(--accent-strong);
  transform: translateY(-1px);
}

.chat-send:disabled {
  opacity: 0.48;
  cursor: wait;
  transform: none;
}

.chat-send svg {
  width: 19px;
  height: 19px;
}

.chat-sidebar-backdrop {
  display: none;
}

@keyframes chat-message-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 820px) {
  .chat-body {
    overflow: hidden;
  }

  .chat-topbar {
    min-height: 64px;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
  }

  .chat-topbar .account-nav {
    width: auto;
  }

  .chat-topbar .account-menu {
    right: 0;
    left: auto;
    width: min(260px, calc(100vw - 24px));
  }

  .chat-page {
    grid-template-columns: minmax(0, 1fr);
  }

  .chat-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 80;
    width: min(326px, 88vw);
    border-right: 1px solid var(--line);
    box-shadow: 12px 0 34px rgba(18, 28, 34, 0.20);
    transform: translateX(-105%);
    transition: transform 180ms ease;
  }

  .chat-sidebar-visible .chat-sidebar {
    transform: translateX(0);
  }

  .chat-sidebar-close,
  .chat-sidebar-open {
    display: inline-grid;
  }

  .chat-sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 70;
    border: 0;
    background: rgba(15, 23, 27, 0.34);
  }

  .chat-sidebar-visible .chat-sidebar-backdrop {
    display: block;
  }

  .chat-main-head {
    min-height: 72px;
    padding: 10px 14px;
  }

  .chat-title-line h2 {
    font-size: 16px;
  }

  .chat-meta span:nth-child(2) {
    display: none;
  }

  .chat-head-actions {
    gap: 4px;
  }

  .chat-head-actions .icon-button {
    width: 34px;
    height: 34px;
    min-width: 34px;
    flex-basis: 34px;
  }

  .chat-messages {
    padding: 22px 14px 28px;
  }

  .chat-message {
    width: min(92%, 680px);
    padding: 12px 13px 8px;
  }

  .chat-composer {
    width: calc(100% - 24px);
    margin-bottom: 12px;
  }

  .chat-error {
    margin-right: 12px;
    margin-left: 12px;
  }
}

@media (max-width: 520px) {
  .chat-topbar {
    min-height: 64px;
  }

  .chat-topbar .account-button {
    min-height: 38px;
    gap: 0;
    padding: 0 7px;
  }

  .chat-topbar .account-button > span {
    display: none;
  }

  .chat-page {
    height: calc(100vh - 64px);
    height: calc(100svh - 64px);
  }

  .chat-title-line .icon-button,
  #exportJson {
    display: none;
  }

  .chat-message {
    width: 94%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-message {
    animation: none;
  }

  .chat-sidebar,
  .chat-send,
  .chat-conversation-list > a {
    transition: none;
  }
}

/* AI conversation workspace v2. */
.chat-history-search {
  min-height: 40px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: #fff;
}

.chat-history-search svg {
  width: 16px;
  height: 16px;
}

.chat-history-search input {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  box-shadow: none;
}

.chat-message header {
  justify-content: flex-start;
}

.chat-message header > time {
  margin-left: auto;
}

.chat-message-badges {
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
}

.chat-message-badges > span {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border: 1px solid #cbd8d4;
  border-radius: 999px;
  color: #35605a;
  background: #f2f8f6;
  font-size: 10px;
  font-weight: 750;
}

.chat-message-badges svg {
  width: 12px;
  height: 12px;
}

.chat-reasoning {
  min-width: 0;
  border-top: 1px solid #e0e5e8;
}

.chat-reasoning summary {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: #6c5622;
  cursor: pointer;
  list-style: none;
  font-size: 12px;
  font-weight: 750;
}

.chat-reasoning summary::-webkit-details-marker {
  display: none;
}

.chat-reasoning summary svg {
  width: 15px;
  height: 15px;
}

.chat-reasoning summary small {
  margin-left: auto;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
}

.chat-reasoning > div {
  max-height: 320px;
  overflow: auto;
  padding: 0 2px 12px;
  color: #5f6164;
  font-size: 12px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.chat-sources {
  min-width: 0;
  border-top: 1px solid #e0e5e8;
}

.chat-sources h3 {
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.chat-sources h3 svg {
  width: 15px;
  height: 15px;
}

.chat-sources > div {
  display: grid;
  gap: 1px;
  overflow: hidden;
  border: 1px solid #e1e5e8;
  border-radius: 6px;
  background: #e1e5e8;
}

.chat-sources a {
  min-width: 0;
  min-height: 38px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  color: var(--ink);
  background: #fafcfc;
  text-decoration: none;
}

.chat-sources a:hover {
  background: #f0f6f5;
}

.chat-sources a > b {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: #426d67;
  font-size: 10px;
}

.chat-sources a > span {
  min-width: 0;
  overflow: hidden;
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-sources a > small {
  color: var(--muted);
  font-size: 9px;
  white-space: nowrap;
}

.chat-prompt-grid {
  width: min(600px, calc(100vw - 56px));
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.chat-prompt-grid button {
  min-width: 0;
  min-height: 74px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  font-size: 12px;
  font-weight: 750;
  text-align: left;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.chat-prompt-grid button:hover {
  border-color: #9ebdb8;
  background: #f4f9f8;
  transform: translateY(-2px);
}

.chat-prompt-grid svg {
  width: 24px;
  height: 24px;
  color: var(--accent);
}

.chat-composer {
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  gap: 0;
  padding: 0;
  overflow: hidden;
}

.chat-composer-tools {
  min-width: 0;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 8px;
  border-bottom: 1px solid #e3e7ea;
  background: #f8faf9;
}

.chat-capability {
  flex: 0 0 auto;
  margin: 0;
  cursor: pointer;
}

.chat-capability input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.chat-capability > span {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-size: 11px;
  font-weight: 750;
  transition: border-color 140ms ease, color 140ms ease, background 140ms ease;
}

.chat-capability > span:hover {
  background: #edf1f1;
}

.chat-capability input:checked + span {
  border-color: #9fc7c0;
  color: #165d56;
  background: #e8f5f2;
}

.chat-capability input:focus-visible + span {
  outline: 3px solid rgba(12, 122, 117, 0.16);
  outline-offset: 1px;
}

.chat-capability input:disabled + span {
  opacity: 0.55;
  cursor: wait;
}

.chat-capability svg {
  width: 15px;
  height: 15px;
}

.chat-request-status {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  color: var(--muted);
  font-size: 10px;
}

.chat-request-status[hidden] {
  display: none;
}

.chat-request-status svg,
.chat-pending-body svg {
  width: 15px;
  height: 15px;
  color: var(--accent);
  animation: chat-spin 900ms linear infinite;
}

.chat-request-status time {
  min-width: 23px;
  text-align: right;
}

.chat-composer-row {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: end;
  gap: 7px;
  padding: 8px;
}

.chat-composer-row textarea {
  padding: 10px 6px 8px;
}

.chat-stop,
.chat-send {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
}

.chat-stop {
  color: #924242;
  background: #f8e9e9;
}

.chat-stop[hidden] {
  display: none;
}

.chat-stop svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.chat-pending-body {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
}

.chat-pending-body b {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #8aa39f;
  animation: chat-dot 1.15s ease-in-out infinite;
}

.chat-pending-body b:nth-of-type(2) {
  animation-delay: 130ms;
}

.chat-pending-body b:nth-of-type(3) {
  animation-delay: 260ms;
}

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

@keyframes chat-dot {
  0%, 70%, 100% { opacity: 0.32; transform: translateY(0); }
  35% { opacity: 1; transform: translateY(-3px); }
}

@media (max-width: 820px) {
  .chat-prompt-grid {
    grid-template-columns: 1fr;
    width: min(360px, calc(100vw - 44px));
  }

  .chat-prompt-grid button {
    min-height: 52px;
  }

  .chat-composer {
    width: calc(100% - 16px);
    margin-bottom: 8px;
  }

  .chat-composer-tools {
    overflow-x: auto;
  }

  .chat-request-status span {
    max-width: 94px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .chat-sources a {
    grid-template-columns: 22px minmax(0, 1fr);
  }

  .chat-sources a > small {
    display: none;
  }
}

@media (max-width: 520px) {
  .chat-message {
    width: 98%;
  }

  .chat-message-badges > span {
    padding: 2px 5px;
  }

  .chat-capability > span {
    padding: 4px 7px;
  }

  .chat-request-status {
    margin-left: 2px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-request-status svg,
  .chat-pending-body svg,
  .chat-pending-body b {
    animation: none;
  }
}

/* Literature and knowledge workspace v2. */
.literature-hub {
  width: min(1600px, 100%);
  margin: 0 auto;
  padding: 28px clamp(16px, 3vw, 42px) 48px;
}

.lit-page-head,
.lit-page-actions,
.lit-library-stats,
.lit-acquisition summary,
.lit-acquisition form header,
.lit-ai-workbench > header,
.lit-ai-workbench > header > div,
.lit-ai-actions,
.lit-ai-status > div,
.lit-ai-tags,
.lit-ai-guide summary {
  display: flex;
  align-items: center;
}

.lit-page-head {
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.lit-page-head h1 {
  margin: 3px 0 0;
  font-size: 31px;
  line-height: 1.15;
  letter-spacing: 0;
}

.lit-page-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.lit-page-actions .button,
.lit-ai-actions .button,
.lit-retry-form .button,
.lit-detail-head .button,
.lit-empty-v2 .button,
.lit-acquisition .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.lit-page-actions svg,
.lit-ai-actions svg,
.lit-detail-head .button svg,
.lit-empty-v2 .button svg,
.lit-retry-form svg,
.lit-acquisition button svg {
  width: 17px;
  height: 17px;
}

.lit-library-stats {
  min-height: 70px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.lit-library-stats > div {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
}

.lit-library-stats > div + div {
  border-left: 1px solid var(--line);
}

.lit-library-stats span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.lit-library-stats b {
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}

.lit-flash {
  margin: 0 0 14px;
}

.lit-acquisition {
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.lit-acquisition > summary {
  min-height: 52px;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  cursor: pointer;
  list-style: none;
  font-weight: 800;
}

.lit-acquisition > summary::-webkit-details-marker {
  display: none;
}

.lit-acquisition > summary > span {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.lit-acquisition > summary svg {
  width: 18px;
  height: 18px;
  color: var(--accent);
  transition: transform 160ms ease;
}

.lit-acquisition[open] > summary > svg {
  transform: rotate(180deg);
}

.lit-acquisition-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 0 14px 14px;
  border-top: 1px solid #edf0f2;
}

.lit-acquisition form {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 9px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fafbfb;
}

.lit-acquisition form header {
  min-height: 40px;
  gap: 10px;
}

.lit-acquisition form header > svg {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  padding: 8px;
  border-radius: 7px;
  color: var(--accent);
  background: #e9f4f2;
}

.lit-acquisition form header b,
.lit-acquisition form header span {
  display: block;
}

.lit-acquisition form header span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.lit-acquisition input,
.lit-acquisition select {
  width: 100%;
  min-width: 0;
  min-height: 40px;
}

.lit-acquisition input[type="file"] {
  padding: 7px;
  font-size: 11px;
}

.lit-inline-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.literature-hub > .literature-page {
  min-height: 720px;
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.literature-hub .lit-sidebar {
  position: sticky;
  top: 78px;
  align-self: start;
  height: calc(100vh - 98px);
  min-height: 620px;
  padding: 16px;
  background: #f5f7f8;
}

.literature-hub .lit-title h2 {
  font-size: 19px;
}

.literature-hub .lit-title > span {
  border-radius: 6px;
  color: #315a55;
  background: #e7f2f0;
}

.lit-filter-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 9px;
}

.lit-search-row {
  min-height: 42px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 7px;
  padding: 0 4px 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: #fff;
}

.lit-search-row > svg {
  width: 16px;
  height: 16px;
}

.lit-search-row input {
  min-width: 0;
  min-height: 40px;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  box-shadow: none;
}

.lit-search-row .icon-button {
  width: 32px;
  height: 32px;
  min-width: 32px;
  flex-basis: 32px;
  border: 0;
  color: #fff;
  background: var(--accent);
}

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

.lit-filter-grid select {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  padding: 0 7px;
  border-radius: 6px;
  font-size: 11px;
}

.lit-filter-grid .icon-button {
  width: 100%;
  min-width: 0;
  height: 36px;
  flex-basis: auto;
  color: var(--muted);
  background: #fff;
}

.literature-hub .lit-tags {
  max-height: 74px;
  overflow: auto;
  gap: 5px;
}

.literature-hub .lit-tags a {
  min-height: 27px;
  padding: 4px 7px;
  border-radius: 5px;
  font-size: 10px;
}

.literature-hub .lit-tags a.active {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

.literature-hub .lit-list {
  gap: 6px;
}

.literature-hub .lit-item {
  gap: 5px;
  padding: 11px;
  border-radius: 7px;
  box-shadow: none;
}

.literature-hub .lit-item:hover {
  border-color: #b4c8c5;
  transform: translateX(2px);
}

.literature-hub .lit-item strong {
  font-size: 12px;
}

.literature-hub .lit-item > small {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 5px;
}

.literature-hub .lit-item > small > b {
  flex: 0 0 auto;
  padding: 2px 5px;
  border-radius: 4px;
  color: #315a55;
  background: #e7f2f0;
  font-size: 9px;
}

.literature-hub .lit-item > small > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.literature-hub .lit-main {
  min-width: 0;
  padding: 22px;
  background: #fff;
}

.lit-detail-v2 {
  min-width: 0;
  gap: 18px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.lit-detail-v2 .lit-detail-head {
  align-items: flex-start;
  padding-bottom: 17px;
  border-bottom: 1px solid var(--line);
}

.lit-detail-v2 .lit-detail-head h1 {
  font-size: 27px;
  letter-spacing: 0;
}

.lit-detail-head .mini-actions {
  justify-content: flex-end;
}

.lit-detail-head .mini-actions form {
  margin: 0;
}

.lit-detail-v2 .lit-meta-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.lit-detail-v2 .lit-meta-grid div {
  min-height: 66px;
  border-radius: 6px;
  box-shadow: none;
}

.lit-ai-workbench {
  min-width: 0;
  padding: 17px;
  border: 1px solid #c9d9d6;
  border-radius: 7px;
  background: #f8fbfa;
}

.lit-ai-workbench > header {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.lit-ai-workbench > header > div {
  min-width: 0;
  gap: 11px;
}

.lit-ai-workbench > header > div > svg {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  padding: 9px;
  border-radius: 7px;
  color: #fff;
  background: #315f59;
}

.lit-ai-workbench h2 {
  margin: 2px 0 0;
  font-size: 18px;
  letter-spacing: 0;
}

.lit-ai-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.lit-ai-actions button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.lit-ai-status {
  display: grid;
  gap: 7px;
  margin: 10px 0;
}

.lit-ai-status[hidden] {
  display: none;
}

.lit-ai-status > div {
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 11px;
}

.lit-ai-status progress {
  width: 100%;
  height: 7px;
  overflow: hidden;
  border: 0;
  border-radius: 4px;
  background: #dfe8e6;
  accent-color: var(--accent);
}

.lit-ai-status progress::-webkit-progress-bar {
  background: #dfe8e6;
}

.lit-ai-status progress::-webkit-progress-value {
  background: var(--accent);
}

.lit-ai-tags {
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0;
}

.lit-ai-tags > span {
  margin-right: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.lit-ai-tags > b {
  padding: 4px 7px;
  border: 1px solid #b9d0cc;
  border-radius: 5px;
  color: #315a55;
  background: #fff;
  font-size: 10px;
}

.lit-ai-guide {
  margin-top: 12px;
  border-top: 1px solid #d8e3e1;
}

.lit-ai-guide summary {
  min-height: 46px;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  list-style: none;
  font-weight: 800;
}

.lit-ai-guide summary::-webkit-details-marker {
  display: none;
}

.lit-ai-guide summary small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.lit-ai-guide .markdown-preview {
  max-height: 520px;
  overflow: auto;
  border-radius: 6px;
  background: #fff;
}

.lit-ai-empty {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-top: 1px solid #d8e3e1;
  color: var(--muted);
  font-size: 12px;
}

.lit-ai-empty svg {
  width: 20px;
  height: 20px;
}

.lit-retry-form {
  margin-top: 9px;
}

.lit-empty-v2 {
  min-height: 520px;
  justify-items: center;
  gap: 13px;
}

.lit-empty-v2 > svg {
  width: 42px;
  height: 42px;
  color: var(--accent);
}

.lit-empty-v2 h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0;
}

@media (max-width: 1220px) {
  .lit-acquisition-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .literature-hub > .literature-page {
    grid-template-columns: 310px minmax(0, 1fr);
  }

  .lit-detail-v2 .lit-meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .lit-detail-v2 .lit-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .literature-hub {
    padding: 22px 12px 38px;
  }

  .lit-page-head,
  .lit-ai-workbench > header,
  .lit-detail-v2 .lit-detail-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .lit-page-actions,
  .lit-ai-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .lit-library-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .lit-library-stats > div:nth-child(3) {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .lit-library-stats > div:nth-child(4) {
    border-top: 1px solid var(--line);
  }

  .literature-hub > .literature-page {
    grid-template-columns: minmax(0, 1fr);
    overflow: visible;
  }

  .literature-hub .lit-sidebar {
    position: static;
    height: auto;
    min-height: 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .literature-hub .lit-list {
    max-height: 360px;
  }

  .lit-detail-head .mini-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 620px) {
  .lit-page-head h1 {
    font-size: 26px;
  }

  .lit-page-actions .button {
    flex: 1 1 140px;
  }

  .lit-acquisition-grid,
  .lit-detail-v2 .lit-meta-grid,
  .lit-library-stats {
    grid-template-columns: minmax(0, 1fr);
  }

  .lit-library-stats > div + div {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .literature-hub .lit-main {
    padding: 16px 12px;
  }

  .lit-detail-v2 .lit-detail-head h1 {
    font-size: 23px;
  }

.lit-ai-actions .button {
    flex: 1 1 150px;
  }

  .lit-ai-guide summary {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
  }

  .lit-history {
    grid-template-columns: 1fr;
  }
}

/* Multi-document research notebook and token-scoped public sharing. */
.notebook-body,
.shared-note-body {
  background: var(--paper);
}

.notebook-app-shell {
  min-height: 100vh;
}

.notebook-page {
  min-height: calc(100vh - 76px);
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  overflow: hidden;
  border-top: 1px solid var(--ink);
  background: #fff;
}

.notebook-sidebar {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: hidden;
  padding: 18px 14px;
  border-right: 2px solid var(--ink);
  background: #f4f6f5;
}

.notebook-sidebar-head,
.notebook-editor-head,
.notebook-head-actions,
.notebook-dialog header,
.notebook-dialog footer,
.shared-note-head,
.shared-note-meta,
.shared-note-title-row,
.notebook-active-shares > div > div {
  display: flex;
  align-items: center;
}

.notebook-sidebar-head {
  justify-content: space-between;
  gap: 10px;
}

.notebook-sidebar-head > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.notebook-sidebar-head span {
  font-size: 18px;
  font-weight: 850;
}

.notebook-sidebar-head strong {
  color: var(--muted);
  font-size: 12px;
}

.notebook-list {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 4px;
  overflow-y: auto;
}

.notebook-list a {
  min-width: 0;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  padding: 10px 9px;
  border: 1px solid transparent;
  color: var(--ink);
  text-decoration: none;
}

.notebook-list a:hover {
  border-color: var(--line);
  background: #fff;
}

.notebook-list a.active {
  border-color: var(--ink);
  color: #fff;
  background: var(--ink);
  box-shadow: 2px 2px 0 #aeb7bd;
}

.notebook-list svg {
  width: 18px;
  height: 18px;
}

.notebook-list a > span {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.notebook-list strong,
.notebook-list small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notebook-list small {
  color: var(--muted);
  font-size: 11px;
}

.notebook-list a.active small {
  color: rgba(255, 255, 255, 0.7);
}

.notebook-workspace {
  min-width: 0;
  height: calc(100vh - 76px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
  padding: 16px clamp(14px, 2.4vw, 32px) 24px;
}

.notebook-editor-head {
  min-width: 0;
  gap: 10px;
}

.notebook-editor-head .writer-title {
  min-width: 180px;
}

.notebook-head-actions {
  flex: 0 0 auto;
  gap: 7px;
}

.notebook-head-actions .button {
  gap: 6px;
  padding-inline: 11px;
}

.notebook-head-actions .button svg {
  margin: 0;
}

.notebook-delete {
  color: #9b2c2c;
}

.notebook-sidebar-toggle {
  display: none;
}

.notebook-workspace > .writer-toolbar {
  flex: 0 0 auto;
}

.notebook-workspace > .writing-editor {
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
}

.save-state.dirty {
  border-color: #d2a12b;
  color: #785712;
  background: #fff9e8;
}

.writing-editor.size-14 { font-size: 14px; }
.writing-editor.size-16 { font-size: 16px; }
.writing-editor.size-18 { font-size: 18px; }
.writing-editor.size-20 { font-size: 20px; }
.writing-editor.size-22 { font-size: 22px; }
.writing-editor.size-24 { font-size: 24px; }
.writing-editor.line-14 { line-height: 1.4; }
.writing-editor.line-16 { line-height: 1.6; }
.writing-editor.line-18 { line-height: 1.8; }
.writing-editor.line-20 { line-height: 2; }
.writing-editor.line-22 { line-height: 2.2; }

.writing-editor > :first-child {
  margin-top: 0;
}

.writing-editor > :last-child {
  margin-bottom: 0;
}

.writing-editor blockquote {
  margin-inline: 0;
  padding-left: 18px;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}

.writing-editor pre {
  overflow-x: auto;
  padding: 14px;
  border: 1px solid var(--line);
  background: #f5f7f8;
  white-space: pre-wrap;
}

.notebook-dialog {
  width: min(620px, calc(100vw - 28px));
  max-height: min(780px, calc(100vh - 28px));
  padding: 0;
  overflow: hidden;
  border: 2px solid var(--ink);
  color: var(--ink);
  background: #fff;
  box-shadow: 7px 7px 0 rgba(28, 39, 49, 0.3);
}

.notebook-dialog::backdrop {
  background: rgba(20, 28, 34, 0.52);
}

.notebook-dialog-body {
  max-height: min(780px, calc(100vh - 28px));
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow: hidden;
  padding: 22px;
}

.notebook-dialog header {
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.notebook-dialog header > div {
  min-width: 0;
}

.notebook-dialog header span {
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 850;
}

.notebook-dialog h2 {
  margin: 3px 0 0;
  font-size: 21px;
}

.notebook-dialog label,
.notebook-share-form,
.notebook-share-form fieldset,
.notebook-share-result,
.notebook-active-shares,
.notebook-active-shares > div {
  display: grid;
  gap: 8px;
}

.notebook-dialog label,
.notebook-share-form legend {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.notebook-dialog input,
.notebook-dialog select {
  min-height: 42px;
  width: 100%;
  padding: 0 11px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: #fff;
  font: inherit;
}

.notebook-dialog footer {
  justify-content: flex-end;
  gap: 9px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.notebook-history-dialog {
  width: min(1040px, calc(100vw - 28px));
}

.notebook-history-layout {
  min-height: 0;
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 16px;
  overflow: hidden;
}

.notebook-version-list {
  display: grid;
  align-content: start;
  gap: 5px;
  overflow-y: auto;
}

.notebook-version-list button {
  display: grid;
  gap: 3px;
  padding: 10px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: #fff;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.notebook-version-list button.active {
  border-color: var(--ink);
  color: #fff;
  background: var(--ink);
}

.notebook-version-list span,
.notebook-version-list small {
  color: var(--muted);
  font-size: 11px;
}

.notebook-version-list button.active span,
.notebook-version-list button.active small {
  color: rgba(255, 255, 255, 0.72);
}

.notebook-version-preview {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
  overflow: hidden;
}

.notebook-version-preview > div {
  display: grid;
  gap: 3px;
}

.notebook-version-preview > div span {
  color: var(--muted);
  font-size: 12px;
}

.notebook-version-preview .writing-editor {
  min-height: 360px;
  overflow-y: auto;
  padding: 24px;
  box-shadow: none;
}

.notebook-share-form fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

.notebook-segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  padding: 4px;
  border: 1px solid var(--line);
  background: #eef0ef;
}

.notebook-segmented label {
  position: relative;
  display: block;
  cursor: pointer;
}

.notebook-segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.notebook-segmented span {
  min-height: 38px;
  display: grid;
  place-items: center;
  padding: 0 10px;
  color: var(--muted);
}

.notebook-segmented input:checked + span {
  color: #fff;
  background: var(--ink);
}

.notebook-share-result {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.notebook-share-result > span {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
}

.notebook-active-shares {
  min-height: 0;
  overflow: hidden;
}

.notebook-active-shares h3 {
  margin: 0;
  font-size: 15px;
}

.notebook-active-shares > div {
  overflow-y: auto;
}

.notebook-active-shares > div > div {
  min-width: 0;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.notebook-active-shares svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  color: var(--accent-strong);
}

.notebook-active-shares div > span {
  min-width: 0;
  flex: 1 1 auto;
  display: grid;
  gap: 3px;
}

.notebook-active-shares small {
  color: var(--muted);
}

.notebook-confirm-dialog {
  width: min(480px, calc(100vw - 28px));
}

.notebook-confirm-dialog p {
  margin: 0;
  line-height: 1.7;
}

.reading-mode .notebook-topbar,
.reading-mode .notebook-sidebar,
.reading-mode .notebook-workspace > .writer-toolbar,
.reading-mode .notebook-sidebar-toggle,
.reading-mode #saveButton,
.reading-mode #historyButton,
.reading-mode #shareButton,
.reading-mode #deleteButton,
.reading-mode .save-state {
  display: none;
}

.reading-mode .notebook-page {
  min-height: 100vh;
  display: block;
  overflow: visible;
  border: 0;
}

.reading-mode .notebook-workspace {
  width: min(900px, 100%);
  height: auto;
  min-height: 100vh;
  margin: 0 auto;
  overflow: visible;
  padding: 32px clamp(18px, 5vw, 64px) 70px;
}

.reading-mode .notebook-editor-head {
  align-items: flex-start;
  margin-bottom: 16px;
}

.reading-mode .notebook-editor-head .writer-title {
  min-height: 58px;
  border: 0;
  font-size: 34px;
}

.reading-mode .notebook-head-actions {
  margin-left: auto;
}

.reading-mode .notebook-workspace > .writing-editor {
  min-height: 0;
  overflow: visible;
  padding: 0;
  border: 0;
  box-shadow: none;
}

.shared-note-page {
  width: min(980px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px clamp(16px, 4vw, 44px) 64px;
}

.shared-note-head {
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 18px;
  border-bottom: 2px solid var(--ink);
}

.shared-note-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 850;
}

.shared-note-meta {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.shared-note-meta span {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 9px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: #fff;
  font-size: 12px;
  font-weight: 750;
}

.shared-note-meta svg {
  width: 15px;
  height: 15px;
}

.shared-note-alert {
  margin: 16px 0 0;
  padding: 11px 13px;
  border: 1px solid;
  font-weight: 700;
}

.shared-note-alert.success {
  border-color: #8bbfae;
  color: #155e4d;
  background: #effaf6;
}

.shared-note-alert.error {
  border-color: #dfaba5;
  color: #8a2920;
  background: #fff5f4;
}

.shared-note-document {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}

.shared-note-title-row {
  gap: 10px;
}

.shared-note-title-row .writer-title {
  min-width: 180px;
}

.shared-note-document > .writing-editor {
  min-height: calc(100vh - 250px);
}

.shared-note-reader {
  width: min(800px, 100%);
  margin-inline: auto;
}

.shared-note-reader > h1 {
  margin: 14px 0 8px;
  font-size: 34px;
}

.shared-note-reader > .writing-editor {
  min-height: 0;
  padding: 0;
  border: 0;
  box-shadow: none;
}

.shared-note-invalid {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
}

.shared-note-invalid > svg {
  width: 42px;
  height: 42px;
  color: var(--muted);
}

.shared-note-invalid h1,
.shared-note-invalid p {
  margin: 0;
}

.shared-note-invalid p {
  color: var(--muted);
}

@media (max-width: 1050px) {
  .notebook-page {
    grid-template-columns: 230px minmax(0, 1fr);
  }

  .notebook-head-actions .button span {
    display: none;
  }

  .notebook-head-actions .button {
    width: 38px;
    padding: 0;
  }

  .reading-mode .notebook-head-actions .button span {
    display: inline;
  }

  .reading-mode .notebook-head-actions .button {
    width: auto;
    padding-inline: 11px;
  }
}

@media (max-width: 760px) {
  .notebook-page {
    position: relative;
    display: block;
  }

  .notebook-sidebar {
    position: fixed;
    z-index: 50;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(300px, 88vw);
    border-right: 2px solid var(--ink);
    box-shadow: 8px 0 24px rgba(20, 28, 34, 0.28);
    transform: translateX(-105%);
    transition: transform 180ms ease;
  }

  .notebook-sidebar.open {
    transform: translateX(0);
  }

  .notebook-sidebar-toggle {
    display: inline-grid;
  }

  .notebook-workspace {
    height: calc(100vh - 70px);
    padding-inline: 12px;
  }

  .notebook-editor-head {
    flex-wrap: wrap;
  }

  .notebook-editor-head .writer-title {
    flex: 1 1 calc(100% - 52px);
  }

  .notebook-editor-head .save-state {
    order: 3;
  }

  .notebook-head-actions {
    order: 4;
    flex: 1 1 auto;
    justify-content: flex-end;
  }

  .notebook-history-layout {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }

  .notebook-version-list {
    max-height: 160px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .notebook-version-preview .writing-editor {
    min-height: 260px;
    max-height: 380px;
  }

  .shared-note-head,
  .shared-note-title-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .shared-note-meta {
    justify-content: flex-start;
  }

  .shared-note-title-row .writer-title,
  .shared-note-title-row .button {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .notebook-workspace {
    height: calc(100vh - 66px);
  }

  .notebook-editor-head .save-state {
    display: none;
  }

  .notebook-head-actions {
    justify-content: space-between;
  }

  .notebook-head-actions .button,
  .notebook-head-actions .icon-button {
    flex: 1 1 38px;
  }

  .notebook-dialog-body {
    padding: 16px 14px;
  }

  .notebook-share-result,
  .notebook-version-list {
    grid-template-columns: 1fr;
  }

  .notebook-share-result .button {
    width: 100%;
  }

  .reading-mode .notebook-editor-head .writer-title,
  .shared-note-reader > h1 {
    font-size: 28px;
  }
}
