:root {
  --bg: #f5f1e8;
  --paper: #fffdf8;
  --paper-soft: #fbf8ef;
  --ink: #151515;
  --ink-soft: #313131;
  --muted: #767066;
  --muted-2: #9b9285;
  --border: #ded4c3;
  --border-soft: #eee5d8;
  --navy: #161b33;
  --navy-2: #222a51;
  --blue: #3447ff;
  --blue-soft: #e7eaff;
  --gold: #c9963a;
  --gold-soft: #fff3ce;
  --green: #15803d;
  --green-soft: #e8f7ee;
  --amber: #b7791f;
  --amber-soft: #fff4db;
  --purple: #6d28d9;
  --purple-soft: #f0e7ff;
  --red: #b91c1c;
  --red-soft: #fee8e8;
  --gray: #71717a;
  --gray-soft: #eeeeef;
  --highlight: #fff1a8;
  --shadow: 0 24px 70px rgba(45, 35, 20, 0.12);
  --shadow-soft: 0 10px 40px rgba(45, 35, 20, 0.08);
  --project-sidebar: 292px;
  --topbar: 96px;
  --reader-toolbar-top: var(--topbar);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body.theorytrace-body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 0%, rgba(201, 150, 58, 0.16), transparent 32%),
    radial-gradient(circle at 88% 10%, rgba(52, 71, 255, 0.10), transparent 34%),
    linear-gradient(135deg, var(--bg), #faf7ef);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  text-decoration: none;
}

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

.app-shell {
  display: grid;
  grid-template-columns: minmax(620px, 1fr) var(--project-sidebar);
  min-height: 100vh;
}

.main-area {
  min-width: 0;
  padding: 20px 28px 56px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: var(--topbar);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin: -20px -28px 24px;
  padding: 12px 28px;
  background: rgba(245, 241, 232, 0.78);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(222, 212, 195, 0.6);
}

.topbar-compact {
  min-height: 72px;
}

.top-actions,
.tt-actions,
.tt-form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.tt-hidden-status-form {
  display: none;
}

.btn,
.tt-btn {
  border: 0;
  border-radius: 999px;
  min-height: 42px;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: inherit;
  transition: 180ms ease;
}

.btn:hover,
.tt-btn:hover {
  transform: translateY(-1px);
}

.btn.primary,
.tt-btn-primary {
  background: var(--navy);
  color: white;
  box-shadow: 0 14px 28px rgba(22, 27, 51, 0.18);
}

.btn.soft,
.tt-btn {
  background: var(--paper);
  color: var(--ink-soft);
  border: 1px solid var(--border);
}

.tt-btn-danger {
  color: var(--red);
  border-color: #efbcbc;
}

.reader-frame {
  max-width: 940px;
  margin: 0 auto;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 0;
}

.breadcrumb strong {
  display: block;
  max-width: 34vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-soft);
  font-weight: 700;
}

.reader-label-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
}

.reader-label-main .breadcrumb {
  flex: 1 1 auto;
}

.reader-labels {
  width: min(940px, 100%);
  margin: 0;
  padding: 0;
  color: var(--ink-soft);
}

.reader-label-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex: 0 0 auto;
}

.inline-add-project-form,
.inline-publish-project-form {
  display: inline-flex;
  margin: 0;
}

.reader-label-actions .btn {
  min-height: 34px;
  padding: 0 12px;
  font-size: 12px;
}

.publish-project-button {
  border-color: rgba(21, 128, 61, 0.28);
  color: var(--green);
}

.reader-label-toggle {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--paper);
  color: var(--muted);
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease, transform 140ms ease;
}

.reader-label-toggle:hover {
  background: var(--paper-soft);
  color: var(--navy);
}

.reader-label-toggle span {
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-135deg) translate(-1px, -1px);
  transition: transform 140ms ease;
}

.reader-labels.is-collapsed .reader-label-actions,
.reader-labels.is-collapsed .reader-document-meta,
.reader-labels.is-collapsed .reader-extra-crumb {
  display: none;
}

.reader-labels.is-collapsed .reader-label-main {
  align-items: center;
}

.reader-labels.is-collapsed .reader-label-toggle span {
  transform: rotate(45deg) translate(-1px, -1px);
}

.topbar.reader-labels-collapsed {
  min-height: 58px;
}

.reader-document-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.reader-document-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 7px;
  border: 1px solid rgba(222, 212, 195, 0.64);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.42);
}

.reader-collaboration {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: max-content;
}

.member-stack {
  display: inline-flex;
  align-items: center;
  padding-left: 8px;
}

.member-avatar {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  margin-left: -8px;
  overflow: hidden;
  border: 2px solid rgba(255, 253, 248, 0.94);
  border-radius: 999px;
  background: var(--navy);
  color: #ffffff;
  font-size: 11px;
  font-weight: 850;
  text-decoration: none;
  box-shadow: 0 8px 18px rgba(45, 35, 20, 0.10);
}

.member-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tt-header-menu {
  position: relative;
}

.tt-header-menu summary {
  list-style: none;
}

.tt-header-menu summary::-webkit-details-marker {
  display: none;
}

.header-icon-button {
  position: relative;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(118, 112, 102, 0.18);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.header-icon-button:hover,
.tt-header-menu[open] .header-icon-button {
  border-color: rgba(22, 27, 51, 0.24);
  background: rgba(255, 253, 248, 0.76);
  color: var(--navy);
  box-shadow: 0 10px 26px rgba(45, 35, 20, 0.08);
}

.tt-invite-icon,
.tt-bell-icon {
  position: relative;
  display: block;
}

.tt-invite-icon {
  width: 19px;
  height: 19px;
}

.tt-invite-icon svg,
.tt-bell-icon svg {
  width: 100%;
  height: 100%;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tt-bell-icon {
  width: 19px;
  height: 19px;
}

.notification-count {
  position: absolute;
  right: -3px;
  top: -4px;
  min-width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  padding: 0 4px;
  border: 2px solid #ffffff;
  border-radius: 999px;
  background: var(--red);
  color: #ffffff;
  font-size: 9px;
  font-weight: 900;
  line-height: 1;
}

.header-menu-panel {
  position: absolute;
  top: calc(100% + 9px);
  right: 0;
  z-index: 80;
  width: min(330px, calc(100vw - 32px));
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--paper);
  box-shadow: var(--shadow-soft);
}

.header-menu-panel > strong {
  display: block;
  margin-bottom: 9px;
  color: var(--ink);
  font-size: 12px;
}

.invite-panel form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.invite-panel input {
  min-width: 0;
  height: 34px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: var(--paper-soft);
  color: var(--ink);
  padding: 0 11px;
  outline: none;
  font-size: 13px;
}

.invite-panel input:focus {
  border-color: rgba(52, 71, 255, 0.34);
  box-shadow: 0 0 0 3px rgba(52, 71, 255, 0.10);
}

.invite-panel button,
.invitation-item button {
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  background: var(--navy);
  color: #ffffff;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.invitation-list {
  display: grid;
  gap: 7px;
}

.tt-invitation-list-page {
  max-width: 520px;
  margin-top: 16px;
}

.invitation-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 8px;
  border-radius: 10px;
  background: var(--paper-soft);
}

.invitation-item span {
  min-width: 0;
}

.invitation-item b,
.invitation-item small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.invitation-item b {
  color: var(--ink);
  font-size: 12px;
}

.invitation-item small,
.notification-panel p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.reader-paper {
  position: relative;
  padding: 42px 48px 56px;
  border-radius: var(--radius-xl);
  background: var(--paper);
  border: 1px solid rgba(222, 212, 195, 0.9);
  box-shadow: var(--shadow);
}

.tt-profile-paper {
  max-width: 760px;
  margin: 0 auto;
}

.tt-profile-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.tt-profile-avatar {
  width: 54px;
  height: 54px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--navy);
  color: white;
  font-weight: 800;
}

.tt-profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tt-profile-head h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.15;
}

.tt-profile-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.tt-profile-form {
  display: grid;
  gap: 14px;
}

.tt-profile-section h2 {
  margin: 0;
  font-size: 16px;
}

.tt-profile-section p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.tt-profile-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.tt-profile-form input,
.tt-profile-form select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 10px 11px;
  font: inherit;
}

.tt-profile-form .errorlist,
.tt-profile-errors {
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--red);
  font-size: 12px;
  font-weight: 800;
}

.tt-profile-status {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
}

.tt-profile-status span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--gray-soft);
  color: var(--gray);
  font-weight: 800;
}

.tt-profile-status span.ready {
  background: var(--green-soft);
  color: var(--green);
}

.tt-profile-status em {
  font-style: normal;
}

.tt-profile-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.tt-profile-actions a,
.tt-profile-actions button {
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.tt-profile-actions a {
  background: var(--paper-soft);
  color: var(--muted);
}

.tt-profile-actions button {
  background: var(--gold);
  color: #211600;
  cursor: pointer;
}

.tt-profile-contributions {
  display: grid;
  gap: 12px;
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid var(--border-soft);
}

.tt-profile-project-list {
  display: grid;
  gap: 6px;
}

.tt-profile-project-list a {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 8px;
  background: var(--paper-soft);
  color: var(--ink-soft);
  font-size: 12px;
}

.tt-profile-project-list span {
  color: var(--muted);
  white-space: nowrap;
}

.tt-profile-logout {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

.tt-profile-logout button {
  border: 0;
  border-radius: 999px;
  background: var(--paper-soft);
  color: var(--red);
  padding: 9px 13px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.tt-auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.tt-auth-panel {
  width: min(430px, 100%);
  display: grid;
  gap: 22px;
  padding: 28px;
  border: 1px solid rgba(222, 212, 195, 0.86);
  border-radius: var(--radius-lg);
  background: rgba(255, 253, 248, 0.9);
  box-shadow: var(--shadow-soft);
}

.tt-auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--navy);
  font-weight: 850;
}

.tt-auth-brand span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--navy);
  color: #fff;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 30px;
  line-height: 1;
}

.tt-auth-head {
  display: grid;
  gap: 6px;
}

.tt-auth-head h1,
.tt-auth-head p {
  margin: 0;
}

.tt-auth-head h1 {
  color: var(--ink);
  font-size: 28px;
  line-height: 1.1;
}

.tt-auth-head p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

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

.tt-auth-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.tt-auth-form label > span {
  text-transform: uppercase;
}

.tt-auth-form input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  padding: 11px 12px;
}

.tt-auth-form small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.45;
}

.tt-auth-form .errorlist {
  margin: 0;
  padding-left: 18px;
  color: var(--red);
  font-size: 12px;
  font-weight: 800;
}

.tt-auth-switch {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.tt-auth-switch a {
  color: var(--navy);
  font-weight: 850;
}

.tt-profile-check {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid rgba(21, 128, 61, 0.22);
  border-radius: 10px;
  background: rgba(232, 247, 238, 0.48);
}

.tt-profile-check input {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  accent-color: var(--green);
}

.tt-profile-check strong,
.tt-profile-check small {
  display: block;
}

.tt-profile-check strong {
  color: var(--ink);
  font-size: 13px;
}

.tt-profile-check small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.tt-public-library {
  width: min(1180px, 100%);
  margin: 0 auto;
}

.tt-library-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0;
  padding: 4px 0 10px;
  border-bottom: 0;
}

.tt-library-section-head h2 {
  margin: 0;
  color: var(--navy);
  font-size: 30px;
  line-height: 1.04;
  letter-spacing: 0;
}

.tt-public-graph-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  text-align: left;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.tt-public-graph-meta span {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
  min-height: 28px;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.72);
  border: 1px solid rgba(222, 212, 195, 0.78);
}

.tt-public-invitations {
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.72);
}

.tt-public-invitations > strong {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 13px;
}

.tt-contributors-page,
.tt-project-overview {
  width: min(1040px, 100%);
}

.tt-contributor-list {
  display: grid;
  gap: 8px;
}

.tt-contributor-list-large {
  gap: 10px;
}

.tt-contributor-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 11px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: rgba(255, 253, 248, 0.78);
}

.tt-contributor-row strong {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--ink);
  font-size: 13px;
}

.tt-contributor-row strong small {
  color: var(--green);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}

.tt-contributor-row p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.reader-toolbar {
  position: sticky;
  top: var(--reader-toolbar-top);
  z-index: 23;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 12px 0 16px;
  margin-bottom: 30px;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(255, 253, 248, 0.92);
  backdrop-filter: blur(18px);
}

.reader-toolbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  width: 100%;
}

.tool-chip {
  border: 1px solid var(--border);
  background: var(--paper-soft);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.tool-chip.active {
  border-color: rgba(21, 128, 61, 0.24);
  background: var(--green-soft);
  color: var(--green);
}

.tool-chip.locked {
  cursor: default;
  color: var(--muted);
  background: var(--gray-soft);
}

.tool-chip.copied {
  border-color: rgba(21, 128, 61, 0.24);
  background: var(--green-soft);
  color: var(--green);
}

.status-toggle-form {
  display: inline-flex;
  margin: 0;
}

.document-search {
  position: relative;
  display: inline-flex;
  margin-left: auto;
}

.search-trigger {
  min-width: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.search-trigger span {
  font-size: 18px;
  line-height: 1;
}

.document-search.open .search-trigger {
  border-color: rgba(52, 71, 255, 0.24);
  background: var(--blue-soft);
  color: var(--blue);
}

.document-search-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  display: grid;
  width: min(430px, calc(100vw - 36px));
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--paper);
  box-shadow: var(--shadow-soft);
}

.document-search-panel[hidden] {
  display: none;
}

.tt-search-icon {
  position: relative;
  display: block;
  width: 14px;
  height: 14px;
}

.tt-search-icon::before {
  content: "";
  position: absolute;
  left: 1px;
  top: 1px;
  width: 8px;
  height: 8px;
  border: 1.8px solid currentColor;
  border-radius: 999px;
}

.tt-search-icon::after {
  content: "";
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 6px;
  height: 1.8px;
  border-radius: 999px;
  background: currentColor;
  transform: rotate(45deg);
  transform-origin: center;
}

.document-search-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: var(--paper-soft);
}

.document-search-field input {
  width: 100%;
  min-height: 32px;
  border: 0;
  border-radius: 999px;
  padding: 6px 8px;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  outline: none;
}

.document-search-field:focus-within {
  border-color: rgba(52, 71, 255, 0.34);
  box-shadow: 0 0 0 3px rgba(52, 71, 255, 0.10);
}

.document-search-field button {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--navy);
  color: white;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

.document-search-results {
  display: grid;
  gap: 4px;
  max-height: 320px;
  margin-top: 8px;
  overflow-y: auto;
}

.search-result {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr);
  gap: 4px;
  column-gap: 8px;
  padding: 9px 8px;
  border-radius: 10px;
}

.search-result:hover {
  background: var(--paper-soft);
}

.search-result-head {
  display: flex;
  align-items: center;
  gap: 7px;
  grid-column: 2;
  min-width: 0;
  color: var(--ink);
  font-size: 12px;
}

.search-result-dot {
  grid-row: 1 / span 2;
  width: 6px;
  height: 6px;
  margin-top: 7px;
  border-radius: 999px;
  background: var(--gold);
}

.search-result-head strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-result-number {
  flex: 0 0 auto;
  min-width: 24px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-align: right;
}

.search-result-snippet,
.document-search-empty {
  display: block;
  grid-column: 2;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.document-search-empty {
  padding: 10px 8px;
}

.parent-back-chip {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  font-size: 12px;
  line-height: 1;
}

.parent-back-arrow {
  font-size: 21px;
  line-height: 0.8;
  transform: translateY(-1px);
}

.article {
  counter-reset: block;
  font-family: "Source Serif 4", Georgia, serif;
  color: var(--ink);
  font-size: 19px;
  line-height: 1.82;
}

.article h1,
.article h2,
.article h3,
.article h4 {
  font-family: Inter, system-ui, sans-serif;
  margin: 44px 0 14px;
  color: var(--navy);
  line-height: 1.18;
  letter-spacing: 0;
}

.article h1 { font-size: 30px; }
.article h2 { font-size: 26px; }
.article h3 { font-size: 24px; }
.article h4 { font-size: 20px; }

.article p,
.article li,
.article [data-block-id],
.equation-block {
  position: relative;
}

.article [data-block-id]::before {
  counter-increment: block;
  content: counter(block);
  position: absolute;
  left: -35px;
  top: 3px;
  font-family: Inter, sans-serif;
  font-size: 11px;
  color: var(--muted-2);
  opacity: 0.65;
}

.article,
.article * {
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: text;
  user-select: text;
}

.article::selection,
.article *::selection {
  background: rgba(255, 216, 105, 0.5);
  color: var(--ink);
  text-shadow: none;
}

.article p {
  margin: 0 0 22px;
}

.article ul,
.article ol {
  padding-left: 24px;
  margin: 18px 0 26px;
}

.article li {
  margin-bottom: 10px;
  padding-left: 4px;
}

.article blockquote {
  margin: 34px 0;
  padding: 18px 20px;
  border-left: 4px solid var(--gold);
  border-radius: 0 18px 18px 0;
  background: var(--gold-soft);
  font-family: Inter, sans-serif;
  font-size: 14px;
  line-height: 1.65;
  color: #4d3711;
}

.article pre {
  margin: 28px 0;
  border-radius: 18px;
  background: #161b33;
  color: #f7f4ee;
  overflow: auto;
  box-shadow: 0 18px 44px rgba(22, 27, 51, 0.16);
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  line-height: 1.75;
  padding: 18px 20px 22px;
}

.article code {
  font-family: "JetBrains Mono", monospace;
}

.article :not(pre) > code {
  padding: 2px 5px;
  border-radius: 6px;
  background: #f2eadb;
}

.article table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-family: Inter, system-ui, sans-serif;
  font-size: 14px;
}

.article th,
.article td {
  padding: 10px;
  border: 1px solid var(--border);
}

.equation-block,
.katex-display {
  margin: 30px 0;
  padding: 20px 24px;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(245, 241, 232, 0.68), rgba(255, 253, 248, 0.8));
  border: 1px solid var(--border-soft);
  overflow-x: auto;
  text-align: center;
  font-size: 18px;
}

.anchor-highlight,
.tt-anchor-highlight {
  --tt-anchor-highlight-bg: var(--highlight);
  --tt-anchor-highlight-ring: rgba(255, 241, 168, 0.42);
  position: relative;
  background: linear-gradient(to bottom, transparent 46%, var(--tt-anchor-highlight-bg) 46%);
  border-radius: 4px;
  cursor: pointer;
  padding: 0 2px;
  color: inherit;
  text-decoration: none;
  scroll-margin-top: 96px;
  transition: 160ms ease;
}

.tt-anchor-highlight.tt-status-edge-verified {
  --tt-anchor-highlight-bg: rgba(187, 247, 208, 0.9);
  --tt-anchor-highlight-ring: rgba(187, 247, 208, 0.42);
  background: linear-gradient(to bottom, transparent 46%, var(--tt-anchor-highlight-bg) 46%);
}

.tt-anchor-highlight.tt-anchor-math {
  background: var(--tt-anchor-highlight-bg);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  box-shadow: 0 0 0 3px var(--tt-anchor-highlight-ring);
}

.tt-anchor-highlight.tt-anchor-math .katex,
.tt-anchor-highlight.tt-anchor-math .tt-raw-math {
  border-radius: 5px;
  background: var(--tt-anchor-highlight-bg);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.tt-anchor-highlight.tt-anchor-display-math {
  display: block;
  padding: 8px;
  margin: 16px 0;
  border-radius: 18px;
}

.tt-anchor-highlight.tt-anchor-display-math .katex-display {
  margin: 0;
  background: transparent;
  border-color: transparent;
}

.anchor-highlight:hover,
.tt-anchor-highlight:hover {
  background: var(--tt-anchor-highlight-bg);
  box-shadow: 0 0 0 4px var(--tt-anchor-highlight-ring);
}

.tt-anchor-highlight.tt-status-edge-verified:hover {
  background: var(--tt-anchor-highlight-bg);
  box-shadow: 0 0 0 4px var(--tt-anchor-highlight-ring);
}

.tt-anchor-highlight.tt-return-focus {
  box-shadow: 0 0 0 5px var(--tt-anchor-highlight-ring);
}

.article pre .tt-anchor-highlight {
  --tt-anchor-highlight-bg: rgba(255, 241, 168, 0.18);
  --tt-anchor-highlight-ring: rgba(255, 241, 168, 0.18);
  background: var(--tt-anchor-highlight-bg);
  color: #fff6bf;
  border-bottom: 1px solid rgba(255, 241, 168, 0.46);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.article pre .tt-anchor-highlight.tt-status-edge-verified {
  --tt-anchor-highlight-bg: rgba(74, 222, 128, 0.24);
  --tt-anchor-highlight-ring: rgba(74, 222, 128, 0.18);
  color: #dcfce7;
  border-bottom-color: rgba(134, 239, 172, 0.54);
}

.article pre .tt-anchor-highlight:hover,
.article pre .tt-anchor-highlight.tt-status-edge-verified:hover {
  background: var(--tt-anchor-highlight-bg);
  box-shadow: 0 0 0 3px var(--tt-anchor-highlight-ring);
}

.anchor-badge,
.tt-anchor-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  margin-left: 4px;
  padding: 0 6px;
  transform: translateY(-2px);
  border-radius: 999px;
  background: var(--navy);
  color: white;
  font-family: Inter, sans-serif;
  font-size: 11px;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(22, 27, 51, 0.2);
}

.tt-status-edge-verified .tt-anchor-badge {
  background: var(--green);
}

.article pre .tt-anchor-badge {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  box-shadow: none;
}

.project-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px 16px 22px;
  border-left: 1px solid rgba(214, 203, 184, 0.92);
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.96), rgba(245, 239, 226, 0.92));
  backdrop-filter: blur(18px);
  overflow-y: auto;
}

.mobile-theorytrace-bar,
.sidebar-backdrop,
.sidebar-close-button {
  display: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 2px 16px;
  margin-bottom: 14px;
  border-bottom: 1px solid rgba(222, 212, 195, 0.72);
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--navy), var(--navy-2));
  color: white;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 12px 28px rgba(22, 27, 51, 0.18);
}

.brand-text strong {
  display: block;
  font-size: 15px;
  letter-spacing: 0;
}

.brand-text span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.sidebar-profile-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  margin: -2px 0 16px;
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
}

.sidebar-profile-link:hover {
  background: rgba(22, 27, 51, 0.05);
  text-decoration: none;
}

.sidebar-profile-avatar {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--navy);
  color: white;
  font-size: 12px;
  font-weight: 800;
  flex: 0 0 auto;
}

.sidebar-profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sidebar-profile-text {
  display: grid;
  min-width: 0;
  line-height: 1.15;
}

.sidebar-profile-text strong,
.sidebar-profile-text small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-profile-text strong {
  font-size: 12px;
}

.sidebar-profile-text small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.project-card {
  padding: 18px;
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, rgba(22, 27, 51, 0.97), rgba(34, 42, 81, 0.96));
  color: white;
  box-shadow: var(--shadow-soft);
  margin-bottom: 18px;
}

.project-card .eyebrow {
  color: rgba(255,255,255,0.58);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 10px;
}

.project-card h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.18;
  letter-spacing: 0;
}

.project-card p {
  margin: 10px 0 0;
  color: rgba(255,255,255,0.66);
  font-size: 13px;
  line-height: 1.5;
}

.nav-section {
  margin-top: 14px;
}

.nav-section-public {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(222, 212, 195, 0.72);
}

.nav-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding: 0 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.tree-project,
.tree-doc-row {
  position: relative;
}

.tree-row {
  position: relative;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) 42px;
  gap: 3px;
  align-items: center;
}

.tree-toggle,
.tree-toggle-spacer,
.tree-menu-button {
  width: 26px;
  height: 30px;
  border: 0;
  background: transparent;
}

.tree-toggle,
.tree-menu-button {
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: var(--muted);
  cursor: pointer;
}

.tree-toggle:hover,
.tree-menu-button:hover {
  background: rgba(255, 255, 255, 0.62);
  color: var(--navy);
}

.tree-toggle span {
  width: 0;
  height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 5px solid currentColor;
  transform: rotate(90deg);
  transition: transform 120ms ease;
}

.tree-project.collapsed > .tree-row .tree-toggle span,
.tree-doc-row.collapsed > .tree-row .tree-toggle span {
  transform: rotate(0deg);
}

.tree-menu-button {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 2px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease, background 140ms ease, color 140ms ease;
}

.tree-row:hover .tree-menu-button,
.tree-row:focus-within .tree-menu-button,
.tree-menu-button[aria-expanded="true"] {
  opacity: 1;
  pointer-events: auto;
}

.tree-menu-button span {
  width: 3px;
  height: 3px;
  border-radius: 999px;
  background: currentColor;
}

.tree-menu {
  position: absolute;
  top: 32px;
  right: 0;
  z-index: 40;
  min-width: 132px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 16px 36px rgba(45, 35, 20, 0.16);
}

.tree-menu button,
.tree-menu a {
  width: 100%;
  min-height: 30px;
  display: flex;
  align-items: center;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-soft);
  padding: 0 8px;
  font-size: 12px;
  font-weight: 750;
  text-align: left;
  cursor: pointer;
}

.tree-menu button:hover,
.tree-menu a:hover {
  background: var(--paper-soft);
  color: var(--navy);
}

.sidebar-add-project-form {
  display: inline-flex;
  justify-content: flex-end;
  margin: 0;
}

.tree-add-button {
  min-height: 28px;
  border: 0;
  border-radius: 999px;
  background: rgba(22, 27, 51, 0.08);
  color: var(--navy);
  padding: 0 9px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.tree-add-button:hover {
  background: var(--navy);
  color: #ffffff;
}

.sidebar-empty-state {
  padding: 7px 30px 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.tree-rename-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  margin: 4px 0 7px 30px;
}

.tree-rename-form[hidden] {
  display: none;
}

.tree-rename-form input {
  min-width: 0;
  height: 32px;
  border: 1px solid rgba(180, 166, 141, 0.68);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 0 8px;
  font-size: 12px;
  font-weight: 650;
}

.tree-rename-form input:focus {
  border-color: rgba(22, 27, 51, 0.42);
  outline: 3px solid rgba(22, 27, 51, 0.08);
}

@media (hover: none) {
  .tree-menu-button {
    opacity: 1;
    pointer-events: auto;
  }
}

.sidebar-create-form {
  display: grid;
  margin: 4px 0 7px 28px;
}

.sidebar-create-form input {
  min-width: 0;
  height: 30px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.58);
  padding: 0 9px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
}

.sidebar-create-form input::placeholder {
  color: var(--muted);
  font-weight: 500;
}

.sidebar-create-button,
.sidebar-create-wide,
.sidebar-create-form .sidebar-create-wide {
  width: 100%;
  min-height: 32px;
  padding: 6px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 9px;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}

.sidebar-create-wide,
.sidebar-create-form .sidebar-create-wide {
  display: grid;
  grid-template-columns: 28px 15px minmax(0, 1fr);
  gap: 7px;
}

.sidebar-create-button {
  margin-bottom: 4px;
}

.sidebar-create-button:hover,
.sidebar-create-wide:hover,
.sidebar-create-form .sidebar-create-wide:hover {
  background: rgba(255, 255, 255, 0.56);
  color: var(--navy);
}

.create-tree-row {
  margin-bottom: 4px;
}

.create-icon {
  position: relative;
  flex: 0 0 auto;
}

.create-icon::after {
  content: "+";
  position: absolute;
  right: -6px;
  bottom: -5px;
  width: 12px;
  height: 12px;
  display: grid;
  place-items: center;
  border: 1px solid #ffffff;
  border-radius: 999px;
  background: var(--navy);
  color: #ffffff;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
}

.create-icon-project {
  width: 18px;
  height: 13px;
  border-radius: 4px;
  background: linear-gradient(180deg, #f6cf70, #d89c24);
  box-shadow: inset 0 -1px 0 rgba(111, 77, 7, 0.16);
}

.create-icon-project::before {
  content: "";
  position: absolute;
  left: 2px;
  top: -5px;
  width: 9px;
  height: 6px;
  border-radius: 3px 3px 0 0;
  background: #f8dc94;
}

.create-icon-document {
  width: 15px;
  height: 18px;
  border: 1.5px solid currentColor;
  border-radius: 4px;
  background: #ffffff;
}

.create-icon-document::before {
  content: "";
  position: absolute;
  top: -1.5px;
  right: -1.5px;
  width: 6px;
  height: 6px;
  border-left: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  border-radius: 0 4px 0 2px;
  background: var(--paper);
}

.doc-list {
  display: grid;
  gap: 4px;
}

.doc-item,
.project-item {
  position: relative;
  display: grid;
  grid-template-columns: 28px 15px minmax(0, 1fr);
  gap: 7px;
  align-items: center;
  min-height: 32px;
  padding: 6px 8px;
  border-radius: 8px;
  color: var(--ink-soft);
  background: transparent;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}

.project-tree,
.project-document-list {
  display: grid;
  gap: 2px;
}

.project-item {
  grid-template-columns: 22px 1fr;
}

.project-item .doc-name strong {
  display: flex;
  align-items: center;
  gap: 8px;
}

.project-title-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-public-dot {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  margin-left: auto;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 3px var(--green-soft);
}

.doc-number {
  min-width: 0;
  align-self: center;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  line-height: 1;
  opacity: 0.72;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-item.active .doc-number {
  color: var(--navy);
  opacity: 1;
}

.create-doc-number {
  opacity: 0;
}

.doc-item:hover,
.project-item:hover {
  background: rgba(255, 255, 255, 0.56);
}

.doc-item.active,
.project-item.active {
  background: rgba(22, 27, 51, 0.08);
  color: var(--navy);
}

.project-document-list {
  position: relative;
  margin: 4px 0 12px 0;
}

.tree-doc-row {
  margin-left: 28px;
}

.tree-doc-row.doc-tree-depth-1 { margin-left: 48px; }
.tree-doc-row.doc-tree-depth-2 { margin-left: 68px; }
.tree-doc-row.doc-tree-depth-3 { margin-left: 88px; }
.tree-doc-row.doc-tree-depth-4 { margin-left: 108px; }

.tree-doc-row.doc-tree-root {
  margin-top: 1px;
}

.tree-doc-row.doc-tree-child::before,
.tree-doc-row.doc-tree-child::after {
  content: "";
  position: absolute;
  background: rgba(118, 112, 102, 0.18);
}

.tree-doc-row.doc-tree-child::before {
  left: -12px;
  top: 16px;
  width: 10px;
  height: 1px;
}

.tree-doc-row.doc-tree-child::after {
  left: -12px;
  top: -3px;
  width: 1px;
  height: 20px;
}

.tree-doc-row[data-has-children="true"] > .tree-row .doc-name strong {
  font-weight: 760;
}

.tree-doc-row[data-has-children="true"] > .tree-row .doc-icon {
  background: rgba(255, 253, 248, 0.86);
  opacity: 0.86;
}

.project-icon {
  position: relative;
  width: 18px;
  height: 13px;
  border-radius: 4px;
  background: linear-gradient(180deg, #f6cf70, #d89c24);
  box-shadow: inset 0 -1px 0 rgba(111, 77, 7, 0.16);
}

.project-icon::before {
  content: "";
  position: absolute;
  left: 2px;
  top: -5px;
  width: 9px;
  height: 6px;
  border-radius: 3px 3px 0 0;
  background: #f8dc94;
}

.project-item.active .project-icon {
  background: linear-gradient(180deg, #ffd978, #de9c1b);
}

.doc-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--amber);
}

.doc-dot.verified { background: var(--green); }
.doc-dot.needs,
.doc-dot.needs_verification { background: var(--purple); }
.doc-dot.rejected { background: var(--red); }
.doc-dot.obsolete { background: var(--gray); }

.doc-icon {
  position: relative;
  width: 14px;
  height: 17px;
  border: 1.4px solid currentColor;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.56);
  color: var(--muted);
  opacity: 0.72;
}

.doc-icon::before {
  content: "";
  position: absolute;
  top: -1.4px;
  right: -1.4px;
  width: 5px;
  height: 5px;
  border-left: 1.4px solid currentColor;
  border-bottom: 1.4px solid currentColor;
  border-radius: 0 4px 0 2px;
  background: var(--paper);
}

.doc-item.active .doc-icon {
  color: var(--navy);
  opacity: 1;
}

.doc-item.active .doc-icon.verified {
  color: var(--green);
}

.doc-icon.verified { color: var(--green); }
.doc-icon.needs,
.doc-icon.needs_verification { color: var(--purple); }
.doc-icon.rejected { color: var(--red); }
.doc-icon.obsolete { color: var(--gray); }

.doc-item.active::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 7px;
  bottom: 7px;
  width: 2px;
  border-radius: 999px;
  background: var(--navy);
}

.doc-name {
  min-width: 0;
}

.doc-name strong {
  display: block;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.doc-name span {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.side-panel {
  border-radius: var(--radius-xl);
  background: rgba(255,255,255,0.52);
  border: 1px solid var(--border-soft);
  box-shadow: 0 14px 38px rgba(45, 35, 20, 0.06);
  padding: 16px;
  margin-bottom: 16px;
}

.side-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.side-title h3 {
  margin: 0;
  font-size: 14px;
  letter-spacing: 0;
}

.side-title span,
.side-title a {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

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

.verification-card {
  position: relative;
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 10px;
  padding: 12px;
  border-radius: 18px;
  background: var(--paper);
  border: 1px solid var(--border-soft);
  cursor: pointer;
  transition: 180ms ease;
}

.verification-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(45, 35, 20, 0.10);
}

.verification-card.active {
  outline: 2px solid rgba(52, 71, 255, 0.16);
  background: #ffffff;
}

.number-token {
  width: 32px;
  height: 32px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: white;
  font-weight: 800;
  font-size: 12px;
  background: var(--navy);
}

.verification-body {
  min-width: 0;
}

.verification-body strong {
  display: block;
  font-size: 13px;
  line-height: 1.28;
  letter-spacing: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.verification-body p {
  margin: 6px 0 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.status-chip,
.tt-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 800;
  border-radius: 999px;
  padding: 4px 8px;
  font-style: normal;
}

.status-chip::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: currentColor;
}

.status-chip.verified,
.tt-status-verified {
  color: var(--green);
  background: var(--green-soft);
}

.status-chip.working,
.tt-status-working {
  color: var(--amber);
  background: var(--amber-soft);
}

.status-chip.needs,
.status-chip.needs_verification,
.tt-status-needs_verification {
  color: var(--purple);
  background: var(--purple-soft);
}

.status-chip.rejected,
.tt-status-rejected {
  color: var(--red);
  background: var(--red-soft);
}

.status-chip.obsolete,
.tt-status-obsolete {
  color: var(--gray);
  background: var(--gray-soft);
}

.tt-status-bg-working { background: var(--amber); }
.tt-status-bg-needs_verification { background: var(--purple); }
.tt-status-bg-verified { background: var(--green); }
.tt-status-bg-rejected { background: var(--red); }
.tt-status-bg-obsolete { background: var(--gray); }

.graph-preview {
  height: 230px;
  border-radius: 20px;
  background:
    radial-gradient(circle at 20% 20%, rgba(52, 71, 255, 0.08), transparent 35%),
    linear-gradient(145deg, #fffdf8, #f7f1e5);
  border: 1px solid var(--border-soft);
  overflow: hidden;
}

.graph-preview svg {
  display: block;
  width: 100%;
  height: 100%;
}

.legend {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--amber);
}

.legend-dot.green { background: var(--green); }
.legend-dot.purple { background: var(--purple); }
.legend-dot.red { background: var(--red); }

.note-box {
  padding: 14px;
  border-radius: 18px;
  background: var(--blue-soft);
  border: 1px solid #d8ddff;
  color: #222a6a;
  font-size: 12px;
  line-height: 1.55;
}

.note-box strong {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
}

.selection-menu {
  position: fixed;
  z-index: 100;
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 8px;
  border-radius: 999px;
  background: rgba(22, 27, 51, 0.96);
  color: white;
  box-shadow: 0 18px 50px rgba(22, 27, 51, 0.30);
  backdrop-filter: blur(18px);
  max-width: calc(100vw - 20px);
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px) scale(0.98);
  transition: opacity 140ms ease, transform 140ms ease, visibility 140ms ease;
  visibility: hidden;
}

.selection-menu.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
  visibility: visible;
}

.selection-menu button {
  border: 0;
  background: rgba(255,255,255,0.08);
  color: white;
  border-radius: 999px;
  padding: 8px 11px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.selection-menu button.primary-pop {
  background: var(--gold);
  color: #211600;
}

.selection-menu button.copied {
  background: var(--green);
  color: white;
}

.selection-menu button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.selection-menu-message {
  display: none;
  padding: 8px 11px;
  color: white;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.selection-menu.blocked button[data-action="create"],
.selection-menu.blocked button[data-action="ask-ai"] {
  display: none;
}

.selection-menu.blocked .selection-menu-message {
  display: inline-flex;
}

.ai-settings-panel {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(22, 27, 51, 0.34);
  backdrop-filter: blur(10px);
}

.ai-settings-panel[hidden] {
  display: none;
}

.ai-settings-form {
  width: min(440px, 100%);
  display: grid;
  gap: 12px;
  padding: 18px;
  border-radius: 8px;
  background: #fffdf8;
  border: 1px solid var(--border-soft);
  box-shadow: 0 24px 70px rgba(22, 27, 51, 0.24);
  color: var(--ink);
}

.ai-settings-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.ai-settings-head h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.2;
}

.ai-settings-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.ai-settings-close {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.ai-settings-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.ai-settings-form input,
.ai-settings-form select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 10px 11px;
  font: inherit;
}

.ai-settings-message {
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.ai-settings-message.error {
  color: var(--red);
  font-weight: 800;
}

.ai-settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.ai-settings-actions button {
  border: 0;
  border-radius: 999px;
  padding: 9px 13px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.ai-settings-actions button:not(.primary-pop) {
  background: var(--paper-soft);
  color: var(--muted);
}

.ai-settings-actions .primary-pop {
  background: var(--gold);
  color: #211600;
}

.ai-settings-actions button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.ai-generation-status {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 125;
  width: min(360px, calc(100vw - 32px));
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  background: rgba(22, 27, 51, 0.96);
  color: #ffffff;
  box-shadow: 0 20px 60px rgba(22, 27, 51, 0.28);
  font-size: 13px;
  line-height: 1.45;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 150ms ease, transform 150ms ease;
}

.ai-generation-status.open {
  opacity: 1;
  transform: translateY(0);
}

.ai-generation-status::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 15px;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--gold);
  box-shadow: 0 0 0 0 rgba(201, 150, 58, 0.38);
  animation: tt-pulse 1.2s ease-out infinite;
}

.ai-generation-status strong,
.ai-generation-status span {
  display: block;
  padding-left: 18px;
}

.ai-generation-status strong {
  font-size: 13px;
}

.ai-generation-status[data-state="done"] {
  background: rgba(21, 128, 61, 0.96);
}

.ai-generation-status[data-state="done"]::before {
  background: #bbf7d0;
  animation: none;
}

.ai-generation-status[data-state="error"] {
  background: rgba(185, 28, 28, 0.96);
}

.ai-generation-status[data-state="error"]::before {
  background: #fecaca;
  animation: none;
}

@keyframes tt-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(201, 150, 58, 0.42);
  }
  100% {
    box-shadow: 0 0 0 12px rgba(201, 150, 58, 0);
  }
}

.toast {
  max-width: 360px;
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--navy);
  color: white;
  box-shadow: 0 20px 60px rgba(22, 27, 51, 0.28);
  font-size: 13px;
  line-height: 1.5;
}

.toast strong {
  display: block;
  margin-bottom: 3px;
}

.tt-toast-stack {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 120;
  display: grid;
  gap: 10px;
}

.tt-page {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.tt-split-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 0;
}

.tt-split-main {
  min-width: 0;
  padding: 32px clamp(24px, 5vw, 76px) 56px;
}

.tt-split-main > .tt-page-head,
.tt-split-main > .tt-focus-panel,
.tt-split-main > .tt-section-label,
.tt-split-main > .tt-project-grid,
.tt-split-main > .tt-document-list,
.tt-split-main > .tt-empty {
  max-width: 980px;
  margin-left: auto;
  margin-right: auto;
}

.tt-chat-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  border-left: 1px solid rgba(222, 212, 195, 0.88);
  background: rgba(255, 253, 248, 0.78);
  backdrop-filter: blur(24px);
  overflow: hidden;
}

.tt-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  min-width: 0;
}

.tt-sidebar-brand .brand-text {
  min-width: 0;
}

.tt-sidebar-brand .brand-text strong {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tt-sidebar-actions {
  flex: 0 0 auto;
}

.tt-sidebar-actions .tt-btn {
  width: 100%;
}

.tt-rail-search {
  flex: 0 0 auto;
}

.tt-rail-search input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.88);
  color: var(--ink);
  outline: none;
  padding: 0 13px;
  box-shadow: 0 8px 24px rgba(45, 35, 20, 0.04);
}

.tt-chat-sidebar .doc-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}

.tt-sidebar-footer {
  flex: 0 0 auto;
  display: grid;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
}

.tt-sidebar-footer a {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.tt-narrow {
  width: min(820px, calc(100vw - 32px));
}

.tt-editor {
  width: min(1160px, calc(100vw - 32px));
}

.tt-editor-workspace {
  width: min(1040px, 100%);
}

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

.tt-page-head h1,
.tt-danger-panel h1,
.tt-empty h2,
.tt-project-card h2 {
  margin: 0;
  color: var(--navy);
  font-size: 38px;
  line-height: 1;
  letter-spacing: 0;
}

.tt-kicker {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.tt-page-subtitle {
  max-width: 760px;
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.tt-focus-panel {
  margin-bottom: 18px;
  padding: 24px;
  border: 1px solid rgba(222, 212, 195, 0.86);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.96), rgba(251, 248, 239, 0.96));
  box-shadow: var(--shadow);
}

.tt-focus-kicker,
.tt-section-label {
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.tt-focus-kicker {
  margin-bottom: 12px;
}

.tt-section-label {
  margin-top: 24px;
  margin-bottom: 10px;
}

.tt-focus-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.tt-focus-head h2 {
  margin: 0;
  color: var(--navy);
  font-size: 34px;
  line-height: 1.05;
  letter-spacing: 0;
}

.tt-focus-head p {
  max-width: 700px;
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.tt-project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.tt-project-grid-compact {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.tt-project-card,
.tt-document-row,
.tt-empty,
.tt-danger-panel,
.tt-form {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(255, 253, 248, .86);
  box-shadow: var(--shadow-soft);
}

.tt-project-card {
  min-height: 146px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px;
}

.tt-project-card p,
.tt-document-row p,
.tt-empty p,
.tt-danger-panel p {
  color: var(--muted);
  line-height: 1.55;
}

.tt-card-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.tt-empty,
.tt-danger-panel {
  padding: 26px;
}

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

.tt-document-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 16px;
}

.tt-row-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-weight: 850;
}

.tt-document-row p {
  margin: 5px 0 0;
  font-size: 13px;
}

.tt-icon-link {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--paper);
}

.tt-form {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.tt-form-note {
  display: grid;
  gap: 5px;
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(201, 150, 58, 0.32);
  border-radius: 10px;
  background: rgba(255, 243, 206, 0.42);
  color: var(--ink-soft);
}

.tt-form-note strong {
  color: var(--navy);
  font-size: 13px;
}

.tt-form-note span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.tt-form label {
  display: grid;
  gap: 7px;
}

.tt-form label > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.tt-form input,
.tt-form textarea,
.tt-form select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  padding: 12px;
}

.tt-document-form textarea[name="raw_text"] {
  min-height: 520px;
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  line-height: 1.6;
}

.tt-document-form textarea[name="raw_text"]::placeholder {
  color: var(--muted-2);
  opacity: 1;
}

.tt-form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(180px, .8fr) minmax(150px, .5fr);
  gap: 12px;
}

.errorlist {
  margin: 0;
  padding-left: 18px;
  color: var(--red);
}

.tt-graph {
  min-height: calc(100vh - 176px);
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.tt-public-graph {
  min-height: 760px;
  height: calc(100vh - 150px);
}

.tt-public-graph-frame,
.graph-frame {
  width: min(1180px, 100%);
  max-width: 100%;
  margin: 0 auto;
  background: transparent;
  border: 0;
  box-shadow: none;
}

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

@media (max-width: 900px) {
  :root {
    --topbar: 74px;
    --mobile-header: 56px;
  }

  .app-shell,
  .tt-split-page {
    grid-template-columns: 1fr;
  }

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

  .tt-split-main {
    padding: 24px 16px 32px;
  }

  .tt-chat-sidebar {
    position: static;
    height: auto;
    max-height: none;
    border-left: 0;
    border-top: 1px solid var(--border);
    overflow: visible;
  }

  .tt-chat-sidebar .doc-list {
    overflow: visible;
  }

  .mobile-theorytrace-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 95;
    min-height: var(--mobile-header);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 14px;
    border-bottom: 1px solid rgba(222, 212, 195, 0.8);
    background: rgba(255, 253, 248, 0.94);
    backdrop-filter: blur(18px);
  }

  .mobile-brand {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    gap: 9px;
    color: var(--navy);
  }

  .mobile-brand span {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: var(--navy);
    color: #ffffff;
    font-family: "Source Serif 4", Georgia, serif;
    font-size: 26px;
    font-weight: 850;
    line-height: 1;
  }

  .mobile-brand strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 15px;
  }

  .mobile-tree-button {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--paper-soft);
    color: var(--ink-soft);
    padding: 0 12px;
    font-size: 12px;
    font-weight: 850;
    cursor: pointer;
  }

  .mobile-tree-button span[aria-hidden="true"] {
    position: relative;
    width: 14px;
    height: 10px;
    border-top: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
  }

  .mobile-tree-button span[aria-hidden="true"]::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 3px;
    border-top: 2px solid currentColor;
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 110;
    display: block;
    background: rgba(22, 27, 51, 0.36);
    backdrop-filter: blur(3px);
  }

  .sidebar-backdrop[hidden] {
    display: none;
  }

  .project-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 120;
    width: min(340px, 88vw);
    height: 100dvh;
    padding-top: 18px;
    border-left: 1px solid rgba(214, 203, 184, 0.92);
    border-top: 0;
    transform: translateX(100%);
    transition: transform 180ms ease;
    box-shadow: -24px 0 70px rgba(22, 27, 51, 0.18);
  }

  .project-sidebar.open {
    transform: translateX(0);
  }

  body.sidebar-open {
    overflow: hidden;
  }

  .sidebar-close-button {
    position: absolute;
    top: 14px;
    right: 12px;
    z-index: 2;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 999px;
    background: rgba(22, 27, 51, 0.06);
    color: var(--ink-soft);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
  }

  .project-sidebar .brand {
    padding-right: 42px;
  }

  .main-area {
    order: 1;
    padding-top: calc(var(--mobile-header) + 16px);
  }

  .topbar {
    position: sticky;
    top: var(--mobile-header);
    margin-top: 0;
    min-height: var(--topbar);
    z-index: 50;
  }

  .reader-toolbar {
    top: var(--reader-toolbar-top);
    margin: 0 -8px 22px;
    padding: 8px 8px 10px;
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .reader-toolbar-left {
    flex-wrap: nowrap;
    min-width: max-content;
    width: 100%;
  }

  .tool-chip {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .document-search {
    flex: 0 0 auto;
    margin-left: 0;
  }

  .document-search-panel {
    position: fixed;
    top: calc(var(--mobile-header) + var(--topbar) + 52px);
    left: 14px;
    right: 14px;
    width: auto;
  }

  .reader-label-main {
    align-items: flex-start;
  }

  .reader-label-actions {
    gap: 8px;
  }

  .reader-collaboration {
    gap: 6px;
  }

  .member-stack {
    max-width: 94px;
    overflow: hidden;
  }

  .header-menu-panel {
    right: -2px;
  }

  .reader-paper {
    padding: 28px 28px 44px;
  }

  .reader-frame {
    max-width: 100%;
  }

  .article [data-block-id]::before {
    display: none;
  }

  .tt-page-head,
  .tt-focus-head {
    flex-direction: column;
  }

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

@media (max-width: 640px) {
  .main-area {
    padding: calc(var(--mobile-header) + 10px) 12px 28px;
  }

  .topbar {
    margin: -10px -12px 16px;
    padding: 10px 12px;
    align-items: stretch;
  }

  .top-actions,
  .tt-actions,
  .reader-label-actions {
    justify-content: space-between;
  }

  .reader-paper {
    border-radius: 16px;
    padding: 18px;
  }

  .reader-label-main {
    gap: 10px;
    flex-wrap: wrap;
  }

  .tt-library-section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .tt-public-graph-meta {
    justify-content: flex-start;
  }

  .tt-public-graph {
    min-height: 540px;
    height: 72vh;
  }

  .member-avatar {
    width: 25px;
    height: 25px;
    font-size: 10px;
  }

  .header-icon-button {
    width: 30px;
    height: 30px;
  }

  .document-search {
    flex: 0 0 auto;
    justify-content: flex-end;
  }

  .document-search-panel {
    left: 10px;
    right: 10px;
    width: auto;
  }

  .selection-menu {
    border-radius: 18px;
    overflow-x: auto;
  }

  .ai-generation-status {
    left: 12px;
    right: 12px;
    bottom: 14px;
    width: auto;
  }

  .tt-document-form textarea[name="raw_text"] {
    min-height: calc(100dvh - 240px);
  }

  .tt-page-head h1,
  .tt-danger-panel h1,
  .tt-empty h2,
  .tt-project-card h2 {
    font-size: 28px;
  }

  .article {
    font-size: 17px;
  }
}
