/* ── Contracts (Ollie, 2026-08-04) — house design: quiet green pills,
   mono for data values, coral for destructive ── */
#panel-contracts { padding: 24px 40px 60px; }
/* Head matches the To Do tab's (Ollie, 2026-08-07): same 32px inset,
   22px title, hairline underneath. The negative margins pull the head
   through #panel-contracts' 24/40 padding to the panel edges, exactly
   where #panel-board (padding 0) puts its board-head. */
.cx-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  margin: -24px -40px 20px; padding: 32px 32px 20px;
  border-bottom: 1px solid var(--border);
}
.cx-title { font-family: var(--font-body); font-size: 22px; font-weight: 700; letter-spacing: -0.4px; color: var(--text); }
.cx-sub { font-size: 12px; color: var(--text-3); margin-top: 3px; }
/* identical to .pj-new-btn (+ New Project) — same 13px/8px 18px, so the
   two page-level add pills read as one control (Ollie, 2026-08-07).
   Folder mode keeps its own 12px/6px 14px tier, as Projects' does. */
.cx-upload-btn {
  font-family: var(--font-body); font-size: 13px; font-weight: 700;
  color: var(--green); background: transparent;
  border: 1px solid rgba(45,106,79,0.25); border-radius: 999px;
  padding: 8px 18px; cursor: pointer; white-space: nowrap;
  transition: all 150ms var(--ease);
}
.cx-upload-btn:hover { background: var(--green-dim); border-color: rgba(45,106,79,0.4); }
.cx-filters { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 16px; }
.cx-pill {
  font-family: var(--font-body); font-size: 11.5px; font-weight: 700;
  color: var(--text-3); background: var(--surface);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 4px 12px; cursor: pointer; transition: all 150ms var(--ease);
}
.cx-pill span { font-family: var(--font-mono); font-weight: 600; margin-left: 3px; color: var(--text-3); }
.cx-pill:hover, .cx-pill.active { color: var(--green); background: var(--green-dim); border-color: rgba(45,106,79,0.3); }
/* (the old .cx-list/.cx-row row styles were removed with the paper-card
   swap — .cx-cat/.cx-owner live on, reused by the card meta line) */
.cx-cat {
  font-family: var(--font-body); font-size: 10px; font-weight: 700;
  color: var(--green); background: var(--green-dim);
  border: 1px solid rgba(45,106,79,0.25); border-radius: 999px; padding: 2px 9px;
}
.cx-owner { font-family: var(--font-body); font-size: 10px; font-weight: 600; color: var(--text-2); }
.cx-act {
  font-family: var(--font-body); font-size: 11px; font-weight: 700;
  color: var(--green); background: transparent;
  border: 1px solid rgba(45,106,79,0.25); border-radius: 999px;
  padding: 4px 12px; cursor: pointer; transition: all 150ms var(--ease);
}
.cx-act:hover { background: var(--green-dim); border-color: rgba(45,106,79,0.4); }
.cx-act-danger { color: rgba(180,67,67,0.9); border-color: rgba(180,67,67,0.35); }
.cx-act-danger:hover { background: rgba(180,67,67,0.08); border-color: rgba(180,67,67,0.55); }
.cx-empty { padding: 32px 0; text-align: center; font-size: 13px; color: var(--text-3); }
.cx-form {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid rgba(45,106,79,0.3);
  border-radius: 12px; padding: 12px 14px; margin-bottom: 14px;
}
.cx-form input[type="text"], .cx-form select {
  font-family: var(--font-body); font-size: 12.5px; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 10px; outline: none;
}
.cx-form input[type="text"] { flex: 1; min-width: 180px; }
.cx-form input[type="text"]:focus, .cx-form select:focus { border-color: rgba(45,106,79,0.4); }
.cx-form-file { font-family: var(--font-mono); font-size: 10px; color: var(--text-3); }

/* ── Paper cards (Eli, 2026-08-15): each contract is a stack of sheets
   showing its real first page, title beneath. The stack is two offset
   sheets behind the top one; the hairline sits OVER the artwork as an
   inset shadow (a border beside a rounded image leaves a seam). ── */
.cx-paper-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 28px 24px; margin-top: 6px;
}
.cx-paper-card { min-width: 0; }
.cx-paper {
  position: relative; aspect-ratio: 17 / 22; border-radius: 6px;
  background: var(--surface); overflow: hidden; cursor: pointer;
  box-shadow: inset 0 0 0 1px var(--border), 0 12px 26px -16px rgba(0,0,0,0.4);
  transition: transform 160ms var(--ease), box-shadow 160ms var(--ease);
}
/* the sheets behind — slightly fanned, so it reads as a small stack */
.cx-paper-card { position: relative; }
.cx-paper-card::before, .cx-paper-card::after {
  content: ''; position: absolute; left: 0; right: 0; top: 0;
  aspect-ratio: 17 / 22; border-radius: 6px;
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--border);
}
.cx-paper-card::before { transform: rotate(-2.4deg) translate(-4px, 4px); }
.cx-paper-card::after  { transform: rotate(1.8deg) translate(4px, 3px); }
.cx-paper { z-index: 1; }
.cx-paper-card:hover .cx-paper { transform: translateY(-3px); box-shadow: inset 0 0 0 1px var(--border), 0 16px 32px -16px rgba(0,0,0,0.5); }
.cx-paper-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.cx-paper-glyph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--text-3); }
.cx-paper-glyph svg { width: 34%; height: 34%; }
.cx-paper-acts { position: absolute; top: 8px; left: 8px; right: 8px; display: flex; gap: 6px; opacity: 0; transition: opacity 150ms var(--ease); z-index: 2; }
/* focus-within: keyboard users must SEE the button they're about to press —
   opacity-0 hover-only actions left Delete focusable but invisible (audit) */
.cx-paper-card:hover .cx-paper-acts,
.cx-paper-card:focus-within .cx-paper-acts { opacity: 1; }
.cx-paper-act {
  width: 28px; height: 28px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(255,255,255,0.92); color: var(--green);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 10px rgba(0,0,0,0.18); transition: transform 120ms var(--ease);
}
.cx-paper-act:hover { transform: scale(1.08); }
.cx-paper-act svg { width: 14px; height: 14px; }
.cx-paper-act-danger { color: var(--coral); margin-left: auto; }
.cx-paper-title {
  font-family: var(--font-body); font-size: 13px; font-weight: 700; color: var(--text);
  margin-top: 12px; line-height: 1.35; cursor: pointer;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  transition: color 150ms var(--ease);
}
.cx-paper-title:hover { color: var(--green); }
/* meta = body-font pills (category/version/ownership); sub = mono DATA line */
.cx-paper-meta { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; margin-top: 7px; }
.cx-paper-sub { font-family: var(--font-mono); font-size: 9.5px; color: var(--text-3); margin-top: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* detail panel reused below the grid — neutralize its attach-under-row shape */
.cx-detail-standalone { margin-top: 26px; }
.cx-detail-standalone .cx-detail { border-top: 1px solid rgba(45,106,79,0.4); border-radius: 12px; margin: 0; }
.cx-detail-standalone-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 8px; font-family: var(--font-body); font-size: 13.5px; font-weight: 700; color: var(--text);
}

/* ── Viewer: big page + flip controls ── */
.cx-viewer { position: fixed; inset: 0; z-index: 10002; display: none; }
.cx-viewer.open { display: block; }
.cx-viewer-scrim { position: absolute; inset: 0; background: rgba(0,0,0,0.55); }
.cx-viewer-panel {
  position: absolute; inset: 24px; display: flex; flex-direction: column;
  background: var(--bg); border: 1px solid var(--border-med); border-radius: 14px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.35); overflow: hidden;
}
.cx-viewer-top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 20px; border-bottom: 1px solid var(--border); flex-shrink: 0;
  background: var(--surface);
}
.cx-viewer-title { font-family: var(--font-body); font-size: 14px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cx-viewer-actions { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.cx-viewer-pages { font-family: var(--font-mono); font-size: 11px; color: var(--text-3); }
/* house close circle (same recipe as .overlay-close-x, sized for the bar) */
.cx-viewer-x { width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; border: 1px solid rgba(155,68,68,0.25); border-radius: 50%; background: rgba(155,68,68,0.06); color: var(--coral); cursor: pointer; font-size: 16px; line-height: 1; padding: 0; transition: all 150ms var(--ease); }
.cx-viewer-x:hover { background: rgba(155,68,68,0.12); border-color: rgba(155,68,68,0.45); }
.cx-viewer-stage { flex: 1; display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 0; }
/* the scrollbox owns overflow so zoomed pages pan while the nav stays put */
.cx-viewer-scroll { flex: 1; align-self: stretch; overflow: auto; display: flex; min-width: 0; }
.cx-viewer-sheet { margin: auto; display: flex; align-items: center; justify-content: center; }
.cx-viewer-pagewrap { position: relative; border-radius: 4px; box-shadow: 0 8px 32px rgba(0,0,0,0.25); background: #fff; }
.cx-viewer-pagewrap canvas { display: block; border-radius: 4px; }
.cx-viewer-sheet img { max-width: 100%; max-height: 100%; border-radius: 4px; box-shadow: 0 8px 32px rgba(0,0,0,0.25); background: #fff; }
/* zoom + hint */
.cx-viewer-zoom { display: flex; align-items: center; gap: 6px; }
.cx-viewer-zbtn { width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--border-med); background: var(--surface); color: var(--text-2); font-size: 14px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.cx-viewer-zbtn:hover { color: var(--green); border-color: var(--green); }
.cx-viewer-zpct { font-family: var(--font-mono); font-size: 10px; color: var(--text-3); min-width: 30px; text-align: center; }
.cx-viewer-hint { font-family: var(--font-body); font-size: 11px; color: var(--text-3); }
/* selectable text layer over the canvas — invisible glyphs, visible selection */
.cx-textlayer { position: absolute; inset: 0; overflow: hidden; line-height: 1; opacity: 1; }
.cx-textlayer span { position: absolute; color: transparent; white-space: pre; cursor: text; transform-origin: 0 0; }
/* marker yellow while dragging (Eli, 2026-08-16 — highlighter, not green);
   on mouseup the selection collapses into merged bands below */
.cx-textlayer span::selection { background: var(--highlighter-selection); }
/* highlight bands: one merged rectangle per LINE (per-span backgrounds
   left dark seams over the spaces). multiply keeps the words readable. */
.cx-hl-layer { position: absolute; inset: 0; pointer-events: none; }
/* classic full-strength highlighter yellow (Eli, 2026-08-16 ref) —
   multiply over the page keeps the words crisp black */
.cx-hl-rect { position: absolute; background: var(--highlighter); border-radius: 2px; mix-blend-mode: multiply; pointer-events: auto; cursor: pointer; transition: background 120ms var(--ease); }
.cx-hl-rect:hover { background: var(--highlighter-strong); }
.cx-hl-pending { pointer-events: none; }
/* Word-style margin comments (Eli, 2026-08-16 ref): author + text visible
   in a column beside the page, aligned to their highlights; a green edge
   carries meaning (annotation), per the no-avatar-circles rule */
.cx-viewer-margin { position: relative; width: 190px; flex: 0 0 auto; margin-right: 16px; display: none; }
.cx-viewer-margin.on { display: block; }
.cx-cmt-card {
  position: absolute; left: 0; width: 190px;
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--green); border-radius: 8px;
  padding: 8px 10px; cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,0.10);
  transition: box-shadow 130ms var(--ease), border-color 130ms var(--ease);
}
.cx-cmt-card:hover { box-shadow: 0 6px 18px rgba(0,0,0,0.16); }
.cx-cmt-card-author { display: flex; align-items: baseline; gap: 6px; font-family: var(--font-body); font-size: 10.5px; font-weight: 700; color: var(--text); margin-bottom: 3px; }
.cx-cmt-card-body { font-family: var(--font-body); font-size: 11px; color: var(--text-2); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
/* band ↔ card cross-flash */
.cx-cmt-card.cx-cmt-flash { border-color: var(--green); box-shadow: 0 0 0 3px rgba(45,106,79,0.15); }
.cx-hl-rect.cx-cmt-flash { background: var(--highlighter-strong); }
/* toggled off: the card stays readable but visibly resting; its bands are gone */
.cx-cmt-card.cx-cmt-off { opacity: 0.55; border-left-color: var(--border-med); }
.cx-cmt-card.cx-cmt-off:hover { opacity: 0.85; }
/* threaded replies nest inside the parent card and indent in the panel */
.cx-cmt-replies { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; }
.cx-cmt-reply { font-family: var(--font-body); font-size: 10.5px; color: var(--text-2); line-height: 1.4; }
.cx-cmt-reply-author { font-weight: 700; color: var(--text); }
.cx-cmt-reply-slot { margin-top: 6px; }
.cx-cmt-reply-btn { background: none; border: none; padding: 0; font-family: var(--font-body); font-size: 10px; font-weight: 700; color: var(--green); cursor: pointer; }
.cx-cmt-reply-btn:hover { text-decoration: underline; }
.cx-cmt-reply-input { width: 100%; min-height: 44px; font-family: var(--font-body); font-size: 11px; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 6px; outline: none; resize: vertical; margin-bottom: 6px; }
.cx-cmt-reply-input:focus { border-color: rgba(45,106,79,0.4); }
.cx-comment-reply { margin-left: 22px; }
/* selection/comment popover, positioned inside the page wrap */
.cx-hl-pop { position: absolute; z-index: 5; width: 260px; background: var(--surface); border: 1px solid var(--border-med); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); padding: 10px; }
/* compact state: just the floating pill, no card chrome */
.cx-hl-pop.compact { width: auto; background: transparent; border: none; box-shadow: none; padding: 0; }
/* SOLID green — the ghost pill washed out over the document, and its
   translucent green-dim hover went see-through entirely (Eli, 2026-08-16).
   Hovers stay opaque: color-mix into the fill, never an alpha wash. */
.cx-hl-pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-body); font-size: 12.5px; font-weight: 700;
  color: #fff; background: var(--green);
  border: none; border-radius: 999px;
  padding: 8px 16px; cursor: pointer; white-space: nowrap;
  box-shadow: 0 6px 20px rgba(0,0,0,0.28);
  transition: background 150ms var(--ease), transform 120ms var(--ease);
}
.cx-hl-pill:hover { background: color-mix(in srgb, var(--green) 88%, #000); transform: translateY(-1px); }
.cx-hl-pill svg { width: 13px; height: 13px; }
.cx-hl-pop textarea { width: 100%; min-height: 64px; font-family: var(--font-body); font-size: 12.5px; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 8px; outline: none; resize: vertical; margin: 8px 0; }
.cx-hl-pop textarea:focus { border-color: rgba(45,106,79,0.4); }
.cx-hl-quote { font-family: var(--font-body); font-size: 11px; font-style: italic; color: var(--green); background: var(--green-dim); border-radius: 6px; padding: 5px 8px; }
.cx-hl-pop-row { display: flex; gap: 8px; justify-content: flex-end; }
.cx-hl-when { font-family: var(--font-mono); font-size: 9px; font-weight: 400; color: var(--text-3); margin-left: 6px; }
.cx-viewer-fallback { font-size: 13px; color: var(--text-2); display: flex; align-items: center; gap: 10px; }
.cx-viewer-nav {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border-med); color: var(--text-2);
  font-size: 22px; line-height: 1; display: flex; align-items: center; justify-content: center;
  transition: all 150ms var(--ease);
}
.cx-viewer-nav:hover { color: var(--green); border-color: var(--green); }

/* Managers reach Contracts through the artist folder pill — the sidebar
   link is the artist-account entrance */
html.mgr-folders #sidebarContractsLink,
body.mgr-folders #sidebarContractsLink { display: none; }

/* ── Contract detail: versions + comments (Ollie, 2026-08-04) ── */
.cx-row.cx-openable { cursor: pointer; }
.cx-row.open { border-color: rgba(45,106,79,0.4); border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.cx-detail {
  background: var(--surface); border: 1px solid rgba(45,106,79,0.4); border-top: none;
  border-radius: 0 0 12px 12px; padding: 16px 18px; margin: -8px 0 8px; cursor: default;
}
.cx-detail-label { font-family: var(--font-body); font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); margin-bottom: 8px; }
.cx-versions { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.cx-version-row { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.cx-version-num { font-family: var(--font-mono); font-size: 10px; font-weight: 700; color: var(--green); }
.cx-version-label { font-family: var(--font-body); font-weight: 700; color: var(--text); }
.cx-version-meta { font-family: var(--font-mono); font-size: 10px; color: var(--text-3); flex: 1; }
.cx-version-actions { display: flex; gap: 6px; }
.cx-comments { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.cx-comments-empty { font-size: 12px; color: var(--text-3); }
.cx-comment { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.cx-comment-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.cx-comment-author { font-family: var(--font-body); font-size: 11.5px; font-weight: 700; color: var(--text); }
.cx-comment-when { font-family: var(--font-mono); font-size: 9px; color: var(--text-3); flex: 1; }
.cx-comment-del { background: none; border: none; color: rgba(180,67,67,0.7); cursor: pointer; font-size: 14px; padding: 0 2px; }
.cx-comment-del:hover { color: rgba(180,67,67,1); }
.cx-comment-anchor-view { font-family: var(--font-body); font-size: 11.5px; font-style: italic; color: var(--green); background: var(--green-dim); border-radius: 6px; padding: 4px 8px; margin-bottom: 5px; }
.cx-comment-body { font-family: var(--font-body); font-size: 12.5px; color: var(--text-2); line-height: 1.5; white-space: pre-wrap; }
.cx-comment-form { display: flex; flex-direction: column; gap: 8px; }
.cx-comment-anchor { display: flex; gap: 8px; }
.cx-comment-anchor input[type="number"] { width: 110px; }
.cx-comment-anchor input, .cx-comment-form textarea {
  font-family: var(--font-body); font-size: 12px; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 10px; outline: none;
}
.cx-comment-anchor input:focus, .cx-comment-form textarea:focus { border-color: rgba(45,106,79,0.4); }
.cx-comment-form textarea { min-height: 52px; resize: vertical; }
.cx-comment-form .cx-act { align-self: flex-start; }
