/* ---- fonts: Inter (OFL-1.1), bundled and served locally ---- */

@font-face { font-family: "Inter"; font-style: normal; font-display: swap; font-weight: 100 900; src: url(fonts/inter-latin-wght-normal.woff2) format("woff2-variations"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Inter"; font-style: italic; font-display: swap; font-weight: 100 900; src: url(fonts/inter-latin-wght-italic.woff2) format("woff2-variations"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-display: swap; font-weight: 100 900; src: url(fonts/inter-latin-ext-wght-normal.woff2) format("woff2-variations"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Inter"; font-style: italic; font-display: swap; font-weight: 100 900; src: url(fonts/inter-latin-ext-wght-italic.woff2) format("woff2-variations"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }

/* ---- tokens: paper and ink (site/design.html) ----
   The UI is a warm grey ramp. Colour only means something: who (a buddy's
   own colour), danger or a deletion (red), an insertion or online (green),
   commented text (yellow), and focus, selection and links (blue). */

:root {
  --canvas: #ffffff;
  --bg: #ffffff;
  --bg-soft: #f7f6f3;
  --hover: rgba(36, 35, 31, 0.06);
  --active: rgba(36, 35, 31, 0.1);
  --text: #24231f;
  --text-soft: rgba(36, 35, 31, 0.62);
  --text-faint: rgba(36, 35, 31, 0.4);
  --on-text: #ffffff;
  --border: rgba(36, 35, 31, 0.1);
  --border-strong: rgba(36, 35, 31, 0.18);
  --accent: #2f6bd8;
  --accent-soft: rgba(47, 107, 216, 0.16);
  --highlight: rgba(251, 188, 4, 0.2);
  --highlight-active: rgba(251, 188, 4, 0.5);
  --red: #c8402f;
  --green: #2f8a4c;
  --scrim: rgba(20, 19, 16, 0.32);
  --shadow: 0 1px 2px rgba(20, 19, 16, 0.06), 0 0 0 1px rgba(20, 19, 16, 0.05);
  --shadow-raised: 0 8px 24px rgba(20, 19, 16, 0.1), 0 2px 6px rgba(20, 19, 16, 0.06), 0 0 0 1px rgba(20, 19, 16, 0.05);
  --ui-font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Noto Sans CJK SC", "Source Han Sans SC", sans-serif;
  --serif: Charter, "Bitstream Charter", "Iowan Old Style", "Sitka Text", Cambria, Georgia, "Songti SC", "Source Han Serif SC", "Noto Serif CJK SC", "Noto Serif SC", SimSun, serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
  --doc-font: var(--ui-font);
  --doc-size: 16px;
  --doc-leading: 1.7;
  --doc-tracking: -0.006em;
  --measure: 680px;
  --page-pad: 72px;
  --margin-w: 360px;
  --stage-gap: 28px;
  --page-w: calc(var(--measure) + 2 * var(--page-pad));
  color-scheme: light;
}
:root[data-font="serif"] { --doc-font: var(--serif); --doc-size: 17px; --doc-leading: 1.65; --doc-tracking: 0; }
:root[data-font="mono"] { --doc-font: var(--mono); --doc-size: 15px; --doc-leading: 1.65; --doc-tracking: 0; }
:root[data-width="wide"] { --measure: 940px; }

/* dark: follow the system unless the human picked light, or picked dark */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --canvas: #1c1b19; --bg: #262522; --bg-soft: #22211f; --hover: rgba(255, 250, 240, 0.07); --active: rgba(255, 250, 240, 0.12);
    --text: #e8e6e1; --text-soft: rgba(232, 230, 225, 0.62); --text-faint: rgba(232, 230, 225, 0.4); --on-text: #1c1b19;
    --border: rgba(255, 250, 240, 0.09); --border-strong: rgba(255, 250, 240, 0.16);
    --accent: #7ea6f2; --accent-soft: rgba(126, 166, 242, 0.22);
    --highlight: rgba(251, 188, 4, 0.16); --highlight-active: rgba(251, 188, 4, 0.36);
    --red: #ee8070; --green: #7cc48f; --scrim: rgba(0, 0, 0, 0.5);
    --shadow: 0 0 0 1px rgba(255, 250, 240, 0.07);
    --shadow-raised: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 250, 240, 0.09);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --canvas: #1c1b19; --bg: #262522; --bg-soft: #22211f; --hover: rgba(255, 250, 240, 0.07); --active: rgba(255, 250, 240, 0.12);
  --text: #e8e6e1; --text-soft: rgba(232, 230, 225, 0.62); --text-faint: rgba(232, 230, 225, 0.4); --on-text: #1c1b19;
  --border: rgba(255, 250, 240, 0.09); --border-strong: rgba(255, 250, 240, 0.16);
  --accent: #7ea6f2; --accent-soft: rgba(126, 166, 242, 0.22);
  --highlight: rgba(251, 188, 4, 0.16); --highlight-active: rgba(251, 188, 4, 0.36);
  --red: #ee8070; --green: #7cc48f; --scrim: rgba(0, 0, 0, 0.5);
  --shadow: 0 0 0 1px rgba(255, 250, 240, 0.07);
  --shadow-raised: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 250, 240, 0.09);
  color-scheme: dark;
}

/* ---- base ---- */

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { background: var(--canvas); color: var(--text); font: 14px/1.5 var(--ui-font); font-feature-settings: "cv05", "cv08"; display: flex; flex-direction: column; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: 0.45; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.pj-icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
kbd { font: 500 11px/1 var(--ui-font); padding: 2px 6px; border-radius: 4px; border: 1px solid var(--border); background: var(--bg-soft); color: var(--text-soft); white-space: nowrap; }
.pj-spacer { flex: 1; }
.pj-sep { width: 1px; height: 20px; background: var(--border-strong); margin: 0 6px; flex: none; }
.pj-icon-btn { border: 0; background: none; width: 28px; height: 28px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; color: var(--text-soft); flex: none; }
.pj-icon-btn:hover, .pj-icon-btn[aria-expanded="true"] { background: var(--hover); color: var(--text); }
.pj-header .pj-icon-btn { width: 32px; height: 32px; }
.pj-msg-head .pj-icon-btn, .pj-receipt .pj-icon-btn, .pj-people-row .pj-icon-btn { width: 24px; height: 24px; }

/* ---- menu and list rows: one size everywhere ---- */

:where(.pj-block-menu li, .site-menu a, .pj-mention, .pj-outline-list button, .pj-settings-nav button, .pj-files-row, .pj-people-row, .pj-version, .pj-start-open, .pj-recent li button) { min-height: 28px; padding: 4px 8px; border-radius: 6px; font-size: 13px; }

/* ---- header ---- */

.pj-header { display: flex; align-items: center; gap: 12px; height: 52px; padding: 0 12px 0 16px; background: var(--canvas); flex: none; }
.pj-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pj-doc-icon { display: flex; color: var(--text-soft); }
.pj-doc-icon .pj-icon { width: 20px; height: 20px; }
.pj-doc-name { font-size: 14px; font-weight: 600; letter-spacing: -0.005em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pj-renamable { cursor: pointer; border-radius: 6px; padding: 2px 6px; margin: 0 -6px; }
.pj-renamable:hover { background: var(--hover); }
.pj-status { display: inline-flex; align-items: center; gap: 4px; margin-left: 4px; font-size: 12px; font-weight: 500; white-space: nowrap; min-width: 0; }
.pj-status-icon { display: flex; }
.pj-status-icon .pj-icon { width: 14px; height: 14px; stroke-width: 2; }
.pj-status-text { overflow: hidden; text-overflow: ellipsis; }
.pj-status[data-state="error"], .pj-status[data-state="conflict"] { color: var(--red); }
.pj-status[data-state="offline"] { color: var(--text-soft); }
/* the Markdown editor's word count, in its toolbar */
.pj-count { color: var(--text-faint); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }

.pj-people { display: flex; align-items: center; gap: 8px; }
.pj-me, .pj-agent-face { border: 0; background: none; padding: 0; border-radius: 50%; display: flex; }
.pj-me:hover .pj-avatar { box-shadow: 0 0 0 3px var(--hover); }

.pj-avatar { --size: 32px; width: var(--size); height: var(--size); flex: none; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: calc(var(--size) * 0.4); font-weight: 600; letter-spacing: 0.02em; user-select: none; transition: box-shadow 0.15s, transform 0.35s cubic-bezier(0.3, 1.5, 0.5, 1); }
.pj-avatar-small { --size: 24px; }
.pj-avatar-agent { border-radius: 0; background: none; }
/* People are circles; agents are faces (faces.js): a circle, square, triangle, pentagon or cloud. */
.pj-face { display: block; width: 100%; height: 100%; overflow: visible; }
.pj-face-body, .pj-face-look { transform-box: view-box; transform-origin: 50% 50%; transition: filter 0.15s; }

.pj-agent { display: flex; align-items: center; gap: 8px; }
.pj-agent-face, .pj-profile-face { position: relative; display: flex; }

/* A buddy has three states, the same on every face of it: ready (as drawn),
   working (it grows, its body rolls and its face bobs) and away (greyed). A
   failed run is a moment: the face shakes and flashes red, once. A face you
   point at grows too, and on its card it moves as if at work, to greet you.
   A person is here (as drawn) or away (greyed). */
:is([data-presence="working"], .pj-typing, .pj-panel .pj-profile:not([data-presence="away"])) .pj-avatar-agent, .pj-avatar-agent:hover { transform: scale(1.12); }
:is([data-presence="working"], .pj-typing, .pj-panel .pj-profile:not([data-presence="away"])) .pj-face-body { animation: pj-spin 2.4s linear infinite; }
:is([data-presence="working"], .pj-typing, .pj-panel .pj-profile:not([data-presence="away"])) .pj-face-look { animation: pj-bob 0.8s ease-in-out infinite alternate; }
[data-presence="away"] .pj-avatar { filter: grayscale(1); opacity: 0.45; }
.pj-avatar-agent.pj-failed { animation: pj-shake 0.45s ease-in-out; }
.pj-failed .pj-face-body { animation: pj-red 1s; }
@keyframes pj-spin { to { transform: rotate(360deg); } }
@keyframes pj-bob { from { transform: translate(-2px, 1px); } to { transform: translate(2px, -2px); } }
@keyframes pj-shake { 20%, 60% { transform: translateX(-3px) rotate(-5deg); } 40%, 80% { transform: translateX(3px) rotate(5deg); } }
@keyframes pj-red { 0%, 70% { fill: var(--red); } }

/* profile cards under the header avatars */
.pj-panel { position: fixed; top: 50px; right: 12px; z-index: 30; width: 320px; padding: 16px; background: var(--bg); border-radius: 10px; box-shadow: var(--shadow-raised); animation: pj-pop 0.14s ease-out; font-size: 13px; }
@keyframes pj-pop { from { opacity: 0; transform: translateY(-4px) scale(0.98); } }
@keyframes pj-rise { from { opacity: 0; transform: translateY(16px); } }
.pj-profile { display: flex; align-items: center; gap: 12px; }
.pj-profile .pj-avatar { --size: 44px; }
/* on an editable card, the face is a button that draws a new one */
.pj-profile-who { min-width: 0; }
.pj-profile-name { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; }
.pj-profile-sub { margin-top: 2px; color: var(--text-soft); }
.pj-profile-problem { margin-top: 16px; padding: 8px 12px; border-radius: 6px; background: color-mix(in srgb, var(--red) 9%, var(--bg-soft)); color: var(--text); overflow-wrap: anywhere; }

/* the doc's agents in the header, and the invite button */
.pj-agents { display: flex; align-items: center; gap: 6px; }
.pj-agents:empty { display: none; }
.pj-invite .pj-icon { width: 18px; height: 18px; }


/* name cards */
.pj-panel[aria-busy="true"] { cursor: progress; }
.pj-panel[aria-busy="true"] button { pointer-events: none; opacity: 0.7; }
.pj-profile-slogan { margin-top: 2px; color: var(--text-soft); font-size: 13px; }
.pj-danger, .pj-secondary.pj-danger { color: var(--red); }
.pj-secondary.pj-danger:hover { background: color-mix(in srgb, var(--red) 10%, transparent); }
.pj-card-title { font-size: 14px; font-weight: 600; }


/* the People panel: who is in the doc, like a shared doc's people list */
.pj-panel[data-card="team"] { width: 360px; max-height: calc(100vh - 70px); overflow-y: auto; }
.pj-people-list .pj-setting-group { margin: 12px 0 2px; }
.pj-people-none { padding: 4px 0; color: var(--text-faint); font-size: 12px; }
.pj-people-invite { display: flex; gap: 6px; }
.pj-people-invite .pj-icon { width: 14px; height: 14px; }
.pj-people-pending { padding: 4px 0 8px; }
.pj-people-actions { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.pj-teammate-row { margin-top: 12px; }
.pj-join { position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column; gap: 12px; width: 320px; height: fit-content; margin: auto; padding: 24px; background: var(--bg); border-radius: 14px; box-shadow: var(--shadow-raised); }
.pj-join-text { margin: 0; color: var(--text-soft); font-size: 13px; }
.pj-join .pj-input { width: auto; }
.pj-people-list { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; }
.pj-people-row { display: flex; align-items: center; gap: 8px; margin: 0 -8px; }
.pj-people-row:not(.pj-people-new):hover { background: var(--hover); }
/* a buddy: its face, name and who it is open its card; a project's shows Delete on hover */
.pj-people-open { display: flex; flex: 1; align-items: center; gap: 8px; min-width: 0; padding: 0; border: 0; background: none; color: inherit; text-align: left; }
.pj-people-delete { opacity: 0; }
.pj-people-row:hover .pj-people-delete, .pj-people-delete:focus-visible { opacity: 1; }
.pj-people-delete:hover { color: var(--red); }
@media (hover: none) { .pj-people-delete { opacity: 1; } }
.pj-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pj-people-name { flex: none; max-width: 60%; overflow: hidden; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
/* the last row of the doc's agents: make a new one */
.pj-people-new { margin-top: 6px; color: var(--text-soft); cursor: text; }
.pj-people-new:hover { background: var(--hover); }
.pj-people-new-name { flex: 1; min-width: 0; padding: 0; border: 0; background: none; color: var(--text); font: inherit; font-weight: 500; outline: none; }
.pj-people-new-name::placeholder { color: var(--text-soft); }
.pj-people-new-face { width: 24px; height: 24px; flex: none; display: inline-flex; align-items: center; justify-content: center; border: 1px dashed var(--border-strong); border-radius: 50%; }
.pj-people-new-face .pj-icon { width: 13px; height: 13px; }
.pj-people-role { flex: 1; min-width: 0; overflow: hidden; color: var(--text-soft); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
/* the People button: a circle the size of an avatar, next to them */
.pj-invite { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; border: 1px dashed var(--border-strong); border-radius: 50%; background: var(--bg); color: var(--text-soft); }
.pj-invite:hover { background: var(--hover); color: var(--text); border-style: solid; }
.pj-invite .pj-icon { width: 16px; height: 16px; }
/* a name on a card: text you click to edit, then a field in its place */
.pj-editable { margin-left: -4px; padding: 2px 4px; border-radius: 4px; cursor: text; }
.pj-editable:hover, .pj-editable:focus-visible { background: var(--hover); outline: none; }
.pj-profile-standing { margin-top: 4px; color: var(--text-faint); font-size: 12px; }
.pj-inline-input { display: block; width: 100%; margin: 0 0 0 -4px; padding: 2px 4px; border: 0; border-radius: 4px; background: var(--hover); color: inherit; font: inherit; outline: 1px solid var(--accent); }
.pj-inline-input.pj-profile-name { font-size: 14px; font-weight: 600; }
.pj-inline-input::placeholder { color: var(--text-faint); font-weight: 400; }
.pj-inline-input[aria-invalid="true"] { outline-color: var(--red); }
.pj-profile-who { flex: 1; }
.pj-profile + .pj-input-error { margin-top: 6px; }

/* the @ menu and who-will-reply line under a comment box */
.pj-mentions { position: absolute; left: 0; right: 0; top: 100%; z-index: 6; max-height: 320px; overflow-y: auto; list-style: none; margin: 4px 0 0; padding: 4px; background: var(--bg); border-radius: 10px; box-shadow: var(--shadow-raised); }
/* the same menu after an @ in the doc's text, at the caret */
.pj-mentions-group { padding: 6px 8px 2px; color: var(--text-faint); font-size: 12px; font-weight: 600; }
/* an @name in the doc or a comment: a chip; hovering it shows the name card */
.pj-at { margin: 0 2px; padding: 0 6px; border-radius: 999px; font-weight: 600; color: var(--text); background: var(--hover); box-shadow: inset 0 0 0 1px var(--border); box-decoration-break: clone; -webkit-box-decoration-break: clone; cursor: default; transition: background 0.12s, box-shadow 0.12s; }
.pj-at-agent { background: color-mix(in oklch, var(--buddy) 24%, transparent); box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--buddy) 55%, transparent); }
.pj-at:hover { background: var(--active); }
.pj-at-agent:hover { background: color-mix(in oklch, var(--buddy) 38%, transparent); }
[data-namecard="click"] { cursor: pointer; }
/* a card opened by hovering a name: view only, a click away from editable */
.pj-panel[data-state="view"][data-editable] { cursor: pointer; }
.pj-mention { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.pj-mention.pj-selected { background: var(--hover); }
.pj-mention-who { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.pj-mention-name { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; }
.pj-mention-sub { overflow: hidden; color: var(--text-soft); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }

/* who a buddy is, under its name on its card: grows with the text, up to a point */
.pj-input.pj-profile-about { display: block; width: 100%; box-sizing: border-box; margin-top: 12px; min-height: 4lh; max-height: 45vh; field-sizing: content; resize: none; font: 13px/1.5 var(--ui-font); }

/* ---- toolbar ---- */

.pj-toolbar { display: flex; align-items: center; gap: 2px; margin: 0 12px 8px; padding: 4px; min-height: 36px; background: var(--bg-soft); border-radius: 10px; flex: none; overflow-x: auto; scrollbar-width: none; }
.pj-tool-group { display: flex; gap: 2px; }
.pj-toolbar button, .pj-bubble button { border: 0; background: none; border-radius: 6px; height: 28px; min-width: 28px; padding: 0 6px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-size: 13px; color: var(--text); flex: none; }
.pj-toolbar button:hover:not(:disabled), .pj-bubble button:hover:not(:disabled) { background: var(--hover); }
.pj-toolbar button[aria-pressed="true"], .pj-bubble button[aria-pressed="true"] { background: var(--active); color: var(--text); }
.pj-toolbar .pj-count { padding: 0 8px; }
.pj-toolbar .pj-pill { border-radius: 6px; padding: 0 8px; font-weight: 500; }
.pj-toolbar .pj-tool-comment { color: var(--text-soft); }
.pj-comment-count { min-width: 18px; padding: 0 6px; border-radius: 999px; background: var(--hover); font-size: 12px; line-height: 18px; font-variant-numeric: tabular-nums; }
.pj-comment-count:empty { display: none; }
.pj-toolbar .pj-tool-comment[aria-pressed="true"] .pj-comment-count { background: var(--border-strong); }
.pj-toolbar .pj-show-resolved { color: var(--text-soft); }
.pj-toolbar .pj-show-resolved[aria-pressed="true"] { color: var(--text); background: var(--active); }

.pj-block-picker { position: relative; }
.pj-toolbar .pj-block-button { width: 132px; justify-content: space-between; padding: 0 6px 0 8px; }
.pj-chevron { width: 14px; height: 14px; color: var(--text-soft); }
.pj-block-menu { position: fixed; z-index: 30; margin: 4px 0 0; padding: 4px; min-width: 220px; list-style: none; background: var(--bg); border-radius: 10px; box-shadow: var(--shadow-raised); animation: pj-pop 0.12s ease-out; }
.pj-block-menu li { display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; }
.pj-block-menu li:hover { background: var(--hover); }
.pj-block-menu li[aria-selected="true"] { background: var(--active); }
.pj-sample-p { font-family: var(--doc-font); font-size: 14px; }
.pj-sample-h1, .pj-sample-h2, .pj-sample-h3 { font-family: var(--doc-font); font-weight: 600; }
.pj-sample-h1 { font-size: 20px; }
.pj-sample-h2 { font-size: 16px; }
.pj-sample-h3 { font-size: 14px; }

.pj-banner { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0 12px 8px; padding: 8px 12px; border-radius: 10px; background: var(--bg-soft); font-size: 13px; flex: none; }
.pj-banner-icon { display: flex; color: var(--text-soft); }
.pj-banner-text { flex: 1; }
.pj-banner button { height: 28px; border: 1px solid var(--border-strong); background: var(--bg); border-radius: 6px; padding: 0 12px; font-weight: 500; }
.pj-banner button:hover { background: var(--hover); }
:is([data-read-only], [data-reader]) :is(.pj-bubble [data-action="comment"], .pj-bubble:has(> [data-action="comment"]:only-child), .pj-composer, .pj-resolve, .pj-resolved-row .pj-link-button, .pj-receipt-undo) { display: none !important; }
[data-reader] .pj-history-restore { display: none !important; }

/* ---- tooltips ---- */

.pj-tip { position: fixed; z-index: 50; display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-radius: 6px; background: var(--text); color: var(--on-text); font-size: 12px; font-weight: 500; pointer-events: none; animation: pj-fade-in 0.1s ease-out; }
.pj-tip kbd { border: 0; padding: 0; background: none; color: var(--on-text); opacity: 0.6; font-size: 12px; }
@keyframes pj-fade-in { from { opacity: 0; } }

/* ---- canvas, page and margin ---- */

.pj-canvas { flex: 1; overflow-y: auto; min-height: 0; scroll-padding-top: 24px; }
/* The page sits in the middle of the window: the left padding matches the
   margin's width when there is room, and gives way before the page narrows. */
.pj-stage { position: relative; display: grid; grid-template-columns: minmax(0, var(--page-w)) var(--margin-w); gap: var(--stage-gap); justify-content: center; padding: 16px 16px 160px clamp(16px, 100% - var(--page-w) - var(--stage-gap) - var(--margin-w) - 16px, var(--stage-gap) + var(--margin-w) + 16px); }
.pj-page { position: relative; min-height: calc(100vh - 160px); padding: 40px var(--page-pad) 120px; }
.pj-margin { position: relative; transition: opacity 0.2s; }
/* comments hidden (the toolbar's Comments button) or none to show: no margin;
   hidden also drops the highlights, except in a narrow window, where they open the sheet */
@media (min-width: 901px) {
  :is([data-hide-comments], [data-no-comments]) .pj-stage { --margin-w: 0px; --stage-gap: 0px; }
  :is([data-hide-comments], [data-no-comments]) .pj-margin { display: none; }
  [data-hide-comments] .pj-hl { background: none; animation: none; transition: none; }
}

/* the plain view runs edge to edge, the margin (when shown) beside it */
.pj-stage[data-plain] { grid-template-columns: minmax(0, 1fr) var(--margin-w); padding: 0 0 160px; }
.pj-stage[data-plain] .pj-page { --page-pad: 12px; padding-top: 8px; }
@media (max-width: 900px) {
  .pj-stage[data-plain] { grid-template-columns: minmax(0, 1fr); }
}

/* ---- document typography ---- */

.pj-editor .ProseMirror { outline: none; white-space: pre-wrap; word-wrap: break-word; min-height: 50vh; font-family: var(--doc-font); font-size: var(--doc-size); line-height: var(--doc-leading); letter-spacing: var(--doc-tracking); color: var(--text); caret-color: var(--text); font-kerning: normal; text-rendering: optimizeLegibility; }
.pj-editor .ProseMirror ::selection { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.pj-editor h1, .pj-editor h2, .pj-editor h3, .pj-editor h4, .pj-editor h5, .pj-editor h6 { font-weight: 600; line-height: 1.3; letter-spacing: -0.012em; margin: 1.6em 0 0.35em; }
[data-font="mono"] .pj-editor :is(h1, h2, h3, h4, h5, h6) { letter-spacing: -0.02em; }
.pj-editor h1 { font-size: 1.875em; margin-top: 1.8em; }
.pj-editor h2 { font-size: 1.5em; margin-top: 1.5em; }
.pj-editor h3 { font-size: 1.25em; margin-top: 1.3em; }
.pj-editor h4, .pj-editor h5, .pj-editor h6 { font-size: 1.05em; }
.pj-editor h6 { color: var(--text-soft); }
/* the doc's opening heading reads as its title */
.pj-editor .ProseMirror > h1:first-child { font-size: 2.35em; font-weight: 600; line-height: 1.18; letter-spacing: -0.022em; margin: 0 0 0.5em; }
.pj-editor .ProseMirror > :first-child { margin-top: 0; }
.pj-editor p { margin: 0 0 0.8em; }
.pj-editor ul, .pj-editor ol { padding-left: 1.5em; margin: 0 0 0.8em; }
.pj-editor li { margin: 0.2em 0; padding-left: 0.2em; }
.pj-editor li > p { margin: 0; }
.pj-editor li::marker { color: var(--text-soft); }
/* A task list item's box, in the gutter in place of its bullet: a .pj-radio's
   outline, square; ink with a check when done. Clicking it ticks it (view.js). */
.pj-editor li[data-item-type="task"] { position: relative; list-style: none; }
.pj-editor li[data-item-type="task"]::before { content: ''; position: absolute; left: -1.3em; top: calc(0.5lh - 0.45em); box-sizing: border-box; width: 0.9em; height: 0.9em; border: 1px solid var(--border-strong); border-radius: 4px; background: var(--canvas); cursor: pointer; }
.pj-editor li[data-checked="true"]::before { border-color: var(--text); background: var(--text); }
.pj-editor li[data-checked="true"]::after { content: ''; position: absolute; left: -0.98em; top: calc(0.5lh - 0.33em); width: 0.2em; height: 0.45em; border: solid var(--canvas); border-width: 0 0.12em 0.12em 0; transform: rotate(45deg); pointer-events: none; }
.pj-editor a { color: var(--accent); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); text-underline-offset: 0.18em; }
.pj-editor a:hover { text-decoration-color: currentColor; }
.pj-editor strong { font-weight: 600; }
.pj-editor code { font-family: var(--mono); font-size: 0.85em; background: var(--bg-soft); color: var(--text); padding: 0.15em 0.35em; border-radius: 4px; }
.pj-editor pre { background: var(--bg-soft); padding: 12px 16px; border-radius: 6px; overflow-x: auto; margin: 0 0 1em; font-size: 0.88em; line-height: 1.55; }
.pj-editor pre code { background: none; padding: 0; color: var(--text); font-size: 1em; }
.pj-diagram { margin: 0 0 1em; border-radius: 6px; cursor: default; }
.pj-diagram svg { display: block; max-width: 100%; height: auto; }
.pj-diagram-error { margin: -0.6em 0 1em; font: 0.8em/1.5 var(--mono); white-space: pre-wrap; color: var(--red); }
.pj-editor blockquote { margin: 0 0 1em; padding: 0.1em 0 0.1em 1em; border-left: 3px solid var(--text); color: var(--text); }
.pj-editor blockquote p:last-child { margin-bottom: 0; }
.pj-editor table { border-collapse: collapse; margin: 0 0 1em; font-family: var(--ui-font); font-size: 0.86em; width: 100%; }
.pj-editor th, .pj-editor td { border: 1px solid var(--border-strong); padding: 6px 12px; text-align: left; vertical-align: top; }
.pj-editor th { background: var(--bg-soft); font-weight: 600; }
.pj-editor td p, .pj-editor th p { margin: 0; }
/* dragging across cells selects whole cells: ProseMirror hides the text selection and marks the cells */
.pj-editor .selectedCell { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.pj-editor .ProseMirror.ProseMirror-hideselection ::selection { background: transparent; } /* over the .pj-hl selection colour too */
.pj-editor .ProseMirror-hideselection { caret-color: transparent; }
.pj-editor hr { border: 0; border-top: 1px solid var(--border-strong); margin: 2em 0; }
.pj-editor img { max-width: 100%; border-radius: 6px; }
.pj-editor .ProseMirror-selectednode { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
/* the caret between two blocks no text can go between, such as after a table at the end */
.pj-editor .ProseMirror-gapcursor { display: none; position: absolute; pointer-events: none; }
.pj-editor .ProseMirror-gapcursor::after { content: ""; position: absolute; top: -2px; width: 20px; border-top: 1px solid var(--text); animation: pj-gapcursor-blink 1.1s steps(2, start) infinite; }
.pj-editor .ProseMirror-focused .ProseMirror-gapcursor { display: block; }
@keyframes pj-gapcursor-blink { to { visibility: hidden; } }

/* the plain view (web/views/plain/view.js): any other text file, as it is, in mono;
   the page scrolls it, so its scroller lets a flag over the first line show */
.pj-editor .cm-editor.cm-focused { outline: none; }
.pj-editor .cm-editor .cm-scroller { font: var(--code-size)/1.6 var(--mono); overflow: visible; }
.pj-editor .cm-editor:not(.cm-lineWrapping) .cm-scroller { overflow-x: auto; }
.pj-editor .cm-gutters { background: none; border: 0; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.pj-editor .cm-lineNumbers .cm-gutterElement { padding: 0 16px 0 0; }
.pj-editor .cm-editor .cm-content { min-height: 50vh; padding: 0; color: var(--text); caret-color: var(--text); tab-size: 4; }
.pj-editor .cm-editor .cm-line { padding: 0; }
.pj-editor .cm-content ::selection { background: color-mix(in srgb, var(--accent) 22%, transparent); }

/* the plain view's whitespace: dots for spaces, arrows for tabs, a guide per indent step (--indent characters) */
.pj-ws-space { background: radial-gradient(circle at 50% 55%, var(--text-faint) 1px, transparent 1.5px) 0 0 / 1ch 100% repeat-x; }
.pj-ws-tab { position: relative; }
.pj-ws-tab::before { content: '→'; position: absolute; left: 0; color: var(--text-faint); }
.pj-guides { background: repeating-linear-gradient(to right, var(--border-strong) 0 1px, transparent 1px calc(var(--indent) * 1ch)); }
.pj-guides-blank { background: repeating-linear-gradient(to right, var(--border-strong) 0 1px, transparent 1px calc(var(--indent) * 1ch)) 0 0 / calc(var(--width) * 1ch) 100% no-repeat; }

/* the plain view's status bar, under the page */
.pj-statusbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 28px; padding: 0 16px; flex: none; background: var(--bg-soft); border-top: 1px solid var(--border); font-size: 12px; color: var(--text-soft); font-variant-numeric: tabular-nums; }
.pj-statusbar .pj-block-menu { color: var(--text); }
.pj-status-actions { display: flex; align-items: center; gap: 2px; }
.pj-statusbar button { height: 22px; padding: 0 8px; border: 0; border-radius: 6px; background: none; font-size: 12px; color: var(--text-soft); }
.pj-statusbar button:hover, .pj-statusbar button[aria-expanded="true"] { background: var(--hover); color: var(--text); }
.pj-statusbar button[aria-pressed="true"] { background: var(--active); color: var(--text); }

/* focus mode: no toolbar or outline, everything but the current block recedes */
[data-focus] .pj-toolbar, [data-focus] .pj-outline, [data-no-outline] .pj-outline { display: none !important; }
[data-focus] .pj-editor .ProseMirror > * { transition: opacity 0.2s ease; }
[data-focus] .pj-editor[data-fade] .ProseMirror > :not(.pj-current) { opacity: 0.28; }
[data-focus] .pj-margin:not(:hover):not(:focus-within) { opacity: 0.4; }

/* comment highlights */
.pj-hl { background: var(--highlight); border-radius: 0; cursor: text; transition: background 0.2s; }
/* a selection inside commented text has to read over its grey */
.pj-editor .pj-hl::selection, .pj-editor .pj-hl *::selection { background: color-mix(in srgb, var(--accent) 45%, transparent); }
.pj-hl-active { background: var(--highlight-active); }
/* a proposal or a past edit shown in the text; .pj-replay plays it once: removal first, then the new text */
.pj-mark-del { color: var(--red); text-decoration: line-through; text-decoration-color: var(--red); background: color-mix(in srgb, var(--red) 8%, transparent); }
.pj-mark-ins { color: var(--green); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--green) 50%, transparent); background: color-mix(in srgb, var(--green) 10%, transparent); }
ins.pj-mark-ins { margin-left: 0.15em; }
del.pj-mark-del { margin-right: 0.15em; }
.pj-mark-del.pj-replay { animation: pj-replay-del 0.6s ease-out both; }
.pj-mark-ins.pj-replay { animation: pj-replay-ins 0.7s ease-out 0.55s both; }
@keyframes pj-replay-del { from { text-decoration-color: transparent; background: transparent; color: var(--text); } }
@keyframes pj-replay-ins { from { opacity: 0; background: color-mix(in srgb, var(--green) 35%, transparent); } }
@media (prefers-reduced-motion: reduce) { .pj-replay { animation: none !important; } }

/* text someone just changed outside a buddy's run, labelled with their name, fading out */
.pj-flash { animation: pj-flash 6s ease-out forwards; border-radius: 0; }
.pj-flash-block { animation: pj-flash 6s ease-out forwards; border-radius: 4px; }
@keyframes pj-flash { 0%, 40% { background: var(--active); } 100% { background: transparent; } }
.pj-flag { position: relative; display: inline; }
.pj-flag-label { position: absolute; bottom: 100%; left: -1px; z-index: 4; padding: 0 6px; border-radius: 4px 4px 4px 0; background: var(--buddy, var(--text)); color: var(--buddy-ink, var(--on-text)); font: 600 11px/1.6 var(--ui-font); white-space: nowrap; pointer-events: none; animation: pj-fade 6s ease-out forwards; }
.pj-flag::before { content: ''; position: absolute; top: -0.1em; bottom: -0.1em; left: -1px; border-left: 2px solid var(--buddy, var(--text)); animation: pj-fade 6s ease-out forwards; }
@keyframes pj-fade { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }

/* a buddy in the doc: its cursor stays where it last wrote; its name shows while it works */
.pj-cursor { position: relative; display: inline-block; width: 0; height: 1.1em; vertical-align: text-bottom; pointer-events: none; }
.pj-cursor::before { content: ''; position: absolute; top: 0; bottom: 0; left: -1px; border-left: 2px solid var(--buddy); }
.pj-cursor-working::before { animation: pj-gapcursor-blink 1s steps(1) infinite; }
.pj-cursor-name { display: none; position: absolute; bottom: 100%; left: -1px; z-index: 4; padding: 0 6px; border-radius: 4px 4px 4px 0; background: var(--buddy); color: var(--buddy-ink); font: 600 11px/1.6 var(--ui-font); white-space: nowrap; }
.pj-cursor-working .pj-cursor-name { display: block; }
@media (prefers-reduced-motion: reduce) { .pj-cursor-working::before { animation: none; } }

/* a buddy's run as a revision: new text in its colour, removed text grey and struck through */
.pj-buddy-edit { background: color-mix(in oklch, var(--buddy) 16%, transparent); box-shadow: inset 0 -2px 0 var(--buddy); border-radius: 0; }
.pj-buddy-del { color: var(--text-faint); text-decoration: line-through; }
del.pj-buddy-del { margin-right: 0.15em; }
.pj-buddy-del.pj-replay { animation: pj-replay-del 0.6s ease-out both; }
.pj-buddy-edit.pj-replay { animation: pj-replay-buddy 0.7s ease-out 0.55s both; }
@keyframes pj-replay-buddy { from { opacity: 0; background: color-mix(in oklch, var(--buddy) 40%, transparent); } }
.pj-receipt { display: flex; align-items: center; gap: 6px; margin-top: 8px; min-height: 28px; padding: 0 2px 0 8px; border: 1px solid color-mix(in oklch, var(--buddy) 45%, transparent); border-radius: 6px; background: color-mix(in oklch, var(--buddy) 8%, transparent); color: var(--text-soft); font-size: 12px; font-variant-numeric: tabular-nums; }
.pj-receipt > .pj-icon, .pj-receipt-show > .pj-icon { width: 14px; height: 14px; flex: none; color: var(--buddy); }
/* the count shows the run's edits in the text, pressed while they are shown */
.pj-receipt-show { display: flex; flex: 1; min-width: 0; align-self: stretch; align-items: center; gap: 6px; border: 0; padding: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.pj-receipt:has(.pj-receipt-show:hover) { background: color-mix(in oklch, var(--buddy) 14%, transparent); }
.pj-receipt:has(.pj-receipt-show[aria-pressed="true"]) { border-color: var(--buddy); background: color-mix(in oklch, var(--buddy) 20%, transparent); color: var(--text); }
.pj-receipt-undone { border-color: var(--border); background: none; }
.pj-receipt-undone > .pj-icon { color: var(--text-faint); }

/* ---- selection bubble ---- */

.pj-bubble { position: absolute; z-index: 12; display: flex; align-items: center; gap: 2px; padding: 4px; background: var(--bg); border-radius: 10px; box-shadow: var(--shadow-raised); animation: pj-pop 0.12s ease-out; }
.pj-bubble .pj-bubble-comment { color: var(--text); font-weight: 600; padding: 0 12px 0 8px; }
.pj-bubble .pj-bubble-comment:hover { background: var(--hover); }
.pj-bubble .pj-sep { height: 18px; margin: 0 4px; }
.pj-bubble .pj-icon { width: 17px; height: 17px; }

/* ---- link popover ---- */

.pj-link { position: fixed; z-index: 40; display: flex; align-items: center; gap: 6px; width: 380px; max-width: calc(100vw - 16px); padding: 6px 6px 6px 8px; background: var(--bg); border-radius: 10px; box-shadow: var(--shadow-raised); animation: pj-pop 0.12s ease-out; }
.pj-link-icon { display: flex; color: var(--text-soft); }
.pj-link-icon .pj-icon { width: 16px; height: 16px; }
.pj-link-input { flex: 1; min-width: 0; height: 28px; padding: 0 8px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--canvas); color: var(--text); font: inherit; font-size: 13px; }
.pj-link-input::placeholder { color: var(--text-faint); }
.pj-link-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.pj-link .pj-primary { flex: none; }
.pj-link .pj-icon-btn:hover { color: var(--red); }
.pj-link-card { position: fixed; z-index: 40; display: flex; align-items: center; gap: 2px; max-width: min(420px, calc(100vw - 16px)); padding: 4px; background: var(--bg); border-radius: 10px; box-shadow: var(--shadow-raised); animation: pj-pop 0.12s ease-out; }
.pj-link-go { display: flex; align-items: center; gap: 6px; min-width: 0; height: 28px; padding: 0 8px; border: 0; border-radius: 6px; background: none; color: var(--accent); font-size: 13px; }
.pj-link-go:hover { background: var(--hover); text-decoration: underline; }
.pj-link-go-icon { display: flex; flex: none; color: var(--text-soft); }
.pj-link-go .pj-icon, .pj-link-card .pj-icon-btn .pj-icon { width: 16px; height: 16px; }
.pj-link-go-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pj-link-card [data-action="unlink"]:hover { color: var(--red); }
.pj-editor .pj-link-target { background: color-mix(in srgb, var(--accent) 22%, transparent); }



/* ---- outline: ticks at the left edge, a list on hover ---- */

.pj-outline { position: sticky; top: 0; height: 0; z-index: 8; }
.pj-outline-ticks { position: absolute; top: 120px; left: 20px; display: flex; flex-direction: column; gap: 8px; padding: 8px 0; }
.pj-outline-ticks i { display: block; width: 22px; height: 2px; border-radius: 0; background: var(--border-strong); margin-left: 0; transition: background 0.15s; }
.pj-outline-ticks i[data-depth="1"] { width: 16px; margin-left: 6px; }
.pj-outline-ticks i[data-depth="2"], .pj-outline-ticks i[data-depth="3"] { width: 10px; margin-left: 12px; }
.pj-outline-ticks i.pj-on { background: var(--text); }
.pj-outline-panel { position: absolute; top: 104px; left: 10px; width: 250px; max-height: calc(100vh - 260px); overflow-y: auto; padding: 8px 6px; background: var(--bg); border-radius: 10px; box-shadow: var(--shadow-raised); opacity: 0; visibility: hidden; transform: translateX(-6px); transition: opacity 0.15s, transform 0.15s, visibility 0s 0.15s; }
.pj-outline:hover .pj-outline-panel, .pj-outline:focus-within .pj-outline-panel { opacity: 1; visibility: visible; transform: none; transition: opacity 0.15s, transform 0.15s; }
.pj-outline-title { padding: 0 8px 6px; font-size: 12px; font-weight: 600; color: var(--text-faint); }
.pj-outline-list { list-style: none; margin: 0; padding: 0; }
.pj-outline-list button { display: block; width: 100%; border: 0; background: none; text-align: left; line-height: 20px; color: var(--text-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pj-outline-list button:hover { background: var(--hover); color: var(--text); }
.pj-outline-list button.pj-on { color: var(--text); font-weight: 500; }
.pj-outline-list button[data-depth="1"] { padding-left: 24px; }
.pj-outline-list button[data-depth="2"], .pj-outline-list button[data-depth="3"] { padding-left: 32px; font-size: 12px; }

/* ---- comment cards ---- */

.pj-card { position: absolute; left: 0; right: 0; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px 16px; cursor: pointer; transition: top 0.18s ease, box-shadow 0.18s, transform 0.18s ease-out, border-color 0.18s; }
.pj-card:hover { border-color: var(--border-strong); }
.pj-card-active { background: var(--bg); border-color: transparent; box-shadow: var(--shadow-raised); transform: translateX(-14px); cursor: default; z-index: 2; }
.pj-card-working { border-color: color-mix(in oklch, var(--buddy) 60%, transparent); box-shadow: inset 3px 0 0 var(--buddy); }
.pj-card-active.pj-card-working { box-shadow: var(--shadow-raised), inset 3px 0 0 var(--buddy); }
.pj-card-resolved { opacity: 0.88; }
.pj-margin-list .pj-card, .pj-margin-list .pj-empty { position: static; margin-bottom: 12px; transform: none; }

.pj-card-note { font-size: 12px; color: var(--text-soft); margin-bottom: 6px; }
.pj-quote { margin: 0 0 8px; padding-left: 8px; border-left: 3px solid var(--highlight-active); color: var(--text-soft); font-size: 13px; }
/* who and when sit on one quiet line; what they said reads under it, full width */
.pj-msg + .pj-msg, .pj-more + .pj-msg { margin-top: 16px; }
.pj-msg-head { display: flex; align-items: center; gap: 6px; min-height: 24px; }
.pj-msg-head .pj-avatar { --size: 18px; }
.pj-who { display: flex; align-items: baseline; flex-wrap: wrap; column-gap: 6px; min-width: 0; flex: 1; line-height: 1.3; }
.pj-name { font-weight: 500; font-size: 12px; color: var(--text-soft); display: inline-flex; align-items: center; gap: 4px; }
.pj-ai { font-size: 11px; font-weight: 600; color: var(--text-soft); background: var(--hover); border-radius: 4px; padding: 0 4px; line-height: 1.6; }
.pj-time { color: var(--text-faint); font-size: 12px; font-weight: 400; }
.pj-body { margin-top: 4px; white-space: pre-wrap; word-wrap: break-word; font-size: 14px; line-height: 1.6; color: var(--text); }
/* an agent's request that failed, or that it cannot start: its apology in red, with Retry and Cancel beside its name */
.pj-msg + .pj-msg-failed, .pj-quote + .pj-msg-failed { margin-top: 16px; }
.pj-msg-failed .pj-body { color: var(--red); }
.pj-body-folded { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.pj-card:not(.pj-card-active) .pj-body-folded { -webkit-line-clamp: 3; }
/* Show more / less and folded replies: quiet text with a chevron that flips; the comment text stays the focus */
.pj-fold, .pj-more { display: inline-flex; align-items: center; gap: 2px; border: 0; background: none; padding: 0; font: inherit; font-size: 12px; font-weight: 400; color: var(--text-faint); cursor: pointer; transition: color 0.15s; }
.pj-fold { margin-top: 2px; }
.pj-fold[hidden] { display: none; }
.pj-fold:hover, .pj-fold:focus-visible, .pj-more:hover, .pj-more:focus-visible { color: var(--text-soft); }
.pj-fold .pj-icon, .pj-more .pj-icon { width: 13px; height: 13px; transition: transform 0.15s; }
.pj-fold[aria-expanded="true"] .pj-icon, .pj-more[aria-expanded="true"] .pj-icon { transform: rotate(180deg); }
/* folded replies: the repliers' faces and a count in the link color, so it reads as something to open */
.pj-more { margin: 12px 0 0 -6px; padding: 2px 6px; gap: 6px; border-radius: 6px; font-size: 12px; font-weight: 500; color: var(--text-soft); transition: background 0.15s; }
.pj-more:hover, .pj-more:focus-visible { color: var(--text); background: var(--hover); }
.pj-more + .pj-msg { margin-top: 12px; }
/* side by side, not stacked: agent faces are blobs, and a ring cut around one would bite into the next */
.pj-more-faces { display: inline-flex; gap: 2px; }
.pj-more-faces .pj-avatar { --size: 16px; }

.pj-resolve { opacity: 0; transition: opacity 0.15s; }
.pj-card:hover .pj-resolve, .pj-resolve:focus-visible { opacity: 1; }
@media (hover: none) { .pj-resolve { opacity: 1; } }
.pj-check { width: 18px; height: 18px; fill: currentColor; flex: none; }

.pj-typing { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 13px; color: var(--text-soft); }

.pj-resolved-row { display: flex; align-items: center; gap: 6px; margin-top: 12px; padding-top: 8px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-soft); }
.pj-resolved-row span { flex: 1; }
.pj-link-button { border: 0; background: none; color: var(--text); font-size: 13px; font-weight: 500; padding: 2px 6px; border-radius: 4px; }
.pj-link-button:hover { background: var(--hover); }

.pj-composer { position: relative; margin-top: 12px; }
.pj-composer textarea { display: block; width: 100%; resize: none; overflow: hidden; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--bg); color: var(--text); padding: 4px 12px; font: inherit; font-size: 14px; line-height: 1.4; transition: border-color 0.15s, box-shadow 0.15s; }
.pj-composer textarea::placeholder { color: var(--text-faint); }
.pj-composer textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.pj-composer-buttons { display: flex; gap: 8px; margin-top: 8px; }
.pj-card:not(.pj-card-draft) .pj-composer:not(:focus-within) .pj-composer-buttons { display: none; }
.pj-primary, .pj-secondary { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 28px; border-radius: 6px; padding: 0 12px; font-size: 13px; font-weight: 500; }
.pj-primary { border: 0; background: var(--text); color: var(--on-text); }
.pj-primary:hover:not(:disabled) { background: color-mix(in srgb, var(--text) 86%, var(--canvas)); }
.pj-secondary { border: 1px solid var(--border-strong); background: var(--bg); color: var(--text); }
.pj-secondary:hover { background: var(--hover); }
.pj-empty { color: var(--text-soft); font-size: 13px; }

.pj-shortcuts-body { columns: 2 220px; column-gap: 32px; }
.pj-shortcuts-body section { break-inside: avoid; margin-bottom: 16px; }
.pj-shortcuts-body h3 { margin: 8px 0 6px; font-size: 12px; font-weight: 600; color: var(--text-faint); }
.pj-shortcut { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 13px; border-bottom: 1px solid var(--border); }

/* ---- settings ---- */

.pj-settings { width: min(720px, calc(100vw - 32px)); height: min(520px, calc(100vh - 64px)); padding: 0; border: 0; border-radius: 14px; background: var(--bg); color: var(--text); box-shadow: var(--shadow-raised); overflow: hidden; }
.pj-settings[open] { display: grid; grid-template-columns: 196px minmax(0, 1fr); animation: pj-pop 0.15s ease-out; }
.pj-settings::backdrop { background: var(--scrim); }
.pj-settings-nav { display: flex; flex-direction: column; gap: 2px; padding: 16px 8px; background: var(--bg-soft); }
.pj-settings-title { padding: 2px 8px 8px; font-size: 12px; font-weight: 600; color: var(--text-faint); }
.pj-settings-nav button { display: flex; align-items: center; gap: 8px; border: 0; background: none; text-align: left; color: var(--text-soft); }
.pj-settings-nav button .pj-icon { width: 16px; height: 16px; }
.pj-settings-nav button:hover { background: var(--hover); color: var(--text); }
.pj-settings-nav button[aria-selected="true"] { background: var(--active); color: var(--text); font-weight: 500; }
.pj-settings-main { position: relative; overflow-y: auto; padding: 24px 32px 32px; }
.pj-settings-close { position: absolute; top: 12px; right: 12px; }
.pj-settings-section h2 { margin: 2px 0 12px; font-size: 16px; font-weight: 600; }
.pj-setting { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 52px; padding: 12px 0; border-top: 1px solid var(--border); font-size: 13px; }
label.pj-setting { cursor: pointer; }
.pj-setting-stacked { flex-direction: column; align-items: stretch; gap: 8px; }
.pj-setting-text { display: flex; flex-direction: column; min-width: 0; }
.pj-setting-text label, .pj-setting-label { font-weight: 500; }
.pj-setting-control { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.pj-input { width: 200px; padding: 4px 8px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--canvas); color: var(--text); font: inherit; }
.pj-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.pj-input-error { font-size: 12px; color: var(--red); }
.pj-input[aria-invalid="true"] { border-color: var(--red); }
.pj-input[readonly] { background: var(--bg-soft); color: var(--text-soft); }
.pj-setting-hint { margin-top: 2px; font-size: 12px; font-weight: 400; color: var(--text-soft); }
.pj-setting-hint code { font-family: var(--mono); font-size: 0.92em; }
.pj-setting-row { display: flex; align-items: center; gap: 8px; }
.pj-settings-intro { margin: -4px 0 16px; font-size: 12px; color: var(--text-soft); }
/* Settings with a page of their own (a view or a rule): a row per page, the whole row its button */
.pj-setting-pages { list-style: none; margin: 0; padding: 0; }
.pj-setting-pages li { border-top: 1px solid var(--border); }
.pj-setting-pages button { display: flex; align-items: center; gap: 16px; width: calc(100% + 16px); min-height: 52px; margin: 0 -8px; padding: 12px 8px; border: 0; border-radius: 6px; background: none; font-size: 13px; text-align: left; }
.pj-setting-pages button:hover { background: var(--hover); }
.pj-setting-pages .pj-setting-text { flex: 1; }
.pj-setting-ext { margin-left: 6px; font-family: var(--mono); font-size: 11px; font-weight: 400; color: var(--text-faint); }
.pj-setting-state { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-soft); }
.pj-setting-state .pj-icon { width: 16px; height: 16px; color: var(--text-faint); transform: rotate(-90deg); }
.pj-settings-section .pj-back { margin: -4px 0 8px -6px; }
[data-kind="claude"] [data-for]:not([data-for~="claude"]),
[data-kind="codex"] [data-for]:not([data-for~="codex"]),
[data-kind="custom"] [data-for]:not([data-for~="custom"]) { display: none; }
.pj-segmented { display: inline-flex; padding: 2px; border-radius: 6px; background: var(--bg-soft); flex: none; }
.pj-segmented button { border: 0; background: none; padding: 4px 12px; border-radius: 6px; font-size: 12px; color: var(--text-soft); }
.pj-segmented button[aria-checked="true"] { background: var(--bg); color: var(--text); box-shadow: var(--shadow); }
.pj-stepper { align-items: center; }
.pj-stepper span { min-width: 56px; text-align: center; font-size: 12px; font-variant-numeric: tabular-nums; }
.pj-stepper button { min-width: 28px; font-size: 14px; }
.pj-stepper button:disabled { color: var(--text-faint); }
.pj-setting-group { margin: 20px 0 4px; font-size: 12px; font-weight: 600; color: var(--text-faint); }
.pj-switch { appearance: none; width: 32px; height: 18px; margin: 0; border-radius: 999px; background: var(--text-faint); position: relative; cursor: pointer; transition: background 0.15s; flex: none; }
.pj-switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--canvas); box-shadow: var(--shadow); transition: transform 0.15s; }
.pj-switch:checked { background: var(--text); }
.pj-switch:checked::after { transform: translateX(14px); }
.pj-radio { appearance: none; flex: none; width: 16px; height: 16px; margin: 0; border: 1px solid var(--border-strong); border-radius: 50%; background: var(--canvas); cursor: pointer; }
.pj-radio:checked { border-color: var(--text); background: radial-gradient(var(--text) 0 4px, var(--canvas) 4.5px); }
.pj-radio:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.pj-choices { list-style: none; margin: 0; padding: 0; }
.pj-choices > li { border-top: 1px solid var(--border); }
.pj-choice { display: flex; align-items: flex-start; gap: 8px; padding: 12px 0; font-size: 13px; cursor: pointer; }
.pj-choice .pj-radio { margin-top: 1px; }
.pj-choice-detail { padding: 0 0 12px 24px; }
.pj-shortcuts-body { padding-top: 4px; }

/* ---- home window (desktop/start.html) ---- */

.pj-home { user-select: none; }
.pj-start { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 16px; }
/* the one way in, a row like the agent list's New buddy: the OS dialog opens a folder, or makes a new one */
.pj-start-open { display: flex; align-items: center; gap: 8px; margin: 0 -8px 8px; border: 0; background: none; color: var(--text-soft); font-weight: 500; text-align: left; }
.pj-start-open:hover { background: var(--hover); color: var(--text); }
.pj-start-open [data-icon] { width: 16px; height: 16px; flex: none; display: inline-flex; align-items: center; justify-content: center; border: 1px dashed var(--border-strong); border-radius: 4px; }
.pj-start-open .pj-icon { width: 11px; height: 11px; }
/* recent projects: rows like the docs sidebar's */
.pj-recent { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.pj-recent ul { list-style: none; margin: 0 -8px; padding: 0; overflow-y: auto; }
.pj-recent li button { width: 100%; display: flex; align-items: center; gap: 8px; border: 0; background: none; text-align: left; }
.pj-recent li button:hover { background: var(--hover); }
.pj-recent li .pj-icon { width: 16px; height: 16px; color: var(--text-faint); }
.pj-recent-name { flex: none; max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.pj-recent-folder { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: rtl; text-align: right; color: var(--text-faint); font-size: 12px; }
.pj-recent-empty { margin: 0; padding: 4px 0; color: var(--text-faint); font-size: 13px; }

/* ---- responsive ---- */

/* ---- version history ---- */

/* While history is open, the toolbar and the editable page give way to a
   read-only page of the selected version and the list of versions. */
.pj-history-bar, .pj-history-stage { display: none; }
/* A file other than a doc, shown read only in the doc's place. */
.pj-preview, .pj-preview-name { display: none; }
[data-preview] :is(.pj-toolbar, .pj-stage, .pj-outline, .pj-banner, .pj-doc-name, .pj-status, .pj-count) { display: none; }
[data-preview] .pj-preview { display: block; max-width: var(--page-w); margin: 0 auto; padding: 24px var(--page-pad) 160px; }
[data-preview] .pj-preview-name { display: block; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pj-preview-text { margin: 0; font: 13px/1.6 var(--mono); color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; tab-size: 4; }
.pj-preview-note { margin: 0; color: var(--text-soft); font-size: 14px; }
[data-history] .pj-toolbar, [data-history] .pj-stage:not(.pj-history-stage), [data-history] .pj-outline { display: none; }
[data-history] .pj-history-bar { display: flex; align-items: center; gap: 8px; margin: 0 12px 8px; padding: 4px; min-height: 36px; background: var(--bg-soft); border-radius: 10px; flex: none; font-size: 13px; }
[data-history] .pj-history-stage { display: grid; --margin-w: 320px; --stage-gap: 24px; }
.pj-toolbar .pj-tool-history { color: var(--text-soft); }
/* Back to where you were: the history's Back, a settings page's */
.pj-back { border: 0; background: none; border-radius: 6px; height: 28px; padding: 0 8px 0 6px; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; color: var(--text); }
.pj-back:hover { background: var(--hover); }
.pj-history-heading { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pj-history-changes { display: inline-flex; align-items: center; gap: 6px; color: var(--text-soft); white-space: nowrap; cursor: pointer; }
.pj-history-changes input { accent-color: var(--text); margin: 0; }
.pj-history-restore { flex: none; height: 28px; }
.pj-history-stage .pj-editor .ProseMirror { caret-color: transparent; }
.pj-history { position: sticky; top: 16px; align-self: start; display: flex; flex-direction: column; max-height: calc(100vh - 150px); background: var(--bg-soft); border-radius: 10px; box-shadow: var(--shadow); overflow: hidden; }
.pj-history-list { list-style: none; margin: 0; padding: 4px 8px 8px; overflow-y: auto; outline: none; }
.pj-history-list:focus-visible .pj-version[aria-selected="true"] { box-shadow: inset 0 0 0 2px var(--accent); }
.pj-history-day { padding: 12px 8px 4px; font-size: 12px; font-weight: 600; color: var(--text-faint); }
.pj-history-empty { padding: 8px; color: var(--text-soft); }
.pj-version { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; column-gap: 8px; row-gap: 2px; align-items: center; cursor: pointer; }
.pj-version:hover { background: var(--hover); }
.pj-version[aria-selected="true"] { background: var(--active); }
.pj-version .pj-avatar { grid-row: span 2; align-self: start; }
.pj-version-outside { background: var(--bg-soft); color: var(--text-soft); }
.pj-version-outside .pj-icon { width: 13px; height: 13px; }
.pj-version-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.pj-version-who { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pj-version-tag { flex: none; padding: 0 6px; border-radius: 6px; font-size: 11px; font-weight: 500; line-height: 17px; background: var(--hover); color: var(--text-soft); }
.pj-version-time { font-size: 12px; color: var(--text-soft); white-space: nowrap; }
.pj-version-what { grid-column: 2 / 4; display: flex; gap: 8px; min-width: 0; font-size: 12px; color: var(--text-soft); }
.pj-version-note { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pj-version-stats { flex: none; margin-left: auto; display: inline-flex; gap: 6px; font-variant-numeric: tabular-nums; }
.pj-plus { color: var(--green); }
.pj-minus { color: var(--red); }

/* ---- folder sidebar: a desktop window opened on a folder lists its docs ---- */

:root { --files-w: 248px; }
:root[data-files] body { padding-left: var(--files-w); }
.pj-files { position: fixed; z-index: 9; top: 0; bottom: 0; left: 0; width: var(--files-w); display: flex; flex-direction: column; background: var(--bg-soft); border-right: 1px solid var(--border); }
.pj-files-head { display: flex; align-items: center; gap: 8px; height: 52px; padding: 0 16px; flex: none; font-size: 13px; font-weight: 600; }
.pj-files-icon { display: flex; color: var(--text-soft); }
.pj-files-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pj-files-find { display: flex; align-items: center; gap: 6px; flex: none; padding: 8px 16px; border-top: 1px solid var(--border); color: var(--text-faint); font: 13px var(--mono); }
.pj-files-find:focus-within { color: var(--text-soft); }
.pj-files-filter { flex: 1; min-width: 0; padding: 0; border: 0; background: none; color: var(--text); font: inherit; outline: none; }
.pj-files-filter::placeholder { color: var(--text-faint); }
.pj-files-find:has([aria-invalid="true"]) { color: var(--red); }
.pj-files-filter[aria-invalid="true"] { color: var(--red); }
.pj-files-label mark { background: var(--accent-soft); color: var(--text); border-radius: 2px; }
.pj-files-none { padding: 6px 8px; color: var(--text-faint); font-size: 13px; list-style: none; }
.pj-files-tree, .pj-files-tree ul { list-style: none; margin: 0; padding: 0; }
.pj-files-tree { flex: 1; min-height: 0; overflow-y: auto; padding: 0 8px 16px; }
.pj-files-tree ul { padding-left: 16px; }
.pj-files-row { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: none; text-align: left; color: var(--text-soft); }
.pj-files-row:hover { background: var(--hover); color: var(--text); }
/* what git ignores (build output, installed packages): dimmed, not hidden */
.pj-files-row.pj-files-ignored { color: var(--text-faint); }
.pj-files-row .pj-icon { width: 16px; height: 16px; color: var(--text-faint); }
.pj-files-row .pj-files-chevron { width: 16px; height: 16px; transition: transform 0.15s; }
.pj-files-folder[aria-expanded="false"] .pj-files-chevron { transform: rotate(-90deg); }
.pj-files-file { padding-left: 32px; }
.pj-files-file[aria-current="page"] { background: var(--active); color: var(--text); font-weight: 500; }
.pj-files-file[aria-current="page"] .pj-icon { color: var(--text-soft); }
.pj-files-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pj-files-row { cursor: default; user-select: none; -webkit-user-select: none; outline: none; }
.pj-files-row:focus-visible { box-shadow: inset 0 0 0 1.5px var(--accent); }
.pj-files-row > .pj-files-label { flex: 1; }
.pj-files-input { flex: 1; min-width: 0; height: 24px; margin: -2px 0; padding: 0 6px; border: 1px solid var(--accent); border-radius: 4px; background: var(--bg); color: var(--text); font: inherit; font-size: 13px; outline: none; }
.pj-files-input[aria-invalid="true"] { border-color: var(--red); }
.pj-files-editing, .pj-files-editing:hover { background: none; }
.pj-files-row[aria-busy="true"] { opacity: 0.6; }
.pj-files-error { margin: 2px 8px 4px 32px; color: var(--red); font-size: 12px; line-height: 1.4; }
.pj-files-dragging, .pj-files-dragging * { cursor: grabbing !important; }
.pj-files-nodrop, .pj-files-nodrop * { cursor: not-allowed !important; }
.pj-files-dragging .pj-files-row:hover:not(.pj-files-drop) { background: none; }
.pj-files-dragged { opacity: 0.45; }
.pj-files-drop, .pj-files-head.pj-files-drop { background: var(--active); color: var(--text); box-shadow: inset 0 0 0 1.5px var(--text-faint); }
.pj-files-head.pj-files-drop { border-radius: 6px; }
.pj-files-ghost { position: fixed; z-index: 100; top: 0; left: 0; display: flex; align-items: center; gap: 6px; max-width: 220px; padding: 4px 8px; border-radius: 6px; background: var(--bg); box-shadow: var(--shadow-raised); color: var(--text); font-size: 13px; pointer-events: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pj-files-ghost .pj-icon { width: 15px; height: 15px; color: var(--text-faint); }
.pj-files-resize { position: absolute; z-index: 1; top: 0; bottom: 0; right: -4px; width: 8px; cursor: col-resize; }
.pj-files-resize::after { content: ''; position: absolute; top: 0; bottom: 0; left: 3px; width: 2px; transition: background 0.15s; }
.pj-files-resize:hover::after, .pj-files-resizing .pj-files-resize::after { background: var(--text-faint); transition-delay: 0.1s; }
.pj-files-resizing, .pj-files-resizing * { cursor: col-resize !important; user-select: none !important; }
.pj-header .pj-files-toggle { margin-left: -6px; }
.pj-files-toggle[aria-pressed="true"] { color: var(--text); }

@media (max-width: 1240px) {
  .pj-outline { display: none; }
}
@media (max-width: 1180px) {
  :root { --page-pad: 48px; --margin-w: 320px; --stage-gap: 24px; }
}
@media (max-width: 900px) {
  :root { --page-pad: 20px; }
  /* the sidebar floats over the page, under the toggle that opens it */
  .pj-files-resize { display: none; }
  .pj-files { top: 50px; bottom: 12px; left: 8px; z-index: 25; width: min(var(--files-w), calc(100vw - 16px)); border: 0; border-radius: 10px; background: var(--bg); box-shadow: var(--shadow-raised); animation: pj-pop 0.14s ease-out; }
  .pj-stage { grid-template-columns: minmax(0, 1fr); padding: 0 0 80px; }
  .pj-page { padding-top: 24px; padding-bottom: 48px; min-height: 0; }
  /* the comments rise from the bottom over the page, opened by the Comments button or commented text */
  .pj-margin { position: fixed; z-index: 24; left: max(8px, 50% - 320px); right: max(8px, 50% - 320px); bottom: 8px; max-height: 50vh; overflow-y: auto; overscroll-behavior: contain; padding: 12px 12px 2px; border-radius: 14px; background: var(--bg); box-shadow: var(--shadow-raised); height: auto !important; animation: pj-rise 0.18s ease-out; }
  :root:not([data-comments-open]) .pj-margin { display: none; }
  [data-comments-open] .pj-canvas { scroll-padding-bottom: calc(50vh + 16px); }
  [data-comments-open] .pj-stage { padding-bottom: calc(50vh + 16px); }
  .pj-margin > .pj-empty { margin: 4px 4px 16px; }
  .pj-card { position: static; margin-bottom: 12px; transform: none; }
  .pj-card-active { transform: none; }
  .pj-toolbar { margin: 0 8px 8px; }
  .pj-count { display: none; }
  .pj-editor .ProseMirror > h1:first-child { font-size: 2em; }
  .pj-header { padding: 0 8px 0 12px; }
  .pj-history { order: -1; position: static; max-height: 38vh; margin: 12px 16px 0; }
  [data-history] .pj-history-bar { margin: 0 8px 8px; flex-wrap: wrap; border-radius: 14px; }
  .pj-history-heading { flex: 1; }
}
@media (max-width: 640px) {
  .pj-settings[open] { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .pj-settings-nav { flex-direction: row; overflow-x: auto; padding: 8px; }
  .pj-settings-title { display: none; }
  .pj-settings-main { padding: 16px 16px 24px; }
}
@media (max-width: 560px) {
  .pj-doc-icon, .pj-toolbar .pj-block-picker, .pj-toolbar .pj-block-picker + .pj-sep { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
