@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700&family=Newsreader:opsz,wght@6..72,500;6..72,700&display=swap");
:root {
  --paper: #0d1015;
  --paper-deep: #07090d;
  --ink: #f4f0e8;
  --ink-soft: #a8a39a;
  --line: rgba(255, 255, 255, 0.08);
  --card: rgba(19, 22, 29, 0.9);
  --card-strong: #171b22;
  --accent: #ff735f;
  --accent-soft: rgba(255, 115, 95, 0.14);
  --positive: #72d39a;
  --positive-soft: rgba(114, 211, 154, 0.16);
  --negative-soft: rgba(255, 115, 95, 0.18);
  --gold: #ffc86e;
  --gold-soft: rgba(255, 200, 110, 0.14);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
  --notes-track: 340px;
  --compare-track: 340px;
  --editor-max: 1980px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Manrope", sans-serif;
  background: radial-gradient(circle at top left, rgba(255, 200, 110, 0.12), transparent 26%), radial-gradient(circle at 82% 12%, rgba(255, 115, 95, 0.1), transparent 22%), linear-gradient(180deg, #0f1218 0%, #090b10 100%);
}

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

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

input,
textarea {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  background: rgba(10, 12, 18, 0.95);
  color: var(--ink);
  padding: 0.85rem 1rem;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: rgba(255, 115, 95, 0.55);
  box-shadow: 0 0 0 4px rgba(255, 115, 95, 0.12);
}

textarea {
  min-height: 110px;
  resize: vertical;
}

::selection {
  background: rgba(255, 115, 95, 0.28);
}

.eyebrow {
  margin: 0 0 0.55rem;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.ghost-link,
.ghost-button,
.primary-button,
.danger-button,
.bubble-delete {
  border: 0;
  border-radius: 999px;
  padding: 0.78rem 1.15rem;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.ghost-link,
.ghost-button {
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.primary-button {
  background: linear-gradient(180deg, #ff7a63 0%, #ec5b4a 100%);
  color: #fff8ef;
  box-shadow: 0 12px 22px rgba(236, 91, 74, 0.24);
}

.danger-button,
.bubble-delete {
  background: rgba(255, 115, 95, 0.12);
  color: #ff8b7a;
  box-shadow: inset 0 0 0 1px rgba(255, 115, 95, 0.18);
}

.ghost-button:hover,
.ghost-link:hover,
.primary-button:hover,
.danger-button:hover,
.bubble-delete:hover {
  transform: translateY(-1px);
}

.ghost-button:disabled,
.primary-button:disabled,
.danger-button:disabled,
.bubble-delete:disabled {
  cursor: wait;
  opacity: 0.65;
  transform: none;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.field span {
  color: var(--ink-soft);
  font-size: 0.85rem;
  font-weight: 700;
}

.field-large textarea {
  min-height: 360px;
}

.field-tight textarea {
  min-height: 92px;
}

.field-hint {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.86rem;
}

.panel-error,
.selection-notice {
  margin: 0;
  color: #8c2d20;
  font-size: 0.92rem;
}

.panel-head {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.panel-head h2,
.editor-title-block h1,
.library-intro h1,
.segment-meta h2,
.not-found-shell h1 {
  margin: 0;
  font-family: "Newsreader", serif;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.panel-head-compact {
  margin-bottom: 1rem;
}

.library-shell,
.editor-shell,
.not-found-shell {
  width: min(100% - 2.4rem, var(--editor-max));
  margin: 0 auto;
  padding: 2.2rem 0 4rem;
}

.library-intro {
  max-width: 860px;
  margin-bottom: 2rem;
}

.library-intro h1 {
  font-size: clamp(2.8rem, 4.8vw, 5rem);
  line-height: 0.94;
}

.intro-copy {
  max-width: 720px;
  margin: 1rem 0 0;
  color: var(--ink-soft);
  font-size: 1.02rem;
  line-height: 1.7;
}

.library-grid,
.editor-layout {
  display: grid;
  gap: 1.4rem;
}

.library-grid {
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  align-items: start;
}

.upload-panel,
.library-panel,
.tool-card,
.editor-document-shell,
.not-found-shell,
.library-empty {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.upload-panel,
.library-panel,
.tool-card {
  padding: 1.4rem;
}

.upload-panel,
.new-label-form,
.label-card,
.tool-card,
.library-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.document-list {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.document-card {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  background: rgba(15, 18, 24, 0.92);
  padding: 1rem 1.1rem;
  text-align: left;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.document-card:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 115, 95, 0.28);
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.24);
}

.document-card-head,
.document-card-stats,
.editor-page-head,
.editor-layout {
  display: flex;
}

.document-card-head {
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.document-card h3 {
  margin: 0;
  font-family: "Newsreader", serif;
  font-size: 1.5rem;
}

.document-card-head span,
.document-card-stats {
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.document-card-stats {
  gap: 1rem;
  margin-top: 0.55rem;
}

.library-empty {
  padding: 1.5rem;
  justify-content: center;
  min-height: 220px;
}

.editor-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

.editor-loading-overlay {
  position: absolute;
  top: 0.55rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 12;
  border-radius: 999px;
  background: rgba(20, 22, 30, 0.78);
  color: rgba(255, 115, 95, 0.9);
  padding: 0.25rem 0.8rem;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  backdrop-filter: blur(10px);
  pointer-events: none;
}

.editor-page-head {
  position: relative;
  display: block;
  padding-right: 3.8rem;
  z-index: 20;
  isolation: isolate;
}

.editor-head-main {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: flex-start;
  min-width: 0;
}

.editor-title-block {
  max-width: 860px;
}

.editor-title-block h1 {
  font-size: clamp(2.2rem, 4vw, 4rem);
  line-height: 0.96;
}

.editor-subtitle {
  margin: 0.8rem 0 0;
  color: var(--ink-soft);
}

.editor-help-box {
  position: absolute;
  top: 0.1rem;
  right: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
  cursor: help;
  outline: none;
  backdrop-filter: blur(10px);
  z-index: 21;
}

.editor-help-box:focus {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02), 0 0 0 3px rgba(255, 115, 95, 0.16);
}

.editor-help-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: rgba(255, 248, 239, 0.82);
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1;
}

.editor-help-popover {
  position: absolute;
  top: calc(100% + 0.6rem);
  right: 0;
  z-index: 22;
  width: min(30rem, 100vw - 2.4rem);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  background: rgba(12, 15, 20, 0.98);
  box-shadow: 0 24px 44px rgba(0, 0, 0, 0.34);
  padding: 1rem 1.1rem 1.05rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
  pointer-events: none;
}

.editor-help-box:hover .editor-help-popover,
.editor-help-box:focus .editor-help-popover,
.editor-help-box:focus-within .editor-help-popover {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.editor-help-title {
  margin: 0 0 0.75rem;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 700;
}

.editor-help-list {
  margin: 0;
  padding-left: 1.15rem;
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.55;
}

.editor-help-list li + li {
  margin-top: 0.55rem;
}

.editor-layout {
  align-items: start;
  gap: 1.8rem;
}

.editor-stream {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-width: 0;
  width: 100%;
}

.editor-document-shell {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 1.4rem 1.6rem 1.55rem;
}

.editor-document-shell > .segment-shell + .segment-shell {
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 1.5rem;
  margin-top: 1.5rem;
}

.editor-tools {
  position: sticky;
  top: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: min(100%, 390px);
  max-height: calc(100vh - 2.4rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 0.35rem;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}

.editor-tools::-webkit-scrollbar {
  width: 8px;
}

.editor-tools::-webkit-scrollbar-track {
  background: transparent;
}

.editor-tools::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  background-clip: padding-box;
}

.editor-tools::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.22);
  background-clip: padding-box;
}

.editor-tools .tool-card {
  padding: 1rem;
  gap: 0.75rem;
}

.editor-tools textarea {
  min-height: 88px;
}

.tool-empty {
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1.6;
}

.tool-empty p {
  margin: 0;
}

.selection-summary,
.comment-editor {
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
}

.compact-panel-title {
  margin: 0;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 700;
}

.compact-status-card {
  gap: 0.55rem;
}

.compact-status-line {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.87rem;
  line-height: 1.45;
}

.attach-mode-line {
  color: #ffb4a6;
}

.compact-status-actions,
.compact-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.compact-status-buttons {
  display: flex;
  gap: 0.45rem;
}

.compact-card-head span {
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.selection-panel-head,
.comment-panel-head {
  gap: 0.9rem;
}

.active-label-display {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
}

.active-label-display p {
  margin: 0.4rem 0 0;
  color: var(--ink-soft);
  line-height: 1.55;
}

.label-swatch-large,
.label-swatch,
.label-swatch-small {
  display: inline-block;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
}

.label-swatch-large {
  width: 20px;
  height: 20px;
  margin-top: 0.15rem;
}

.label-swatch-small {
  width: 14px;
  height: 14px;
}

.label-swatch {
  width: 22px;
  height: 22px;
  border: 0;
  padding: 0;
}

.label-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.label-card {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 22px;
  background: rgba(14, 17, 23, 0.92);
  color: var(--ink);
  padding: 1rem;
  text-align: left;
}

.label-card.selected {
  border-color: rgba(255, 115, 95, 0.32);
  box-shadow: inset 0 0 0 1px rgba(255, 115, 95, 0.1);
}

.ghost-button.active-attach {
  border-color: rgba(255, 200, 110, 0.32);
  box-shadow: inset 0 0 0 1px rgba(255, 200, 110, 0.12);
  color: #ffd591;
}

.palette-label.selection-ready {
  border-color: rgba(255, 115, 95, 0.24);
  box-shadow: inset 0 0 0 1px rgba(255, 115, 95, 0.08);
}

.label-card-title {
  margin: 0;
  color: inherit;
  font-size: 1rem;
  font-weight: 700;
}

.note-placeholder,
.not-found-shell p,
.segment-text {
  color: var(--ink-soft);
}

.label-card-actions {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.segment-shell {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 2.4rem;
  align-items: start;
}

.segment-shell.suggestion-open {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.segment-overlay-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

.highlight-rect {
  position: absolute;
  border-radius: 10px;
  background: rgb(var(--highlight-rgb, 255 200 110)/0.24);
  mix-blend-mode: screen;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0), 0 0 0 1px rgba(255, 255, 255, 0.04);
  transition: background-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.highlight-rect.selected {
  background: rgb(var(--highlight-rgb, 255 200 110)/0.9);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12), 0 0 26px rgba(255, 214, 102, 0.18), 0 8px 18px rgba(0, 0, 0, 0.18);
}

.highlight-rect.related {
  background: rgb(var(--highlight-rgb, 255 200 110)/0.19);
  box-shadow: 0 0 0 1px rgba(255, 245, 214, 0.12), 0 0 26px rgba(255, 200, 110, 0.24);
}

.highlight-rect.hovered {
  background: rgb(var(--highlight-rgb, 255 200 110)/0.24);
  transform: translateY(-0.5px);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.64), 0 0 22px 4px rgba(255, 255, 255, 0.44), 0 0 48px 12px rgb(var(--highlight-rgb, 255 200 110)/0.78), 0 0 88px 20px rgb(var(--highlight-rgb, 255 200 110)/0.52);
}

.highlight-rect.hover-linked {
  background: rgb(var(--highlight-rgb, 255 200 110)/0.19);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.58), 0 0 26px 6px rgba(255, 255, 255, 0.38), 0 0 54px 14px rgb(var(--highlight-rgb, 255 200 110)/0.7), 0 0 92px 22px rgb(var(--highlight-rgb, 255 200 110)/0.46);
}

.highlight-rect.muted {
  background: rgb(var(--highlight-rgb, 255 200 110)/0.09);
}

.suggestion-boundary {
  position: absolute;
  width: 12px;
  pointer-events: none;
}

.suggestion-boundary::before,
.suggestion-boundary::after {
  content: "";
  position: absolute;
  top: 0;
  width: 3px;
  height: 100%;
  border-radius: 999px;
  background: #59b5ff;
  box-shadow: 0 0 12px rgba(89, 181, 255, 0.26);
}

.suggestion-boundary::before {
  left: 1px;
}

.suggestion-boundary::after {
  right: 1px;
}

.comment-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.comment-list-card {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  background: rgba(15, 18, 25, 0.9);
  padding: 0.95rem;
}

.comment-list-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.comment-list-card {
  text-align: left;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.comment-list-card:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 115, 95, 0.22);
}

.comment-list-card.selected {
  border-color: rgba(255, 115, 95, 0.32);
  box-shadow: inset 0 0 0 1px rgba(255, 115, 95, 0.08);
}

.comment-list-card.related {
  border-color: rgba(255, 200, 110, 0.28);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.2), 0 0 22px rgba(255, 200, 110, 0.14), inset 0 0 0 1px rgba(255, 200, 110, 0.12);
}

.comment-list-card.hover-linked {
  transform: translateY(-1px);
  border-color: rgba(255, 200, 110, 0.42);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.24), 0 0 30px rgba(255, 200, 110, 0.2), inset 0 0 0 1px rgba(255, 200, 110, 0.16);
}

.comment-list-card.muted {
  opacity: 0.48;
}

.comment-list-card.orphaned {
  background: rgba(26, 28, 35, 0.92);
  color: rgba(168, 163, 154, 0.78);
}

.comment-list-card-head span,
.comment-list-preview {
  color: var(--ink-soft);
}

.comment-list-card-head span {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.comment-list-preview {
  margin: 0.7rem 0 0;
  line-height: 1.55;
}

.segment-notes-track {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

.minimized-draft-panel {
  gap: 0.8rem;
}

.minimized-draft-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.minimized-draft-card {
  border: 1px solid rgba(255, 200, 110, 0.16);
  border-radius: 20px;
  background: rgba(19, 22, 30, 0.95);
  padding: 0.95rem 1rem;
  text-align: left;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.minimized-draft-card:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 200, 110, 0.28);
  box-shadow: 0 12px 22px rgba(0, 0, 0, 0.16);
}

.minimized-draft-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.minimized-draft-head span,
.minimized-draft-card p {
  color: var(--ink-soft);
}

.minimized-draft-head span {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.minimized-draft-card p {
  margin: 0.65rem 0 0;
  line-height: 1.55;
}

.segment-note-stack {
  position: relative;
  overflow: visible;
}

.segment-comment-composer,
.segment-suggestion-composer {
  border: 1px solid rgba(255, 115, 95, 0.14);
  border-radius: 24px;
  background: rgba(18, 21, 28, 0.96);
  box-shadow: 0 18px 32px rgba(0, 0, 0, 0.28);
  padding: 1.1rem;
}

.segment-suggestion-composer {
  border-color: rgba(114, 211, 154, 0.18);
  box-shadow: 0 18px 32px rgba(0, 0, 0, 0.28), inset 0 0 0 1px rgba(114, 211, 154, 0.05);
}

.segment-suggestion-composer-positioned {
  position: absolute;
  left: 0;
  right: 0;
}

.segment-comment-composer-positioned {
  position: absolute;
  left: 0;
  right: 0;
}

.segment-comment-composer textarea,
.segment-suggestion-composer textarea {
  min-height: 220px;
  font-size: 1rem;
  line-height: 1.6;
  background: rgba(8, 10, 15, 0.98);
}

.segment-comment-composer-head,
.segment-comment-composer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.segment-comment-composer-head {
  margin-bottom: 0.75rem;
}

.segment-comment-composer-head span {
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.segment-comment-composer-actions {
  margin-top: 0.8rem;
  flex-wrap: wrap;
}

.selected-suggestion-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  border: 1px solid rgba(114, 211, 154, 0.18);
  border-radius: 24px;
  background: rgba(18, 21, 28, 0.96);
  box-shadow: 0 18px 32px rgba(0, 0, 0, 0.28), inset 0 0 0 1px rgba(114, 211, 154, 0.05);
  padding: 1.4rem 1.6rem 1.55rem;
}

.selected-suggestion-panel-positioned {
  position: absolute;
  left: 0;
  right: 0;
}

.selected-suggestion-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.selected-suggestion-head {
  margin-bottom: 0;
}

.selected-suggestion-head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.selected-suggestion-close {
  padding: 0.55rem 0.9rem;
}

.selected-suggestion-body {
  min-height: 0;
  color: var(--ink-soft);
  font-family: "Newsreader", serif;
  font-size: 1.3rem;
  white-space: pre-wrap;
  line-height: 1.92;
}

.suggestion-run {
  white-space: pre-wrap;
}

.suggestion-run-delete,
.suggestion-run-insert {
  border-radius: 0.3rem;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.suggestion-run-delete {
  background: rgba(217, 72, 65, 0.24);
  color: #ffd8d5;
  box-shadow: inset 0 -1px 0 rgba(255, 115, 95, 0.34);
}

.suggestion-run-insert {
  background: rgba(114, 211, 154, 0.24);
  color: #dafbe5;
  box-shadow: inset 0 -1px 0 rgba(114, 211, 154, 0.3);
}

.suggestion-empty-state {
  margin: 0;
  color: var(--ink-soft);
  font-style: italic;
}

.selection-draft-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.65rem;
}

.selection-draft-summary {
  margin: 0 0 0.9rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.selection-draft-delete {
  padding: 0.55rem 0.85rem;
}

.inline-palette-popover {
  position: absolute;
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  width: min(320px, 100% - 1.5rem);
  padding: 0.7rem;
  border: 1px solid rgba(255, 200, 110, 0.2);
  border-radius: 20px;
  background: rgba(11, 13, 18, 0.98);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.34);
  transform: translate(-50%, -100%);
}

.inline-palette-popover.below {
  transform: translate(-50%, 0);
}

.highlight-action-popover {
  position: absolute;
  z-index: 4;
  pointer-events: auto;
  display: grid;
  gap: 0.55rem;
  min-width: 172px;
  padding: 0.7rem 0.8rem;
  border: 1px solid rgba(255, 200, 110, 0.18);
  border-radius: 18px;
  background: rgba(11, 13, 18, 0.98);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.34);
  transform: translate(-50%, -100%);
}

.highlight-action-popover.below {
  transform: translate(-50%, 0);
}

.highlight-action-meta {
  display: grid;
  gap: 0.18rem;
}

.highlight-action-eyebrow {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 248, 239, 0.6);
}

.highlight-action-meta strong {
  color: #fff8ef;
  font-size: 0.95rem;
}

.inline-palette-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  padding: 0.55rem 0.8rem;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.inline-palette-button,
.inline-palette-button *,
.inline-palette-button span {
  color: #fff8ef !important;
  -webkit-text-fill-color: #fff8ef;
}

.inline-palette-button:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 200, 110, 0.24);
  box-shadow: inset 0 0 0 1px rgba(255, 200, 110, 0.08);
}

.inline-palette-button.suggest-button {
  background: linear-gradient(180deg, rgba(114, 211, 154, 0.2) 0%, rgba(63, 161, 105, 0.18) 100%);
  border-color: rgba(114, 211, 154, 0.24);
  color: #d8fbe4;
}

.inline-palette-button span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-placeholder {
  display: flex;
  align-items: center;
  min-height: 140px;
  padding: 1.2rem 0.8rem 0;
  font-size: 0.94rem;
  line-height: 1.6;
}

.comment-bubble {
  position: absolute;
  left: 0;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  background: rgba(16, 19, 25, 0.96);
  box-shadow: 0 14px 24px rgba(0, 0, 0, 0.22);
  padding: 0.75rem 0.9rem;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.comment-bubble:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 115, 95, 0.22);
}

.comment-bubble.selected {
  border-color: rgba(255, 115, 95, 0.32);
  box-shadow: 0 20px 38px rgba(0, 0, 0, 0.3), inset 0 0 0 1px rgba(255, 115, 95, 0.08);
}

.comment-bubble.related {
  border-color: rgba(255, 200, 110, 0.28);
  box-shadow: 0 24px 44px rgba(0, 0, 0, 0.3), 0 0 24px rgba(255, 200, 110, 0.16), inset 0 0 0 1px rgba(255, 200, 110, 0.12);
}

.comment-bubble.hover-linked {
  border-color: rgba(255, 200, 110, 0.44);
  box-shadow: 0 26px 50px rgba(0, 0, 0, 0.32), 0 0 34px rgba(255, 200, 110, 0.24), inset 0 0 0 1px rgba(255, 200, 110, 0.2);
}

.comment-bubble.muted {
  opacity: 0.5;
}

.suggestion-bubble {
  border-color: rgba(114, 211, 154, 0.2);
  background: rgba(14, 21, 18, 0.96);
}

.suggestion-bubble:hover {
  border-color: rgba(114, 211, 154, 0.3);
}

.suggestion-bubble.selected {
  border-color: rgba(114, 211, 154, 0.36);
  box-shadow: 0 20px 38px rgba(0, 0, 0, 0.3), inset 0 0 0 1px rgba(114, 211, 154, 0.08);
}

.comment-connector {
  position: absolute;
  left: calc(-1 * var(--connector-width, 32px));
  top: 22px;
  width: var(--connector-width, 32px);
  height: 1px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.26), rgba(255, 255, 255, 0.08));
}

.note-summary-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  min-width: 0;
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.35;
}

.note-summary-author {
  flex: 0 0 auto;
  margin-left: auto;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
}

.note-summary-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.segment-story-pane {
  position: relative;
  z-index: 1;
  padding: 0;
  min-width: 0;
}

.segment-selection-notice {
  margin: 0 0 0.85rem;
}

.segment-text {
  white-space: pre-wrap;
  font-family: "Newsreader", serif;
  font-size: 1.3rem;
  line-height: 1.92;
  cursor: text;
}

.segment-text.hovering-highlight {
  cursor: pointer;
}

.not-found-shell {
  max-width: 760px;
  padding: 2rem;
}

.not-found-shell h1 {
  font-size: clamp(2.4rem, 5vw, 4rem);
}

.not-found-shell p {
  max-width: 540px;
  line-height: 1.7;
}

@media (min-width: 1100px) {
  .editor-layout {
    grid-template-columns: minmax(0, 1fr) 420px;
  }
}
@media (max-width: 1099px) {
  .editor-help-box {
    top: 0;
  }
  .editor-help-popover {
    right: 0;
    left: auto;
    width: min(30rem, 100vw - 2.4rem);
  }
  .editor-layout {
    grid-template-columns: 1fr;
  }
  .editor-tools {
    position: static;
    width: 100%;
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }
}
@media (max-width: 900px) {
  .library-grid {
    grid-template-columns: 1fr;
  }
  .segment-shell {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .segment-shell.suggestion-open {
    grid-template-columns: 1fr;
  }
  .segment-notes-track {
    order: 2;
  }
  .segment-story-pane {
    order: 1;
  }
  .comment-bubble {
    width: 100%;
  }
  .comment-connector {
    display: none;
  }
  .segment-note-stack {
    height: auto !important;
  }
  .selected-suggestion-panel-positioned {
    position: relative;
    top: auto !important;
    left: auto;
    right: auto;
  }
  .segment-comment-composer-positioned,
  .segment-suggestion-composer-positioned {
    position: relative;
    top: auto !important;
    left: auto;
    right: auto;
    margin-bottom: 0.85rem;
  }
  .comment-bubble {
    position: relative;
    top: auto !important;
    margin-bottom: 0.85rem;
  }
}
@media (max-width: 640px) {
  .library-shell,
  .editor-shell,
  .not-found-shell {
    width: min(100% - 1.25rem, var(--editor-max));
    padding-top: 1.3rem;
  }
  .upload-panel,
  .library-panel,
  .tool-card,
  .editor-document-shell,
  .not-found-shell {
    border-radius: 22px;
  }
  .library-intro h1,
  .editor-title-block h1 {
    line-height: 1;
  }
  .editor-help-box {
    width: 2.2rem;
    height: 2.2rem;
  }
  .editor-help-popover {
    width: calc(100vw - 2rem);
  }
  .segment-text {
    font-size: 1.1rem;
    line-height: 1.8;
  }
  .selected-suggestion-body {
    font-size: 1.1rem;
    line-height: 1.8;
  }
  .document-card-head {
    flex-direction: column;
    align-items: flex-start;
  }
}
