/*! tailwindcss v4.3.2 | MIT License | https://tailwindcss.com */
@layer properties {
  @supports (((-webkit-hyphens: none)) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color: rgb(from red r g b)))) {
    *, :before, :after, ::backdrop {
      --tw-rotate-x: initial;
      --tw-rotate-y: initial;
      --tw-rotate-z: initial;
      --tw-skew-x: initial;
      --tw-skew-y: initial;
      --tw-border-style: solid;
      --tw-blur: initial;
      --tw-brightness: initial;
      --tw-contrast: initial;
      --tw-grayscale: initial;
      --tw-hue-rotate: initial;
      --tw-invert: initial;
      --tw-opacity: initial;
      --tw-saturate: initial;
      --tw-sepia: initial;
      --tw-drop-shadow: initial;
      --tw-drop-shadow-color: initial;
      --tw-drop-shadow-alpha: 100%;
      --tw-drop-shadow-size: initial;
    }
  }
}

@layer theme {
  :root, :host {
    --font-sans: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji",
      "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
      "Courier New", monospace;
    --radius-sm: .25rem;
    --default-transition-duration: .15s;
    --default-transition-timing-function: cubic-bezier(.4, 0, .2, 1);
    --default-font-family: var(--font-sans);
    --default-mono-font-family: var(--font-mono);
  }
}

@layer base {
  *, :after, :before, ::backdrop {
    box-sizing: border-box;
    border: 0 solid;
    margin: 0;
    padding: 0;
  }

  ::file-selector-button {
    box-sizing: border-box;
    border: 0 solid;
    margin: 0;
    padding: 0;
  }

  html, :host {
    -webkit-text-size-adjust: 100%;
    tab-size: 4;
    line-height: 1.5;
    font-family: var(--default-font-family, ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");
    font-feature-settings: var(--default-font-feature-settings, normal);
    font-variation-settings: var(--default-font-variation-settings, normal);
    -webkit-tap-highlight-color: transparent;
  }

  hr {
    height: 0;
    color: inherit;
    border-top-width: 1px;
  }

  abbr:where([title]) {
    -webkit-text-decoration: underline dotted;
    text-decoration: underline dotted;
  }

  h1, h2, h3, h4, h5, h6 {
    font-size: inherit;
    font-weight: inherit;
  }

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

  b, strong {
    font-weight: bolder;
  }

  code, kbd, samp, pre {
    font-family: var(--default-mono-font-family, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);
    font-feature-settings: var(--default-mono-font-feature-settings, normal);
    font-variation-settings: var(--default-mono-font-variation-settings, normal);
    font-size: 1em;
  }

  small {
    font-size: 80%;
  }

  sub, sup {
    vertical-align: baseline;
    font-size: 75%;
    line-height: 0;
    position: relative;
  }

  sub {
    bottom: -.25em;
  }

  sup {
    top: -.5em;
  }

  table {
    text-indent: 0;
    border-color: inherit;
    border-collapse: collapse;
  }

  :-moz-focusring {
    outline: auto;
  }

  progress {
    vertical-align: baseline;
  }

  summary {
    display: list-item;
  }

  ol, ul, menu {
    list-style: none;
  }

  img, svg, video, canvas, audio, iframe, embed, object {
    vertical-align: middle;
    display: block;
  }

  img, video {
    max-width: 100%;
    height: auto;
  }

  button, input, select, optgroup, textarea {
    font: inherit;
    font-feature-settings: inherit;
    font-variation-settings: inherit;
    letter-spacing: inherit;
    color: inherit;
    opacity: 1;
    background-color: #0000;
    border-radius: 0;
  }

  ::file-selector-button {
    font: inherit;
    font-feature-settings: inherit;
    font-variation-settings: inherit;
    letter-spacing: inherit;
    color: inherit;
    opacity: 1;
    background-color: #0000;
    border-radius: 0;
  }

  :where(select:is([multiple], [size])) optgroup {
    font-weight: bolder;
  }

  :where(select:is([multiple], [size])) optgroup option {
    padding-inline-start: 20px;
  }

  ::file-selector-button {
    margin-inline-end: 4px;
  }

  ::placeholder {
    opacity: 1;
  }

  @supports (not ((-webkit-appearance: -apple-pay-button))) or (contain-intrinsic-size: 1px) {
    ::placeholder {
      color: currentColor;
    }

    @supports (color: color-mix(in lab, red, red)) {
      ::placeholder {
        color: color-mix(in oklab, currentcolor 50%, transparent);
      }
    }
  }

  textarea {
    resize: vertical;
  }

  ::-webkit-search-decoration {
    -webkit-appearance: none;
  }

  ::-webkit-date-and-time-value {
    min-height: 1lh;
    text-align: inherit;
  }

  ::-webkit-datetime-edit {
    display: inline-flex;
  }

  ::-webkit-datetime-edit-fields-wrapper {
    padding: 0;
  }

  ::-webkit-datetime-edit {
    padding-block: 0;
  }

  ::-webkit-datetime-edit-year-field {
    padding-block: 0;
  }

  ::-webkit-datetime-edit-month-field {
    padding-block: 0;
  }

  ::-webkit-datetime-edit-day-field {
    padding-block: 0;
  }

  ::-webkit-datetime-edit-hour-field {
    padding-block: 0;
  }

  ::-webkit-datetime-edit-minute-field {
    padding-block: 0;
  }

  ::-webkit-datetime-edit-second-field {
    padding-block: 0;
  }

  ::-webkit-datetime-edit-millisecond-field {
    padding-block: 0;
  }

  ::-webkit-datetime-edit-meridiem-field {
    padding-block: 0;
  }

  ::-webkit-calendar-picker-indicator {
    line-height: 1;
  }

  :-moz-ui-invalid {
    box-shadow: none;
  }

  button, input:where([type="button"], [type="reset"], [type="submit"]) {
    appearance: button;
  }

  ::file-selector-button {
    appearance: button;
  }

  ::-webkit-inner-spin-button {
    height: auto;
  }

  ::-webkit-outer-spin-button {
    height: auto;
  }

  [hidden]:where(:not([hidden="until-found"])) {
    display: none !important;
  }
}

@layer components;

@layer utilities {
  .invisible {
    visibility: hidden;
  }

  .visible {
    visibility: visible;
  }

  .absolute {
    position: absolute;
  }

  .fixed {
    position: fixed;
  }

  .relative {
    position: relative;
  }

  .static {
    position: static;
  }

  .block {
    display: block;
  }

  .flex {
    display: flex;
  }

  .grid {
    display: grid;
  }

  .hidden {
    display: none;
  }

  .inline {
    display: inline;
  }

  .inline-block {
    display: inline-block;
  }

  .table {
    display: table;
  }

  .table-row {
    display: table-row;
  }

  .table-row-group {
    display: table-row-group;
  }

  .border-collapse {
    border-collapse: collapse;
  }

  .transform {
    transform: var(--tw-rotate-x, ) var(--tw-rotate-y, ) var(--tw-rotate-z, ) var(--tw-skew-x, ) var(--tw-skew-y, );
  }

  .border {
    border-style: var(--tw-border-style);
    border-width: 1px;
  }

  .uppercase {
    text-transform: uppercase;
  }

  .italic {
    font-style: italic;
  }

  .underline {
    text-decoration-line: underline;
  }

  .blur {
    --tw-blur: blur(8px);
    filter: var(--tw-blur, ) var(--tw-brightness, ) var(--tw-contrast, ) var(--tw-grayscale, ) var(--tw-hue-rotate, ) var(--tw-invert, ) var(--tw-saturate, ) var(--tw-sepia, ) var(--tw-drop-shadow, );
  }

  .filter {
    filter: var(--tw-blur, ) var(--tw-brightness, ) var(--tw-contrast, ) var(--tw-grayscale, ) var(--tw-hue-rotate, ) var(--tw-invert, ) var(--tw-saturate, ) var(--tw-sepia, ) var(--tw-drop-shadow, );
  }

  .transition {
    transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to, opacity, box-shadow, transform, translate, scale, rotate, filter, -webkit-backdrop-filter, backdrop-filter, display, content-visibility, overlay, pointer-events;
    transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
    transition-duration: var(--tw-duration, var(--default-transition-duration));
  }
}

:root {
  color-scheme: light;
  --font-doc: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: "SF Mono", ui-monospace, "Cascadia Code", Menlo, Consolas, monospace;
  --paper: oklch(99.2% .006 85);
  --paper-2: oklch(97.8% .008 82);
  --app-bg: oklch(94.8% .009 78);
  --panel: oklch(98.5% .006 82);
  --panel-2: oklch(96.5% .008 80);
  --ink: oklch(28.5% .012 55);
  --ink-soft: oklch(43.5% .012 60);
  --muted: oklch(57.5% .01 65);
  --faint: oklch(70% .008 72);
  --line: oklch(88.5% .008 72);
  --line-soft: oklch(93% .007 76);
  --accent: oklch(56.5% .13 42);
  --accent-deep: oklch(47% .12 42);
  --accent-wash: oklch(95.5% .028 48);
  --accent-line: oklch(84% .06 46);
  --ok: oklch(52% .09 150);
  --warn-fg: oklch(52% .11 70);
  --warn-bg: oklch(95.5% .045 80);
  --new-fg: oklch(52% .12 42);
  --new-bg: oklch(94.5% .035 48);
  --exist-fg: oklch(47% .07 158);
  --exist-bg: oklch(95% .03 158);
  --kraft: oklch(92.6% .018 82);
  --kraft-2: oklch(90.5% .022 82);
  --radius: 10px;
  --radius-sm: 7px;
  --shadow-card: 0 1px 2px #3c2d1e0d, 0 8px 24px -12px #3c2d1e2e;
  --shadow-pop: 0 12px 40px -8px #32261947, 0 0 0 1px #3c2d1e0f;
}

html.dark {
  color-scheme: dark;
  --paper: oklch(25.5% .007 78);
  --paper-2: oklch(30% .008 78);
  --app-bg: oklch(18.5% .006 74);
  --panel: oklch(22.5% .007 76);
  --panel-2: oklch(28.5% .008 78);
  --ink: oklch(93.5% .008 80);
  --ink-soft: oklch(80% .009 76);
  --muted: oklch(66% .01 72);
  --faint: oklch(52% .01 70);
  --line: oklch(36% .008 72);
  --line-soft: oklch(30% .008 74);
  --accent: oklch(70% .135 46);
  --accent-deep: oklch(62% .125 44);
  --accent-wash: oklch(33% .05 46);
  --accent-line: oklch(44% .07 46);
  --ok: oklch(70% .12 152);
  --warn-fg: oklch(80% .11 78);
  --warn-bg: oklch(33% .05 80);
  --new-fg: oklch(75% .12 46);
  --new-bg: oklch(32% .05 48);
  --exist-fg: oklch(74% .09 158);
  --exist-bg: oklch(30% .05 158);
  --kraft: oklch(21.5% .009 82);
  --kraft-2: oklch(26% .011 82);
  --shadow-card: 0 1px 2px #0006, 0 8px 24px -12px #0009;
  --shadow-pop: 0 12px 40px -8px #000000b3, 0 0 0 1px #ffffff0d;
}

html.dark :where(.pact-desk-content, .diff-paper, .docx-preview) {
  --paper: oklch(99.2% .006 85);
  --paper-2: oklch(97.8% .008 82);
  --ink: oklch(28.5% .012 55);
  --ink-soft: oklch(43.5% .012 60);
  --muted: oklch(57.5% .01 65);
  --faint: oklch(70% .008 72);
  --line: oklch(88.5% .008 72);
  --line-soft: oklch(93% .007 76);
  --accent-wash: oklch(95.5% .028 48);
  --accent-line: oklch(84% .06 46);
  --ok: oklch(52% .09 150);
  --warn-fg: oklch(52% .11 70);
  --warn-bg: oklch(95.5% .045 80);
  --new-fg: oklch(52% .12 42);
  --new-bg: oklch(94.5% .035 48);
  --exist-fg: oklch(47% .07 158);
  --exist-bg: oklch(95% .03 158);
  --shadow-card: 0 1px 2px #3c2d1e0d, 0 8px 24px -12px #3c2d1e2e;
}

html.dark .rm-with-pagination {
  box-shadow: 0 1px 2px #00000059, 0 14px 36px -14px #000000a6;
}

html.dark .btn.primary, html.dark .user-avatar, html.dark .import-step.done .import-step-dot, html.dark .sug-avatar, html.dark .cmp-badge, html.dark .ws-settings-member-avatar {
  color: oklch(99% .004 85);
}

html.dark .sel-tools {
  background: oklch(30% .008 70);
}

html.dark .sel-tools button {
  color: oklch(95% .006 80);
}

html.dark .rail-new:hover, html.dark .tfolder:hover, html.dark .tleaf:hover, html.dark .ws-switcher-btn:hover, html.dark .ws-rail-settings-link:hover {
  background: #ffffff0f;
}

html.dark .tag-chip {
  background: #ffffff0d;
}

html.dark .src-badge.docx {
  color: oklch(82% .08 250);
  background: oklch(30% .05 250);
  border-color: oklch(42% .06 250);
}

html, body, #root {
  background: var(--app-bg);
  height: 100%;
  margin: 0;
  overflow: hidden;
}

.pact-print {
  display: none;
}

@media print {
  html, body, #root {
    background: #fff;
    height: auto;
    overflow: visible;
  }

  .app > .topbar, .app > .layout {
    display: none !important;
  }

  .pact-print {
    font-family: var(--font-doc);
    color: #1a1a1a;
    background: #fff;
    padding: .5in .75in;
    font-size: 12pt;
    line-height: 1.6;
    display: block;
    position: absolute;
    inset: 0;
  }

  .pact-print h1 {
    text-align: center;
    font-size: 18pt;
  }

  .pact-print h2 {
    margin-top: 16pt;
    font-size: 13pt;
  }

  .pact-print h3 {
    font-size: 12pt;
  }

  .pact-print table {
    border-collapse: collapse;
    width: 100%;
  }

  .pact-print td, .pact-print th {
    border: 1px solid #999;
    padding: 4pt 8pt;
  }

  .pact-print .vchip {
    color: inherit;
    font-family: inherit;
    font-weight: inherit;
    font-size: inherit;
    background: none;
    border: none;
    padding: 0;
  }
}

.app {
  font-family: var(--font-ui);
  color: var(--ink);
  background: var(--app-bg);
  -webkit-font-smoothing: antialiased;
  flex-direction: column;
  height: 100%;
  display: flex;
}

.app *, .app :before, .app :after {
  box-sizing: border-box;
}

.topbar {
  background: var(--kraft);
  flex: 0 0 46px;
  align-items: center;
  gap: 14px;
  height: 46px;
  padding: 0 16px;
  display: flex;
}

.topbar .spacer {
  flex: 1;
}

.topbar .crumbs {
  color: var(--muted);
  align-items: center;
  gap: 8px;
  font-size: 12px;
  display: flex;
}

.topbar .crumbs b {
  color: var(--ink);
  font-weight: 600;
}

.topbar .crumbs .sep {
  color: var(--faint);
}

.brand {
  align-items: center;
  gap: 9px;
  display: flex;
}

.brand .seal {
  flex: 0 0 24px;
  justify-content: center;
  align-items: center;
  width: 24px;
  height: 24px;
  display: flex;
}

.brand .wordmark {
  font-family: var(--font-doc);
  letter-spacing: .02em;
  font-size: 16px;
  font-weight: 600;
}

.btn {
  font-family: var(--font-ui);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  display: inline-flex;
}

.btn:hover {
  background: var(--panel-2);
}

.btn .ico {
  width: 13px;
  height: 13px;
}

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

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

.btn.ghost {
  color: var(--ink-soft);
  background: none;
  border-color: #0000;
}

.btn.ghost:hover {
  background: var(--panel-2);
}

.btn.sm {
  padding: 5px 9px;
  font-size: 11px;
}

.pill {
  letter-spacing: .03em;
  text-transform: uppercase;
  border-radius: 20px;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
}

.pill .dot {
  border-radius: 50%;
  width: 6px;
  height: 6px;
}

.pill.draft {
  color: var(--muted);
  background: var(--panel-2);
}

.pill.draft .dot {
  background: var(--faint);
}

.pill.review {
  color: var(--warn-fg);
  background: var(--warn-bg);
}

.pill.review .dot {
  background: var(--warn-fg);
}

.pill.approved {
  color: var(--ok);
  background: var(--exist-bg);
}

.pill.approved .dot {
  background: var(--ok);
}

.pill.sent {
  color: var(--accent-deep);
  background: var(--accent-wash);
}

.pill.sent .dot {
  background: var(--accent);
}

.vbadge {
  font-family: var(--font-mono);
  color: var(--ink-soft);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 600;
}

.layout {
  flex: 1;
  min-height: 0;
  display: flex;
}

.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--line);
  flex-direction: column;
  flex: 0 0 232px;
  gap: 4px;
  width: 232px;
  padding: 18px 14px;
  display: flex;
}

.nav-group-label {
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--faint);
  padding: 14px 10px 6px;
  font-size: 11px;
  font-weight: 700;
}

.nav-item {
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  cursor: pointer;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  font-size: 13.5px;
  font-weight: 500;
  display: flex;
}

.nav-item .ico {
  width: 16px;
  height: 16px;
  color: var(--muted);
  flex: 0 0 16px;
}

.nav-item .count {
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  margin-left: auto;
  font-size: 12px;
}

.nav-item:hover {
  background: var(--panel-2);
}

.nav-item.active {
  background: var(--accent-wash);
  color: var(--accent-deep);
  font-weight: 600;
}

.nav-item.active .ico {
  color: var(--accent);
}

.main {
  flex-direction: column;
  flex: 1;
  min-width: 0;
  display: flex;
  overflow: hidden;
}

.main-head {
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  padding: 26px 32px 18px;
  display: flex;
}

.main-head h1 {
  font-family: var(--font-doc);
  letter-spacing: -.01em;
  margin: 0;
  font-size: 26px;
  font-weight: 600;
}

.main-head .sub {
  color: var(--muted);
  margin-top: 5px;
  font-size: 13px;
}

.main-body {
  flex: 1;
  padding: 0 32px 32px;
  overflow: auto;
}

.search {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--muted);
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  font-size: 13px;
  display: flex;
}

.ctable {
  border-collapse: collapse;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  width: 100%;
  overflow: hidden;
}

.ctable thead th {
  text-align: left;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--faint);
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  padding: 12px 18px;
  font-size: 11px;
  font-weight: 700;
}

.ctable thead th.r {
  text-align: right;
}

.ctable tbody td {
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
  padding: 15px 18px;
  font-size: 13.5px;
}

.ctable tbody tr:last-child td {
  border-bottom: none;
}

.ctable tbody tr:hover {
  background: var(--paper-2);
  cursor: pointer;
}

.ctable .cname {
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 600;
}

.ctable .cmeta {
  color: var(--muted);
  margin-top: 2px;
  font-size: 12px;
}

.ctable .doc-ico {
  background: var(--paper);
  border: 1px solid var(--line);
  width: 34px;
  height: 42px;
  box-shadow: var(--shadow-card);
  border-radius: 4px;
  flex: 0 0 34px;
  position: relative;
}

.ctable .doc-ico:before {
  content: "";
  background: var(--accent);
  border-radius: 2px;
  height: 2px;
  position: absolute;
  top: 7px;
  left: 6px;
  right: 6px;
}

.ctable .doc-ico:after {
  content: "";
  background: repeating-linear-gradient(180deg, var(--line) 0 1px, transparent 1px 5px);
  position: absolute;
  inset: 13px 12px 7px 6px;
}

.cell-name {
  align-items: center;
  gap: 13px;
  display: flex;
}

.tpl-flag {
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--accent-deep);
  background: var(--accent-wash);
  border: 1px solid var(--accent-line);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 700;
}

.editor {
  flex: 1;
  min-height: 0;
  display: flex;
}

.editor-left-head {
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  flex: 0 0 44px;
  align-items: center;
  gap: 12px;
  height: 44px;
  padding: 0 14px;
  display: flex;
}

.form-scroll {
  background: var(--panel);
  flex: 1;
  padding: 6px 0 20px;
  overflow: auto;
}

.src-textarea {
  color: oklch(80% .012 75);
  font-family: var(--font-mono);
  resize: none;
  tab-size: 2;
  white-space: pre;
  background: oklch(30% .012 60);
  border: none;
  outline: none;
  flex: 1;
  padding: 14px 16px;
  font-size: 12.5px;
  line-height: 1.75;
  overflow: auto;
}

.resize-handle {
  cursor: col-resize;
  background: var(--line);
  z-index: 2;
  flex: 0 0 1px;
  width: 1px;
  position: relative;
}

.resize-handle:after {
  content: "";
  z-index: 1;
  position: absolute;
  inset: 0 -3px;
}

.resize-handle:hover, .resize-handle:active {
  background: var(--accent);
}

.side-panel {
  background: var(--panel);
  border-left: 1px solid var(--line);
  flex-direction: column;
  flex: none;
  min-height: 0;
  display: flex;
}

.side-panel-head {
  border-bottom: 1px solid var(--line);
  flex: 0 0 44px;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 18px;
  display: flex;
}

.src-badge {
  letter-spacing: .04em;
  text-transform: uppercase;
  border-radius: 4px;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
}

.src-badge.web {
  color: var(--accent-deep);
  background: var(--accent-wash);
  border: 1px solid var(--accent-line);
}

.src-badge.docx {
  color: oklch(40% .1 250);
  background: oklch(95% .03 250);
  border: 1px solid oklch(85% .05 250);
}

.version-row {
  cursor: pointer;
  border-bottom: 1px solid var(--line-soft);
  gap: 12px;
  padding: 12px 20px;
  display: flex;
  position: relative;
}

.version-row:hover {
  background: var(--paper-2);
}

.version-row.active {
  background: var(--accent-wash);
}

.version-node {
  background: var(--paper);
  border: 2.5px solid var(--line);
  border-radius: 50%;
  flex: 0 0 12px;
  width: 12px;
  height: 12px;
  margin-top: 3px;
}

.version-row.active .version-node {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-wash);
}

.version-node.draft {
  border-style: dashed;
}

.draft-band {
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--panel-2);
  border: 1px dashed var(--line);
  border-radius: 4px;
  padding: 1px 7px;
  font-size: 10px;
  font-weight: 700;
}

.diff-line {
  white-space: pre-wrap;
  word-break: break-all;
  padding: 1px 18px;
  display: flex;
}

.diff-line.add {
  background: var(--ok);
}

@supports (color: color-mix(in lab, red, red)) {
  .diff-line.add {
    background: color-mix(in oklch, var(--ok) 10%, var(--paper));
  }
}

.diff-line.remove {
  background: var(--accent);
}

@supports (color: color-mix(in lab, red, red)) {
  .diff-line.remove {
    background: color-mix(in oklch, var(--accent) 10%, var(--paper));
  }
}

.diff-gutter {
  text-align: center;
  -webkit-user-select: none;
  user-select: none;
  width: 18px;
  color: var(--faint);
  flex: 0 0 18px;
}

.diff-line.add .diff-gutter {
  color: var(--ok);
}

.diff-line.remove .diff-gutter {
  color: var(--accent-deep);
}

.diff-text {
  flex: 1;
  min-width: 0;
}

.diff-line.add .diff-text {
  color: var(--ok);
}

.diff-line.remove .diff-text {
  color: var(--accent-deep);
  text-decoration: line-through;
}

.fgroup {
  border-bottom: 1px solid var(--line-soft);
}

.fgroup-head {
  cursor: pointer;
  align-items: center;
  gap: 9px;
  padding: 13px 20px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
}

.fgroup-head .chev {
  color: var(--muted);
  transition: transform .15s;
}

.fgroup-head .gcount {
  color: var(--faint);
  margin-left: auto;
  font-size: 11px;
}

.fgroup-body {
  flex-direction: column;
  gap: 13px;
  padding: 2px 20px 16px;
  display: flex;
}

.fgroup.collapsed .fgroup-body {
  display: none;
}

.fgroup.collapsed .chev {
  transform: rotate(-90deg);
}

.input-money {
  position: relative;
}

.input-money:before {
  content: "$";
  color: var(--muted);
  font-size: 13px;
  position: absolute;
  top: 50%;
  left: 11px;
  transform: translateY(-50%);
}

.input-money .input {
  font-variant-numeric: tabular-nums;
  padding-left: 22px;
}

.callout {
  border-left: 3px solid var(--line);
  background: var(--paper-2);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--ink-soft);
  padding: 13px 18px;
  font-size: 13.5px;
  line-height: 1.5;
}

.callout strong {
  color: var(--ink);
}

.preview-pane {
  background: var(--app-bg);
  flex-direction: column;
  flex: 1;
  min-width: 0;
  display: flex;
  overflow: hidden;
}

.preview-bar {
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  flex: 0 0 44px;
  align-items: center;
  gap: 12px;
  height: 44px;
  padding: 0 18px;
  display: flex;
}

.preview-bar .zoom {
  color: var(--muted);
  align-items: center;
  gap: 8px;
  margin-left: auto;
  font-size: 12px;
  display: flex;
}

.preview-scroll {
  flex-direction: column;
  flex: 1;
  align-items: center;
  gap: 22px;
  padding: 26px;
  display: flex;
  overflow: auto;
}

.desk {
  background: var(--app-bg);
  flex-direction: column;
  align-items: center;
  gap: 22px;
  min-height: 100%;
  padding: 26px 20px 40px;
  display: flex;
}

.src-pane {
  background: oklch(30% .012 60);
  flex-direction: column;
  flex: 0 0 50%;
  width: 50%;
  min-height: 0;
  display: flex;
}

.src-head {
  background: oklch(26% .012 60);
  border-bottom: 1px solid oklch(36% .012 60);
  flex: 0 0 40px;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 16px;
  display: flex;
}

.src-head .fname {
  font-family: var(--font-mono);
  color: oklch(82% .01 70);
  font-size: 12px;
}

.import-steps {
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  gap: 0;
  padding: 20px 40px;
  display: flex;
}

.import-step {
  color: var(--faint);
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
}

.import-step + .import-step:before {
  content: "";
  background: var(--line);
  width: 24px;
  height: 1px;
  margin-right: 8px;
  display: block;
}

.import-step.active {
  color: var(--ink);
  font-weight: 600;
}

.import-step.done {
  color: var(--ok);
}

.import-step-dot {
  border: 2px solid var(--line);
  width: 22px;
  height: 22px;
  color: var(--faint);
  border-radius: 50%;
  justify-content: center;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  display: flex;
}

.import-step.active .import-step-dot {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-wash);
}

.import-step.done .import-step-dot {
  border-color: var(--ok);
  color: var(--paper);
  background: var(--ok);
}

.import-var-row {
  border-radius: var(--radius-sm);
  cursor: pointer;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  display: flex;
}

.import-var-row:hover {
  background: var(--paper-2);
}

.import-var-row input[type="checkbox"] {
  accent-color: var(--accent);
  flex: none;
}

.import-spinner {
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  margin: 0 auto;
  animation: .8s linear infinite spin;
}

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

.mode-toggle {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px;
  display: flex;
}

.mode-toggle button {
  font-family: var(--font-ui);
  color: var(--muted);
  cursor: pointer;
  background: none;
  border: 0;
  border-radius: 4px;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 600;
  display: flex;
}

.mode-toggle button .ico {
  width: 12px;
  height: 12px;
}

.mode-toggle button.on {
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 1px 2px #00000012;
}

.row {
  align-items: center;
  gap: 10px;
  display: flex;
}

.muted {
  color: var(--muted);
}

.mono {
  font-family: var(--font-mono);
}

.tag-chip {
  letter-spacing: .02em;
  color: var(--tag-color, var(--accent));
  background: var(--tag-color, var(--accent));
  font-size: 11px;
  font-weight: 600;
}

@supports (color: color-mix(in lab, red, red)) {
  .tag-chip {
    background: color-mix(in oklch, var(--tag-color, var(--accent)) 12%, var(--paper));
  }
}

.tag-chip {
  border: 1px solid var(--tag-color, var(--accent));
}

@supports (color: color-mix(in lab, red, red)) {
  .tag-chip {
    border: 1px solid color-mix(in oklch, var(--tag-color, var(--accent)) 25%, var(--paper));
  }
}

.tag-chip {
  white-space: nowrap;
  border-radius: 4px;
  padding: 1px 7px;
  text-decoration: none;
}

.tag-add-btn {
  border: 1px dashed var(--line);
  width: 20px;
  height: 20px;
  color: var(--faint);
  cursor: pointer;
  background: none;
  border-radius: 4px;
  justify-content: center;
  align-items: center;
  font-size: 13px;
  line-height: 1;
  display: flex;
}

.tag-add-btn:hover {
  background: var(--panel-2);
  color: var(--ink-soft);
}

.tag-picker {
  z-index: 10;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-pop);
  min-width: 200px;
  margin-top: 4px;
  padding: 6px 0;
  position: absolute;
  top: 100%;
  left: 0;
}

.tag-picker-row {
  cursor: pointer;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  font-size: 13px;
  display: flex;
}

.tag-picker-row:hover {
  background: var(--panel-2);
}

.tag-picker-row input[type="checkbox"] {
  accent-color: var(--accent);
}

.tag-picker-new {
  border-top: 1px solid var(--line-soft);
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  padding: 6px 12px;
  display: flex;
}

.tag-manager-row {
  border-bottom: 1px solid var(--line-soft);
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  display: flex;
}

.tag-manager-row:last-of-type {
  border-bottom: none;
}

.tag-manager-new {
  border-top: 1px solid var(--line);
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  display: flex;
}

.modal-overlay {
  z-index: 50;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  background: #0000004d;
  justify-content: center;
  align-items: center;
  display: flex;
  position: fixed;
  inset: 0;
}

.modal {
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
  box-sizing: border-box;
  flex-direction: column;
  width: 440px;
  max-height: 85vh;
  display: flex;
}

.modal-head {
  border-bottom: 1px solid var(--line);
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px 16px;
  display: flex;
}

.modal-body {
  padding: 16px 24px 24px;
  overflow: auto;
}

.user-avatar {
  background: var(--accent);
  width: 32px;
  height: 32px;
  color: var(--paper);
  font-family: var(--font-doc);
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  border-radius: 50%;
  justify-content: center;
  align-items: center;
  font-size: 14px;
  font-weight: 700;
  display: flex;
}

.user-avatar:hover {
  background: var(--accent-deep);
}

.user-menu {
  z-index: 20;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-pop);
  min-width: 200px;
  margin-top: 6px;
  position: absolute;
  top: 100%;
  right: 0;
  overflow: hidden;
}

.user-menu-item {
  width: 100%;
  font-family: var(--font-ui);
  color: var(--ink-soft);
  cursor: pointer;
  text-align: left;
  background: none;
  border: none;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 13px;
  display: flex;
}

.user-menu-item:hover {
  background: var(--panel-2);
}

.docs {
  font-family: var(--font-ui);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  flex-direction: column;
  height: 100%;
  display: flex;
}

.docs *, .docs :before, .docs :after {
  box-sizing: border-box;
}

.docs-nav {
  border-bottom: 1px solid var(--line);
  flex: 0 0 56px;
  align-items: center;
  gap: 18px;
  height: 56px;
  padding: 0 24px;
  display: flex;
}

.docs-layout {
  flex: 1;
  min-height: 0;
  display: flex;
}

.docs-sidebar {
  border-right: 1px solid var(--line);
  flex-direction: column;
  flex: 0 0 220px;
  gap: 2px;
  width: 220px;
  padding: 16px 12px;
  display: flex;
  overflow: auto;
}

.docs-main {
  flex: 1;
  overflow: auto;
}

.docs-content {
  max-width: 700px;
  color: var(--ink-soft);
  padding: 36px 48px 80px;
  font-size: 15px;
  line-height: 1.65;
}

.docs-content h2 {
  font-family: var(--font-doc);
  color: var(--ink);
  letter-spacing: -.01em;
  margin: 0 0 14px;
  padding-top: 8px;
  font-size: 24px;
  font-weight: 600;
}

.docs-content h4 {
  color: var(--ink);
  margin: 20px 0 6px;
  font-size: 14px;
  font-weight: 700;
}

.docs-content p {
  margin: 0 0 12px;
}

.docs-content a {
  color: var(--accent);
  font-weight: 500;
  text-decoration: none;
}

.docs-content a:hover {
  text-decoration: underline;
}

.docs-content ol, .docs-content ul {
  margin: 0 0 14px;
  padding-left: 22px;
}

.docs-content li {
  margin-bottom: 6px;
}

.docs-content code {
  font-family: var(--font-mono);
  background: var(--paper-2);
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 13px;
}

.docs-content strong {
  color: var(--ink);
}

.docs-code {
  font-family: var(--font-mono);
  color: oklch(82% .01 75);
  border-radius: var(--radius-sm);
  background: oklch(30% .012 60);
  margin: 12px 0 16px;
  padding: 16px 18px;
  font-size: 12.5px;
  line-height: 1.7;
  overflow-x: auto;
}

.docs-code code {
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
  padding: 0;
}

.docs-feature {
  align-items: flex-start;
  gap: 14px;
  padding: 14px 0;
  display: flex;
}

.docs-feature-ico {
  background: var(--accent-wash);
  width: 36px;
  height: 36px;
  color: var(--accent);
  border-radius: 8px;
  flex: 0 0 36px;
  justify-content: center;
  align-items: center;
  display: flex;
}

.docx-preview p {
  margin: 0 0 8px;
}

.docx-preview table {
  border-collapse: collapse;
  width: 100%;
  margin: 12px 0;
}

.docx-preview td {
  border: 1px solid var(--line);
  vertical-align: top;
  padding: 6px 8px;
  font-size: 14px;
}

.docx-preview hr.page-break {
  border: none;
  border-top: 2px dashed var(--line);
  margin: 24px 0;
  position: relative;
}

.docx-preview hr.page-break:after {
  content: "page break";
  color: var(--faint);
  background: var(--paper);
  font-size: 10px;
  font-family: var(--font-ui);
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 0 6px;
  position: absolute;
  top: -10px;
  right: 0;
}

.docx-preview ins {
  color: var(--ok);
  background: var(--ok);
}

@supports (color: color-mix(in lab, red, red)) {
  .docx-preview ins {
    background: color-mix(in oklch, var(--ok) 12%, var(--paper));
  }
}

.docx-preview ins {
  border-radius: 2px;
  padding: 0 1px;
  text-decoration: none;
}

.docx-preview del {
  color: var(--accent-deep);
  background: var(--accent);
}

@supports (color: color-mix(in lab, red, red)) {
  .docx-preview del {
    background: color-mix(in oklch, var(--accent) 12%, var(--paper));
  }
}

.docx-preview del {
  border-radius: 2px;
  padding: 0 1px;
  text-decoration: line-through;
}

.workspace-table {
  border-collapse: collapse;
  width: 100%;
}

.workspace-table tr {
  cursor: pointer;
  border-bottom: 1px solid var(--line-soft);
}

.workspace-table tr:hover {
  background: var(--paper-2);
}

.workspace-table td {
  vertical-align: middle;
  padding: 12px 20px;
  font-size: 14px;
}

.workspace-table .doc-name {
  color: var(--ink);
  font-weight: 500;
}

.workspace-table .doc-meta {
  color: var(--muted);
  white-space: nowrap;
  width: 1%;
  font-size: 12px;
  text-decoration: none;
}

.workspace-table .doc-actions {
  white-space: nowrap;
  width: 1%;
  text-decoration: none;
}

.field {
  flex-direction: column;
  gap: 5px;
  display: flex;
}

.field label {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
}

.input {
  font-family: var(--font-ui);
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  width: 100%;
  padding: 8px 11px;
  font-size: 13px;
}

.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
  outline: none;
}

.skel {
  background: linear-gradient(90deg, var(--line-soft) 25%, var(--line) 50%, var(--line-soft) 75%);
  background-size: 200% 100%;
  border-radius: 4px;
  animation: 1.5s infinite skel-shimmer;
}

.skel-btn {
  border-radius: var(--radius-sm);
  width: 64px;
  height: 28px;
}

.skel-avatar {
  border-radius: 50%;
  width: 30px;
  height: 30px;
}

@keyframes skel-shimmer {
  0% {
    background-position: -200% 0;
  }

  100% {
    background-position: 200% 0;
  }
}

.docs-prose {
  font-family: var(--font-doc);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.7;
}

.docs-prose h1 {
  letter-spacing: -.01em;
  margin: 0 0 16px;
  font-size: 28px;
  font-weight: 700;
}

.docs-prose h2 {
  margin: 36px 0 12px;
  font-size: 20px;
  font-weight: 600;
}

.docs-prose p {
  color: var(--ink-soft);
  margin: 0 0 14px;
}

.docs-prose ul {
  margin: 0 0 16px;
  padding-left: 22px;
}

.docs-prose li {
  color: var(--ink-soft);
  margin-bottom: 6px;
  line-height: 1.65;
}

.docs-prose strong {
  color: var(--ink);
  font-weight: 600;
}

.docs-prose code {
  font-family: var(--font-mono);
  background: var(--paper-2);
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 13px;
}

.docs-prose kbd {
  font-family: var(--font-mono);
  background: var(--paper-2);
  border: 1px solid var(--line);
  box-shadow: 0 1px 0 var(--line);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 12px;
}

.docs-prose .docs-shortcut-table {
  border-collapse: collapse;
  width: 100%;
  margin: 16px 0 24px;
  font-size: 14px;
}

.docs-prose .docs-shortcut-table th {
  text-align: left;
  font-family: var(--font-ui);
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  border-bottom: 2px solid var(--line);
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 700;
}

.docs-prose .docs-shortcut-table td {
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink-soft);
  font-family: var(--font-ui);
  padding: 8px 12px;
}

.docs-prose .docs-shortcut-table tr:last-child td {
  border-bottom: none;
}

.toast-stack {
  z-index: 100;
  flex-direction: column;
  gap: 8px;
  display: flex;
  position: fixed;
  bottom: 20px;
  right: 20px;
}

.toast {
  border-radius: var(--radius-sm);
  font-family: var(--font-ui);
  box-shadow: var(--shadow-pop);
  align-items: center;
  gap: 8px;
  min-width: 200px;
  max-width: 400px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  animation: .2s toast-in;
  display: flex;
}

.toast-error {
  background: var(--accent-wash);
  color: var(--accent-deep);
  border: 1px solid var(--accent-line);
}

.toast-success {
  background: var(--exist-bg);
  color: var(--exist-fg);
  border: 1px solid var(--ok);
}

@supports (color: color-mix(in lab, red, red)) {
  .toast-success {
    border: 1px solid color-mix(in oklch, var(--ok) 30%, transparent);
  }
}

.toast-info {
  background: var(--paper);
  color: var(--ink-soft);
  border: 1px solid var(--line);
}

.toast-close {
  color: inherit;
  opacity: .5;
  cursor: pointer;
  background: none;
  border: 0;
  margin-left: auto;
  padding: 2px;
}

.toast-close:hover {
  opacity: 1;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@property --tw-rotate-x {
  syntax: "*";
  inherits: false
}

@property --tw-rotate-y {
  syntax: "*";
  inherits: false
}

@property --tw-rotate-z {
  syntax: "*";
  inherits: false
}

@property --tw-skew-x {
  syntax: "*";
  inherits: false
}

@property --tw-skew-y {
  syntax: "*";
  inherits: false
}

@property --tw-border-style {
  syntax: "*";
  inherits: false;
  initial-value: solid;
}

@property --tw-blur {
  syntax: "*";
  inherits: false
}

@property --tw-brightness {
  syntax: "*";
  inherits: false
}

@property --tw-contrast {
  syntax: "*";
  inherits: false
}

@property --tw-grayscale {
  syntax: "*";
  inherits: false
}

@property --tw-hue-rotate {
  syntax: "*";
  inherits: false
}

@property --tw-invert {
  syntax: "*";
  inherits: false
}

@property --tw-opacity {
  syntax: "*";
  inherits: false
}

@property --tw-saturate {
  syntax: "*";
  inherits: false
}

@property --tw-sepia {
  syntax: "*";
  inherits: false
}

@property --tw-drop-shadow {
  syntax: "*";
  inherits: false
}

@property --tw-drop-shadow-color {
  syntax: "*";
  inherits: false
}

@property --tw-drop-shadow-alpha {
  syntax: "<percentage>";
  inherits: false;
  initial-value: 100%;
}

@property --tw-drop-shadow-size {
  syntax: "*";
  inherits: false
}
/* ============================================================
   PACT v3 Editor — paginated rich text surface
   ============================================================ */

/* ===== v3 FORMAT TOOLBAR ================================== */
.fmtbar {
  height: 36px;
  flex: 0 0 36px;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 10px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.fbtn {
  width: 26px;
  height: 26px;
  border-radius: 5px;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-family: var(--font-doc);
  font-size: 12px;
}
.fbtn:hover {
  background: var(--panel-2);
}
.fbtn.on {
  background: var(--accent-wash);
  color: var(--accent-deep);
}
.fdiv {
  width: 1px;
  height: 16px;
  background: var(--line);
  margin: 0 4px;
}
.fmtbar-saved {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--muted);
}
.fmtbar-saved .sdot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
}

/* ===== DESK SURFACE (warm desk, paper centered) =========== */
.pact-desk {
  flex: 1;
  overflow: auto;
  position: relative;
  background: var(--app-bg);
  padding: 20px 20px 60px;
}
.pact-desk-inner {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100%;
}
.pact-desk-content {
  flex: 1;
  max-width: 816px;
  position: relative;
}

/* ===== ProseMirror content styles ========================= */
.pact-prosemirror {
  outline: none;
  font-family: var(--font-doc);
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

.pact-prosemirror > *:first-child {
  margin-top: 0;
}

.pact-prosemirror p {
  margin: 9px 0;
}

.pact-prosemirror h1 {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 8px;
  line-height: 1.3;
}

.pact-prosemirror h2 {
  font-size: 16px;
  font-weight: 700;
  margin: 18px 0 5px;
  line-height: 1.3;
}

.pact-prosemirror h3 {
  font-size: 14px;
  font-weight: 600;
  margin: 14px 0 4px;
  line-height: 1.3;
}

.pact-prosemirror ul {
  padding-left: 26px;
  margin: 9px 0;
  list-style-type: disc;
}
.pact-prosemirror ol {
  padding-left: 26px;
  margin: 9px 0;
  list-style-type: decimal;
}
.pact-prosemirror ul ul {
  list-style-type: circle;
}
.pact-prosemirror ul ul ul {
  list-style-type: square;
}
.pact-prosemirror ol ol {
  list-style-type: lower-alpha;
}
.pact-prosemirror ol ol ol {
  list-style-type: lower-roman;
}

.pact-prosemirror li {
  margin: 4px 0;
}

.pact-prosemirror blockquote {
  border-left: 3px solid var(--accent-line);
  margin: 0.6em 0;
  padding: 0.4em 0 0.4em 1em;
  color: var(--ink-soft);
}

.pact-prosemirror table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.6em 0;
}

.pact-prosemirror td,
.pact-prosemirror th {
  border: 1px solid var(--line);
  padding: 6px 10px;
  vertical-align: top;
  font-size: 14px;
}
.pact-prosemirror th {
  background: var(--panel);
  font-weight: 600;
  font-family: var(--font-ui);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.pact-prosemirror hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 20px 0;
}

.pact-prosemirror strong {
  font-weight: 700;
}
.pact-prosemirror em {
  font-style: italic;
}
.pact-prosemirror u {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Placeholder */
.pact-prosemirror p.is-editor-empty:first-child::before {
  content: attr(data-placeholder);
  float: left;
  color: var(--faint);
  pointer-events: none;
  height: 0;
  font-style: italic;
}

/* Text alignment */
.pact-prosemirror [style*='text-align: center'] {
  text-align: center;
}
.pact-prosemirror [style*='text-align: right'] {
  text-align: right;
}
.pact-prosemirror [style*='text-align: justify'] {
  text-align: justify;
}

/* Selection */
.pact-prosemirror ::selection {
  background: color-mix(in oklch, var(--accent) 20%, transparent);
}

/* ---- tiptap-pagination-plus overrides ---- */

.rm-with-pagination {
  border: none !important;
  background: var(--paper);
  box-shadow:
    0 1px 2px rgba(60, 45, 30, 0.08),
    0 24px 60px -28px rgba(50, 38, 25, 0.4);
  border-radius: 2px;
  margin: 0 auto;
}

.rm-pagination-gap {
  background: var(--app-bg) !important;
  border-color: transparent !important;
  box-shadow:
    inset 0 4px 8px -4px rgba(50, 38, 25, 0.12),
    inset 0 -4px 8px -4px rgba(50, 38, 25, 0.12);
}

.rm-with-pagination .rm-page-footer {
  font-family: var(--font-ui);
  font-size: 10px;
  color: var(--faint);
  letter-spacing: 0.04em;
}

.rm-with-pagination .rm-page-header {
  font-family: var(--font-ui);
  font-size: 10px;
  color: var(--faint);
  letter-spacing: 0.04em;
}

/* ===== WORKSPACE — unified file-tree + preview ============ */

.ws-explorer {
  flex: 1;
  display: flex;
  min-height: 0;
}

/* warm manila rail */
.ws-rail {
  width: 272px;
  flex: 0 0 272px;
  background: var(--kraft);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}
.ws-rail-head {
  padding: 10px 10px 8px;
  border-bottom: 1px solid color-mix(in oklab, var(--line) 70%, transparent);
}
.ws-rail-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.ws-rail-top .rt-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}
.rail-new {
  margin-left: auto;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  cursor: pointer;
  border: 0;
  background: transparent;
}
.rail-new:hover {
  background: rgba(80, 55, 30, 0.08);
  color: var(--ink-soft);
}
.ws-rail-search {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 5px 9px;
  font-size: 11.5px;
  color: var(--muted);
}
.ws-rail-search input {
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--font-ui);
  font-size: 11.5px;
  color: var(--ink);
  flex: 1;
}
.ws-rail-search input::placeholder {
  color: var(--muted);
}
.ws-seg {
  display: flex;
  gap: 2px;
  margin-top: 7px;
  background: var(--kraft-2);
  border-radius: var(--radius-sm);
  padding: 2px;
}
.ws-seg button {
  flex: 1;
  border: 0;
  background: transparent;
  font-family: var(--font-ui);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted);
  padding: 5px 6px;
  border-radius: 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.ws-seg button.on {
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.07);
}

/* tree body */
.tree {
  flex: 1;
  overflow: auto;
  padding: 6px 6px 12px;
}
.tgroup-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
  padding: 12px 8px 5px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.tgroup-label .gc {
  margin-left: auto;
}
.tfolder {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 7px;
  border-radius: 5px;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  color: var(--ink-soft);
}
.tfolder:hover {
  background: rgba(80, 55, 30, 0.06);
}
.tfolder .chev {
  color: var(--muted);
  transition: transform 0.15s;
}
.tfolder.collapsed .chev {
  transform: rotate(-90deg);
}
.tfolder .fct {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--faint);
  font-weight: 600;
}
.tchildren {
  margin: 1px 0 4px 17px;
  padding-left: 9px;
  border-left: 1px solid color-mix(in oklab, var(--line) 80%, transparent);
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.tleaf {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 7px;
  border-radius: 5px;
  font-size: 11.5px;
  color: var(--ink-soft);
  cursor: pointer;
}
.tleaf:hover {
  background: rgba(80, 55, 30, 0.06);
}
.tleaf .lname {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tleaf .fico {
  color: var(--muted);
  flex: 0 0 auto;
}
.tleaf .sdot {
  margin-left: auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: 0 0 7px;
}
.tleaf.on {
  background: var(--paper);
  color: var(--ink);
  font-weight: 600;
  box-shadow:
    0 0 0 1px var(--line),
    0 4px 12px -5px rgba(60, 45, 30, 0.35);
}
.tleaf.on .fico {
  color: var(--accent);
}
.sdot.s-review {
  background: var(--warn-fg);
}
.sdot.s-sent {
  background: var(--accent);
}
.sdot.s-draft {
  background: var(--faint);
}
.sdot.s-final,
.sdot.s-signed {
  background: var(--ok);
}

/* preview pane */
.ws-preview {
  flex: 1;
  min-width: 0;
  background: var(--app-bg);
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line);
}
.ws-pv-head {
  height: 44px;
  flex: 0 0 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.ws-pv-head .pv-name {
  font-family: var(--font-doc);
  font-size: 14px;
  font-weight: 600;
}
.pv-toggle {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 0;
  background: transparent;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: 0 0 auto;
  margin-left: -4px;
}
.pv-toggle:hover {
  background: var(--panel-2);
  color: var(--ink-soft);
}
.saved-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
}
.saved-tag .sdot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
}

/* empty state */
.ws-pv-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  gap: 4px;
  text-align: center;
  padding: 24px;
}
.ws-pv-empty .empty-doc {
  width: 72px;
  height: 92px;
  border-radius: 6px;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
  position: relative;
  margin-bottom: 22px;
}
.ws-pv-empty .empty-doc::before {
  content: '';
  position: absolute;
  top: 18px;
  left: 16px;
  right: 16px;
  height: 3px;
  background: var(--accent-line);
  border-radius: 2px;
}
.ws-pv-empty .empty-doc::after {
  content: '';
  position: absolute;
  top: 30px;
  left: 16px;
  right: 22px;
  bottom: 16px;
  background: repeating-linear-gradient(180deg, var(--line-soft) 0 1px, transparent 1px 7px);
}
.ws-pv-empty h3 {
  font-family: var(--font-doc);
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
}
.ws-pv-empty p {
  font-size: 13px;
  margin: 4px 0 18px;
  max-width: 38ch;
  line-height: 1.5;
}

/* ===== Drag & drop ======================================== */
.folder-zone {
  border-radius: 6px;
  border: 1.5px solid transparent;
  transition:
    border-color 0.1s,
    background 0.1s;
}
.folder-zone.drag-over {
  background: var(--accent-wash);
  border-color: var(--accent-line);
}
.folder-zone.drag-over > .tfolder {
  color: var(--accent-deep);
}
.root-drop-zone {
  min-height: 8px;
  border-radius: 6px;
  border: 1.5px solid transparent;
  transition:
    border-color 0.1s,
    background 0.1s;
}
.root-drop-zone.drag-over {
  background: color-mix(in oklch, var(--kraft-2) 60%, transparent);
  border-color: var(--line);
}
.root-drop-hint {
  padding: 6px 8px;
  font-size: 10px;
  color: var(--faint);
  text-align: center;
  display: none;
}
.root-drop-zone.drag-over .root-drop-hint {
  display: block;
}
.tleaf[draggable='true'] {
  cursor: grab;
}
.tleaf[draggable='true']:active {
  cursor: grabbing;
  opacity: 0.6;
}
.tfolder[draggable='true'] {
  cursor: grab;
}
.tfolder[draggable='true']:active {
  cursor: grabbing;
  opacity: 0.7;
}

/* ===== Folder inline rename =============================== */
/* ===== Variable Chips (inline smart chips) =============== */
.vchip {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-deep);
  background: var(--accent-wash);
  border: 1px solid var(--accent-line);
  border-radius: 5px;
  padding: 1px 6px;
  white-space: nowrap;
  display: inline;
  cursor: default;
}
.vchip.filled {
  color: var(--ink);
  background: var(--paper-2);
  border-color: var(--line);
  border-style: dashed;
}

/* ===== Variables Panel (right sidebar) =================== */
.varpane {
  width: 300px;
  flex: 0 0 300px;
  background: var(--panel);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.varpane-head {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
}
.varpane-scroll {
  flex: 1;
  overflow: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.varfield label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 5px;
}
.varfield .dotk {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-deep);
  background: var(--accent-wash);
  border-radius: 4px;
  padding: 1px 6px;
  text-transform: none;
  letter-spacing: 0;
}
.varfield .input.var-empty {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 2px var(--accent-wash);
}

/* Progress bar */
.varprog {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-soft);
}
.varprog-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
.varprog-track {
  flex: 1;
  height: 4px;
  background: var(--line-soft);
  border-radius: 2px;
  overflow: hidden;
}
.varprog-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.2s ease;
}

.folder-rename-input {
  border: 1px solid var(--accent-line);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  background: var(--paper);
  outline: none;
  flex: 1;
  min-width: 0;
}
.folder-rename-input:focus {
  box-shadow: 0 0 0 2px var(--accent-wash);
}

/* ===== Folder delete button (hover-only) ================== */
.folder-del {
  border: 0;
  background: transparent;
  color: var(--faint);
  cursor: pointer;
  padding: 2px;
  border-radius: 4px;
  display: none;
  flex: 0 0 auto;
}
.tfolder:hover .folder-del {
  display: flex;
}
.folder-del:hover {
  color: var(--accent-deep);
  background: var(--accent-wash);
}

/* ===== Tag chips in footer ================================ */
.tag-chip {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(80, 55, 30, 0.06);
  color: var(--ink-soft);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ===== Right-click context menu =========================== */
.ctx-menu {
  position: fixed;
  z-index: 50;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-pop);
  padding: 4px;
  min-width: 170px;
  font-family: var(--font-ui);
}
.ctx-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--faint);
  padding: 6px 10px 4px;
}
.ctx-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 0;
  background: transparent;
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--ink-soft);
  padding: 6px 10px;
  border-radius: 5px;
  cursor: pointer;
  text-align: left;
}
.ctx-item:hover {
  background: var(--panel-2);
  color: var(--ink);
}
.ctx-item.danger:hover {
  background: var(--accent-wash);
  color: var(--accent-deep);
}
.ctx-divider {
  height: 1px;
  background: var(--line-soft);
  margin: 4px 6px;
}

/* ===== VERSION HISTORY PANEL ============================== */
.histpanel {
  width: 300px;
  flex: 0 0 300px;
  background: var(--panel);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line);
}
.histpanel-head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 8px;
}
.histtl {
  padding: 10px 14px;
  position: relative;
  flex: 1;
  overflow: auto;
}
.histtl::before {
  content: '';
  position: absolute;
  left: 22px;
  top: 18px;
  bottom: 18px;
  width: 2px;
  background: var(--line);
}
.hrow {
  position: relative;
  padding: 8px 0 12px 24px;
  cursor: pointer;
}
.hrow:hover {
  background: var(--panel-2);
  border-radius: 6px;
}
.hrow .hnode {
  position: absolute;
  left: -2px;
  top: 10px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--line);
  z-index: 1;
}
.hrow.cur .hnode {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
}
.hrow.draft .hnode {
  border-style: dashed;
}
.hrow .htop {
  display: flex;
  align-items: center;
  gap: 9px;
}
.hrow .hv {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12px;
}
.hrow .hmeta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}
.hrow .hbody {
  font-size: 11.5px;
  color: var(--ink-soft);
  margin-top: 4px;
}
.draft-band {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 4px;
  padding: 1px 7px;
}

/* ===== EXPORT DROPDOWN ==================================== */
.export-wrap {
  position: relative;
}
.export-drop {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-pop);
  padding: 4px;
  min-width: 170px;
  z-index: 20;
  font-family: var(--font-ui);
}
.export-drop button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 0;
  background: transparent;
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--ink-soft);
  padding: 6px 10px;
  border-radius: 5px;
  cursor: pointer;
  text-align: left;
}
.export-drop button:hover {
  background: var(--panel-2);
  color: var(--ink);
}

/* ===== STATUS STRIP ======================================= */
.status-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px;
  height: 32px;
  flex: 0 0 32px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
  font-size: 11px;
}
.statline {
  display: flex;
  align-items: center;
  gap: 0;
}
.statstep {
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 600;
  color: var(--faint);
  padding: 0 8px;
  position: relative;
}
.statstep .sc {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--line);
}
.statstep.done {
  color: var(--ink-soft);
}
.statstep.done .sc {
  background: var(--accent);
}
.statstep.cur {
  color: var(--accent-deep);
}
.statstep.cur .sc {
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
}
.statstep + .statstep::before {
  content: '';
  position: absolute;
  left: -4px;
  width: 8px;
  height: 1px;
  background: var(--line);
}

/* Status dropdown */
.status-drop-wrap {
  position: relative;
}
.status-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-pop);
  padding: 4px;
  min-width: 150px;
  z-index: 20;
  font-family: var(--font-ui);
}
.status-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 0;
  background: transparent;
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--ink-soft);
  padding: 6px 10px;
  border-radius: 5px;
  cursor: pointer;
  text-align: left;
}
.status-opt:hover {
  background: var(--panel-2);
  color: var(--ink);
}
.status-opt.active {
  color: var(--accent-deep);
  font-weight: 600;
}
.status-opt .sdot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: 0 0 7px;
}

/* ===== VERSION VIEWING BANNER ============================= */
.version-banner {
  height: 36px;
  flex: 0 0 36px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  background: var(--accent-wash);
  border-bottom: 1px solid var(--accent-line);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-deep);
}
.version-banner .btn {
  margin-left: auto;
}

/* ===== New Document Modal ================================ */
.newdoc-action-card {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 20px 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--paper);
  cursor: pointer;
  font-family: var(--font-ui);
  color: var(--ink);
  text-align: center;
  box-sizing: border-box;
  overflow: hidden;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
.newdoc-action-card:hover {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 2px var(--accent-wash);
}
.newdoc-action-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--accent-wash);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}
.newdoc-template-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
  box-sizing: border-box;
  width: 100%;
}
.newdoc-template-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--paper);
  cursor: pointer;
  font-family: var(--font-ui);
  text-align: left;
  box-sizing: border-box;
  overflow: hidden;
  min-width: 0;
  width: 100%;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
.newdoc-template-card:hover {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 2px var(--accent-wash);
}
.newdoc-template-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1;
}
.newdoc-template-use {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-wash);
  border: none;
  border-radius: var(--radius-sm);
  padding: 3px 10px;
  cursor: pointer;
  flex-shrink: 0;
  pointer-events: none;
}
.newdoc-template-card:hover .newdoc-template-use {
  background: var(--accent);
  color: white;
}

/* ===== REVIEW: selection toolbar + sidebar ================ */
.sel-tools {
  z-index: 9;
  background: var(--ink);
  border-radius: 8px;
  padding: 4px;
  display: flex;
  gap: 2px;
  box-shadow: 0 8px 24px -6px rgba(0, 0, 0, 0.4);
  pointer-events: auto;
}
.sel-tools button {
  background: transparent;
  border: 0;
  color: var(--paper);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 5px;
  cursor: pointer;
  display: flex;
  gap: 6px;
  align-items: center;
  white-space: nowrap;
}
.sel-tools button:hover {
  background: rgba(255, 255, 255, 0.14);
}
.review-sidebar {
  width: 300px;
  flex: 0 0 300px;
  background: var(--panel);
  border-left: 1px solid var(--line);
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}
.review-sidebar-head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 8px;
}
.review-sidebar-body {
  flex: 1;
  overflow: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.review-field label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--faint);
  display: block;
  margin-bottom: 4px;
}
.review-original {
  font-family: var(--font-doc);
  font-size: 12px;
  color: var(--muted);
  border-left: 2px solid var(--line);
  padding-left: 10px;
  line-height: 1.45;
}

/* ===== REVIEW HINT BAR ===================================== */
.review-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 16px;
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--muted);
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.review-hint.submitted {
  color: var(--ok);
  background: var(--exist-bg);
}

/* ===== LIVE DIFF MARKS (branch review + playground) ======== */
.smB-ins {
  color: var(--ok);
  background: var(--exist-bg);
  border-radius: 2px;
}
.smB-del {
  color: var(--accent-deep);
  background: var(--accent-wash);
  border-radius: 2px;
  text-decoration: line-through;
  text-decoration-color: var(--accent-deep);
  text-decoration-thickness: 1.5px;
  margin-right: 2px;
}
.smB-ins.smB-active,
.smB-del.smB-active {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* ===== REVIEWER CHANGES RAIL =============================== */
.review-changes {
  width: 290px;
  flex: 0 0 290px;
  background: var(--panel);
  border-left: 1px solid var(--line);
  overflow: auto;
  font-family: var(--font-ui);
}
.review-changes-head {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 700;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 1;
}
.rvc-card {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
}
.rvc-card.active {
  background: var(--accent-wash);
  box-shadow: inset 3px 0 0 var(--accent);
}
.rvc-change {
  font-family: var(--font-doc);
  font-size: 12px;
  line-height: 1.5;
  word-break: break-word;
}
.rvc-comment {
  width: 100%;
  margin-top: 7px;
  font-size: 11px;
  padding: 4px 8px;
  box-sizing: border-box;
}
.rvc-comment-sent {
  margin-top: 6px;
  font-size: 11px;
  color: var(--ink-soft);
  background: var(--panel-2);
  border-radius: 6px;
  padding: 4px 8px;
  line-height: 1.4;
}
.rvc-status-row {
  margin-bottom: 6px;
}

/* ===== SUGGESTION REPLY THREADS ============================ */
.sug-thread {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 7px;
}
.sug-thread-reply {
  font-size: 11px;
  background: var(--panel-2);
  border-radius: 6px;
  padding: 5px 8px;
  line-height: 1.45;
}
.sug-thread-who {
  font-weight: 700;
  color: var(--ink);
}
.sug-thread-when {
  color: var(--faint);
  margin-left: 6px;
  font-size: 10px;
}
.sug-thread-body {
  color: var(--ink-soft);
  margin-top: 1px;
}
.sug-thread-input {
  font-size: 11px;
  padding: 4px 8px;
  width: 100%;
  box-sizing: border-box;
}

/* ===== INLINE SUGGESTIONS (track-changes in the document) == */
.sug-original {
  color: var(--accent-deep);
  background: var(--accent-wash);
  text-decoration: line-through;
  text-decoration-color: var(--accent-deep);
  text-decoration-thickness: 1.5px;
  border-radius: 2px;
  cursor: pointer;
}
.sug-proposed {
  color: var(--ok);
  background: var(--exist-bg);
  border-radius: 2px;
  padding: 0 2px;
  margin-left: 2px;
  cursor: pointer;
}
.sug-anchor {
  background: var(--warn-bg);
  border-bottom: 2px solid var(--warn-fg);
  border-radius: 2px 2px 0 0;
  cursor: pointer;
}
.sug-original:hover,
.sug-proposed:hover,
.sug-anchor:hover {
  filter: brightness(0.95);
}
.sug-original.sug-active,
.sug-proposed.sug-active,
.sug-anchor.sug-active {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* ===== SUGGESTION POPOVER (anchored card) ================== */
.sug-pop {
  position: absolute;
  width: 320px;
  z-index: 20;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 12px 32px -8px rgba(0, 0, 0, 0.25);
  padding: 12px 14px;
  font-family: var(--font-ui);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sug-pop-head {
  display: flex;
  align-items: center;
  gap: 7px;
}
.sug-pop-who {
  font-size: 12px;
  font-weight: 700;
}
.sug-pop-when {
  font-size: 10px;
  color: var(--faint);
}
.sug-pop-x {
  margin-left: auto;
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  padding: 2px;
  border-radius: 4px;
  display: flex;
}
.sug-pop-x:hover {
  background: var(--panel-2);
}
.sug-pop-comment {
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.5;
}
.sug-pop-change {
  font-family: var(--font-doc);
  font-size: 12px;
  line-height: 1.55;
  border-left: 2px solid var(--line);
  padding-left: 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sug-pop-original {
  font-family: var(--font-doc);
  font-size: 12px;
  color: var(--muted);
  border-left: 2px solid var(--line);
  padding-left: 10px;
  line-height: 1.45;
  max-height: 72px;
  overflow: hidden;
}
.sug-pop-input {
  font-size: 12px;
  font-family: var(--font-ui);
  resize: vertical;
}
.sug-pop-acts {
  display: flex;
  gap: 6px;
  align-items: center;
}
.sug-pop-status {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 9px;
  background: var(--panel-2);
  color: var(--muted);
}
.sug-pop-status.accepted {
  background: var(--exist-bg);
  color: var(--ok);
}

/* ===== SUGGESTIONS PANEL (author-side sidebar) ============ */
.sugpanel {
  width: 320px;
  flex: 0 0 320px;
  background: var(--panel);
  border-left: 1px solid var(--line);
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}
.sugpanel-head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.sugpanel-scroll {
  flex: 1;
  overflow: auto;
}
.sug-card {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
}
.sug-card.active {
  background: var(--accent-wash);
  box-shadow: inset 3px 0 0 var(--accent);
}
.sug-card.resolved {
  opacity: 0.5;
}
.sug-card .sc-by {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 6px;
}
.sug-card .sc-who {
  font-size: 12px;
  font-weight: 600;
}
.sug-card .sc-when {
  font-size: 10px;
  color: var(--faint);
}
.sug-card .sc-change {
  font-family: var(--font-doc);
  font-size: 12px;
  line-height: 1.5;
  margin: 6px 0;
}
.sug-del {
  color: var(--accent-deep);
  text-decoration: line-through;
  opacity: 0.7;
}
.sug-ins {
  color: var(--ok);
  background: var(--exist-bg);
  border-radius: 2px;
  padding: 0 2px;
}
.sug-card .sc-acts {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.sug-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  color: var(--paper);
  background: var(--accent);
  flex: 0 0 22px;
}
.sug-count {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--warn-fg);
  background: var(--warn-bg);
  border-radius: 9px;
  padding: 1px 7px;
}

/* ===== DIFF VIEW (full-screen version comparison) ========= */
.diffscreen {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--app-bg);
}
.diff-toolbar {
  height: 46px;
  flex: 0 0 46px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.diff-legend {
  display: flex;
  gap: 12px;
  margin-left: auto;
  font-size: 11px;
  color: var(--muted);
}
.diff-legend span {
  display: flex;
  align-items: center;
  gap: 5px;
}
.diff-legend .sw {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}
.diff-body {
  flex: 1;
  overflow: auto;
  display: flex;
  justify-content: center;
  padding: 24px;
  background: var(--app-bg);
}
.diff-paper {
  width: 720px;
  background: var(--paper);
  box-shadow: var(--shadow-pop);
  border-radius: 2px;
  padding: 60px 76px;
  font-family: var(--font-doc);
  font-size: 14px;
  line-height: 1.65;
  color: var(--ink);
}
.diff-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line-soft);
}
.diff-content {
  white-space: pre-wrap;
  word-wrap: break-word;
}
.d-ins {
  color: var(--ok);
  background: var(--exist-bg);
  border-radius: 2px;
  padding: 0 2px;
}
.d-del {
  color: var(--accent-deep);
  background: var(--accent-wash);
  text-decoration: line-through;
  opacity: 0.8;
  border-radius: 2px;
  padding: 0 2px;
}

/* History panel compare mode */
.hrow.sel-a,
.hrow.sel-b {
  background: var(--accent-wash);
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px var(--accent-line);
}
.cmp-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0;
  color: var(--paper);
  background: var(--accent);
  flex: 0 0 auto;
  margin-left: auto;
}

/* ===== TABLE OF CONTENTS (hover overlay) ================== */
.toc-zone {
  position: sticky;
  top: 20px;
  left: 4px;
  width: 36px;
  max-height: calc(100vh - 180px);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 0;
  transition:
    width 0.2s ease,
    background 0.2s ease,
    padding 0.2s ease;
  flex-shrink: 0;
  align-self: flex-start;
}
.toc-zone:hover {
  width: 170px;
  background: color-mix(in oklch, var(--app-bg) 94%, transparent);
  backdrop-filter: blur(6px);
  border-radius: var(--radius-sm);
  padding: 6px 6px;
}
.toc-entry {
  position: relative;
  border: 0;
  background: transparent;
  font-family: var(--font-ui);
  font-size: 10px;
  color: var(--muted);
  padding: 2px 0;
  border-radius: 3px;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  height: 16px;
  display: block;
}
.toc-entry:hover {
  color: var(--ink-soft);
}
.toc-entry.toc-active {
  color: var(--accent-deep);
}
/* Ghost and label overlap in the same space */
.toc-ghost {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 2px;
  border-radius: 1px;
  background: var(--faint);
  transition: opacity 0.2s ease;
  pointer-events: none;
}
.toc-label {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  transition: opacity 0.2s ease;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== COLLABORATION CURSORS ============================== */
.collaboration-cursor__caret {
  border-left: 1px solid;
  border-right: 1px solid;
  margin-left: -1px;
  margin-right: -1px;
  pointer-events: none;
  position: relative;
  word-break: normal;
}
.collaboration-cursor__label {
  position: absolute;
  top: -1.4em;
  left: -1px;
  font-size: 11px;
  font-family: var(--font-ui);
  font-weight: 600;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 3px 3px 3px 0;
  color: #fff;
  white-space: nowrap;
  user-select: none;
  pointer-events: none;
}

/* ===== WORKSPACE SWITCHER DROPDOWN ========================= */
.ws-switcher-wrap {
  position: relative;
}
.ws-switcher-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}
.ws-switcher-btn:hover {
  background: rgba(80, 55, 30, 0.08);
}
.ws-switcher-btn b {
  font-weight: 600;
}
.ws-switcher-drop {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-pop);
  padding: 4px;
  min-width: 220px;
  z-index: 30;
  font-family: var(--font-ui);
}
.ws-switcher-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--faint);
  padding: 6px 10px 4px;
}
.ws-switcher-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 0;
  background: transparent;
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--ink-soft);
  padding: 6px 10px;
  border-radius: 5px;
  cursor: pointer;
  text-align: left;
}
.ws-switcher-item:hover {
  background: var(--panel-2);
  color: var(--ink);
}
.ws-switcher-item.active {
  color: var(--accent-deep);
  font-weight: 600;
}
.ws-switcher-item-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ws-switcher-divider {
  height: 1px;
  background: var(--line-soft);
  margin: 4px 6px;
}

/* ===== DOCUMENT RAIL FOOTER (Settings link) ================ */
.ws-rail-footer {
  border-top: 1px solid color-mix(in oklab, var(--line) 70%, transparent);
  padding: 8px 10px;
}
.ws-rail-settings-link {
  display: flex;
  align-items: center;
  gap: 7px;
  border: 0;
  background: transparent;
  font-family: var(--font-ui);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  padding: 5px 7px;
  border-radius: 5px;
  width: 100%;
}
.ws-rail-settings-link:hover {
  background: rgba(80, 55, 30, 0.06);
  color: var(--ink-soft);
}

/* ===== WORKSPACE SETTINGS PANEL ============================ */
.ws-settings {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.ws-settings-head {
  height: 44px;
  flex: 0 0 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.ws-settings-title {
  font-family: var(--font-doc);
  font-size: 14px;
  font-weight: 600;
}
.ws-settings-body {
  flex: 1;
  overflow: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  max-width: 560px;
}
.ws-settings-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ws-settings-section-title {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 0;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line-soft);
}
.ws-settings-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.ws-settings-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
}
.ws-settings-members {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ws-settings-member {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-soft);
  background: var(--paper);
}
.ws-settings-member-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-doc);
  font-weight: 700;
  font-size: 12px;
  flex: 0 0 28px;
}
.ws-settings-member-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}
.ws-settings-member-email {
  font-size: 11px;
  color: var(--muted);
}
.ws-settings-member-role {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--faint);
  background: var(--panel-2);
  padding: 2px 7px;
  border-radius: 4px;
}
.ws-settings-statuses {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ws-settings-status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 5px;
}
.ws-settings-status-row:hover {
  background: var(--panel-2);
}
.ws-settings-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: 0 0 8px;
}
.ws-settings-status-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  flex: 1;
}
.ws-settings-status-key {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  background: var(--panel-2);
  padding: 1px 6px;
  border-radius: 4px;
}

/* ===== Variable autocomplete popup ======================== */
.var-suggest-popup {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-pop);
  padding: 4px;
  min-width: 160px;
  max-width: 280px;
  display: flex;
  flex-direction: column;
}
.var-suggest-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-soft);
  padding: 6px 10px;
  border-radius: 5px;
  cursor: pointer;
}
.var-suggest-item:hover,
.var-suggest-item.active {
  background: var(--accent-wash);
  color: var(--accent-deep);
}
