/* ============================================================
   SEIRC Entries: copy.css (admin Copy editor: canvas + side panel, publish dialog, compare, review)
   Layout is fixed-height so nothing below the bar moves: the canvas and the panel each scroll inside themselves.
   ============================================================ */
.cp-key { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; overflow-wrap: anywhere; }
.cp-acts { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); margin-top: var(--s3); }
.cp-acts input { flex: 1 1 200px; width: auto; min-height: var(--tap); }

/* ---------- editor shell ---------- */
.cpe-wrap .admin-bar { margin-bottom: var(--s2); }
.cpe { --cpe-h: calc(100dvh - var(--cpe-top, 200px) - var(--s3)); display: flex; flex-direction: column; height: var(--cpe-h); min-height: 520px; }
.cpe-bar { display: flex; align-items: center; gap: var(--s2) var(--s3); flex-wrap: nowrap; min-height: 56px; padding-bottom: var(--s2); }
.cpe-pick { position: relative; flex: none; }
.cpe-cur { display: inline-flex; align-items: center; gap: var(--s2); min-height: 48px; padding: 0 var(--s3) 0 var(--s2); border: 1px solid var(--line); border-radius: var(--r-ctl); background: #fff; color: var(--ink); cursor: pointer; font: inherit; text-align: left; transition: border-color 150ms ease, box-shadow 150ms ease; }
.cpe-cur:hover { border-color: var(--light); }
.cpe-cur[aria-expanded="true"] { border-color: var(--blue); box-shadow: 0 0 0 3px var(--pale); }
.cpe-cur > .ic:first-child { color: var(--blue); }
.cpe-cur span { display: grid; line-height: 1.2; min-width: 0; }
.cpe-cur small { font-size: var(--fs-xs); color: var(--muted); font-weight: 600; }
.cpe-cur b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.cpe-cur > .ic:last-child { color: var(--muted); transition: transform 200ms ease; }
.cpe-cur[aria-expanded="true"] > .ic:last-child { transform: rotate(180deg); }
.cpe-scrim { position: fixed; inset: 0; z-index: 40; }
.cpe-menu { position: absolute; z-index: 41; top: calc(100% + 6px); left: 0; display: grid; grid-template-columns: minmax(150px, 1fr) minmax(230px, 1.5fr) minmax(170px, 1fr) minmax(150px, 1fr); gap: var(--s3); width: min(940px, calc(100vw - 2 * var(--gutter)));
  max-height: min(70dvh, 560px); overflow: auto; padding: var(--s3); background: #fff; border-radius: var(--r-card); box-shadow: 0 18px 48px -12px rgba(27,36,64,.35), 0 0 0 1px var(--line);
  transform-origin: 0 0; animation: cpe-pop 180ms var(--e-settle, ease-out); }
@keyframes cpe-pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.cpe-mgroup h3 { margin: 0 0 var(--s1); padding: 0 var(--s2); font-size: var(--fs-xs); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.cpe-mgroup button { display: flex; align-items: center; gap: var(--s2); width: 100%; min-height: 40px; padding: 0 var(--s2); border: 0; border-radius: var(--r-ctl); background: none; color: var(--ink); font: 500 var(--fs-sm) Inter, sans-serif; text-align: left; cursor: pointer; }
.cpe-mgroup button .ic { color: var(--muted); font-size: 20px; flex: none; }
.cpe-mgroup button span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cpe-mgroup button:hover { background: color-mix(in srgb, var(--pale) 60%, #fff); }
.cpe-mgroup button.on { background: var(--pale); color: var(--blue); font-weight: 700; }
.cpe-mgroup button.on .ic { color: var(--blue); }
.cpe-dot { font-style: normal; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--warn-bg); color: var(--warn); font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; }
.cpe-variant select { min-height: 44px; width: auto; max-width: 240px; padding-block: 0; }
.cpe-tools { display: flex; gap: var(--s2); align-items: center; }
.cpe-seg button { min-height: 36px; display: inline-flex; align-items: center; }
.cpe-seg .ic { font-size: 20px; }
.cpe-go { margin-left: auto; display: flex; align-items: center; gap: var(--s3); flex: none; }
.cpe-review { font-size: var(--fs-sm); white-space: nowrap; }
.cpe-primary { min-height: 44px; white-space: nowrap; }
.cpe-primary:disabled { background: #E6E9F0; color: var(--muted); cursor: default; }

.cpe-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: var(--s3); }

/* ---------- canvas ---------- */
.cpe-canvas { position: relative; min-height: 0; border-radius: var(--r-card); background: #E9EDF5; box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.cpe-stage { position: absolute; inset: 0; overflow-x: auto; overflow-y: hidden; }
.cpe-stage.off { visibility: hidden; }
.cpf-size { height: 1px; }
.cpe-stage iframe.cpf { position: absolute; top: 0; border: 0; background: #fff; transform-origin: 0 0; transition: opacity 260ms ease; box-shadow: 0 0 0 1px var(--line); }
.cpe-stage iframe.cpf.next { opacity: 0; pointer-events: none; }
.cpe-stage iframe.cpf.out { opacity: 0; pointer-events: none; }
.cpe-stage::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; opacity: 0; pointer-events: none; transition: opacity 200ms ease;
  background: linear-gradient(90deg, transparent, var(--blue), transparent); background-size: 50% 100%; background-repeat: no-repeat; animation: cpe-run 1.1s linear infinite; }
.cpe-stage.loading::after { opacity: 1; }
@keyframes cpe-run { from { background-position: -100% 0; } to { background-position: 200% 0; } }
/* Navigate mode: a note when a click on the canvas goes nowhere. */
.cpe-toast { position: absolute; z-index: 3; left: 50%; bottom: var(--s4); max-width: calc(100% - 2 * var(--s4)); padding: var(--s2) var(--s4); border-radius: 999px; background: var(--ink); color: #fff;
  font-size: var(--fs-sm); font-weight: 600; box-shadow: 0 8px 24px -8px rgba(27,36,64,.5); pointer-events: none; opacity: 0; transform: translate(-50%, 8px); transition: opacity 200ms ease, transform 200ms ease; }
.cpe-toast.on { opacity: 1; transform: translate(-50%, 0); }
.cpe-mode .ic { margin-right: 4px; }
.cpe-doc { position: absolute; inset: 0; overflow: auto; scrollbar-gutter: stable; padding: var(--s4); }
.cpe-ics { margin: 0 auto; max-width: 820px; background: #fff; padding: var(--s4); border-radius: var(--r-ctl); white-space: pre-wrap; overflow-wrap: anywhere; font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; }
.cpe-doc .es { margin: var(--s7) auto; max-width: 420px; }

/* PDF canvas (CopyPdfLive): pages stacked, each text a button over it. */
.cpc-pdf { width: var(--pdf-w); max-width: 900px; margin: 0 auto; display: grid; gap: var(--s4); }
.cpc-pdf:not([style*="100%"]) { max-width: none; }
.cpc-page { position: relative; background: #fff; box-shadow: 0 1px 3px rgba(27,36,64,.12), 0 8px 24px -12px rgba(27,36,64,.25); overflow: hidden; }
.cpc-page img { display: block; width: 100%; height: auto; user-select: none; }
.cpc-page::after { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 200ms ease;
  background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.65) 50%, transparent 70%); background-size: 250% 100%; animation: cpe-shimmer 1.2s linear infinite; }
.cpc-pdf.busy .cpc-page::after, .cpc-ghost::after { opacity: 1; }
@keyframes cpe-shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }
.cpc-spot { position: absolute; padding: 0; border: 0; border-radius: 2px; background: transparent; cursor: pointer; transition: background-color 120ms ease, box-shadow 120ms ease; }
.cpc-spot:hover, .cpc-spot:focus-visible { box-shadow: 0 0 0 2px var(--blue); background: rgba(18,71,188,.06); outline: none; z-index: 2; }
.cpc-spot.first:hover::before, .cpc-spot.first:focus-visible::before, .cpc-spot.first.on::before { content: attr(data-name); position: absolute; left: -2px; bottom: calc(100% + 2px); padding: 0 6px; border-radius: 4px 4px 0 0;
  background: var(--blue); color: #fff; font: 600 12px/1.5 Inter, sans-serif; white-space: nowrap; pointer-events: none; }
.cpc-spot.on { background: rgba(255,214,0,.3); box-shadow: 0 0 0 2px #E8AA00; z-index: 1; }
.cpc-spot.on::before { background: #E8AA00; color: var(--ink); }

/* ---------- side panel: list ⇄ editor, sliding ---------- */
.cpe-panel { position: relative; min-height: 0; overflow: hidden; background: #fff; border-radius: var(--r-card); box-shadow: var(--shadow); }
.cpe-view { position: absolute; inset: 0; display: flex; flex-direction: column; transition: transform 260ms cubic-bezier(.2,0,0,1), opacity 260ms ease; will-change: transform; }
.cpe-edit { transform: translateX(100%); opacity: 0; }
.cpe-panel.detail .cpe-list { transform: translateX(-28%); opacity: 0; }
.cpe-panel.detail .cpe-edit { transform: none; opacity: 1; }
.cpe-scroll { flex: 1; min-height: 0; overflow-y: auto; scrollbar-gutter: stable; padding: 0 var(--s3) var(--s4); overscroll-behavior: contain; }
.cpe-search { display: flex; align-items: center; gap: var(--s2); margin: var(--s3); padding: 0 var(--s3); border-radius: var(--r-pill); background: var(--bg); }
.cpe-search .ic { color: var(--muted); }
.cpe-search input { border: 0; background: none; min-height: 44px; padding: 0; box-shadow: none; }
.cpe-search input:focus { outline: none; }
.cpe-search:focus-within { box-shadow: 0 0 0 2px var(--blue); }
.cpe-gh { position: sticky; top: 0; z-index: 1; margin: 0; padding: var(--s2) var(--s2) var(--s1); background: #fff; font-size: var(--fs-xs); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.cpe-items { list-style: none; margin: 0 0 var(--s2); padding: 0; }
.cpe-item { display: flex; align-items: center; gap: var(--s2); width: 100%; min-height: 56px; padding: var(--s2); border: 0; border-radius: var(--r-ctl); background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; transition: background-color 120ms ease; }
.cpe-item:hover { background: color-mix(in srgb, var(--pale) 55%, #fff); }
.cpe-item.on { background: var(--pale); }
.cpe-item.off .cpe-it b { color: var(--muted); }
.cpe-item > .ic { color: var(--muted); flex: none; font-size: 20px; }
.cpe-it { flex: 1; min-width: 0; display: grid; gap: 2px; }
.cpe-it b { font-size: var(--fs-sm); font-weight: 700; }
.cpe-it small { font-size: var(--fs-sm); color: var(--muted); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.cpe-it small.cpe-where { display: flex; align-items: center; gap: 4px; font-size: var(--fs-xs); font-weight: 600; }
.cpe-where .ic { font-size: 14px; }
.cpe-item .pill { font-size: 11px; padding: 2px 8px; flex: none; }
.cpe-none { color: var(--muted); padding: var(--s4) var(--s2); margin: 0; }

.cpe-ehead { display: flex; align-items: center; gap: var(--s2); padding: var(--s3); border-bottom: 1px solid var(--line); }
.cpe-ehead > div { flex: 1; min-width: 0; display: grid; line-height: 1.25; }
.cpe-ehead small { font-size: var(--fs-xs); color: var(--muted); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cpe-ehead b { font-size: var(--fs-md, 17px); }
.cpe-ehead .pill { font-size: 11px; padding: 2px 8px; flex: none; }
.cpe-back { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 50%; background: none; color: var(--ink); cursor: pointer; }
.cpe-back:hover { background: var(--bg); }
.cpe-edit .cpe-scroll { padding-top: var(--s3); }
.cpe-hint { font-size: var(--fs-sm); color: var(--muted); margin: 0 0 var(--s3); }
.cpe-ta { width: 100%; resize: vertical; line-height: 1.5; min-height: 88px; }
.cpe-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--s2); }
.cpe-chip { min-height: 30px; padding: 0 10px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--blue); font: 600 12px ui-monospace, SFMono-Regular, Menlo, monospace; cursor: pointer; }
.cpe-chip:hover { background: var(--pale); border-color: transparent; }
.cpe-problem { display: flex; align-items: center; gap: 6px; min-height: 22px; margin: var(--s2) 0 0; color: var(--err); font-size: var(--fs-sm); font-weight: 600; }
.cpe-problem .ic { font-size: 18px; }
.cpe-state { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); min-height: 32px; }
.cpe-saved { font-size: var(--fs-sm); color: var(--muted); }
.cpe-acts { display: flex; gap: var(--s3); }
.cpe-acts .linkbtn { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-sm); }
.cpe-acts .linkbtn .ic { font-size: 18px; }
.cpe-acts .linkbtn:disabled { opacity: .45; cursor: default; }
.cpe-rule { font-size: var(--fs-xs); color: var(--muted); margin: var(--s1) 0 var(--s3); }
.cpe-more { border-top: 1px solid var(--line); padding-top: var(--s2); }
.cpe-more > summary { list-style: none; display: flex; align-items: center; gap: var(--s2); min-height: 40px; cursor: pointer; font-weight: 700; font-size: var(--fs-sm); color: var(--blue); }
.cpe-more > summary::-webkit-details-marker { display: none; }
.cpe-more > summary .ic { transition: transform 200ms ease; }
.cpe-more[open] > summary .ic { transform: rotate(180deg); }
.cpe-more[open] > :not(summary) { animation: m-fade 200ms ease; }
.cpe-more h4 { margin: var(--s3) 0 var(--s2); font-size: var(--fs-xs); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.cpe-hist { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s1); }
.cpe-hist li { display: flex; align-items: center; gap: var(--s2); padding: var(--s2); border-radius: var(--r-ctl); background: var(--bg); }
.cpe-hist li > span { flex: 1; min-width: 0; display: grid; font-size: var(--fs-sm); }
.cpe-hist b { font-weight: 600; overflow-wrap: anywhere; }
.cpe-hist small { color: var(--muted); font-size: var(--fs-xs); }
.cpe-key { font-size: var(--fs-xs); color: var(--muted); overflow-wrap: anywhere; }
.cpe-reject { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s3); }
.cpe-reject input { flex: 1 1 180px; width: auto; min-height: var(--tap); }

/* ---------- publish dialog ---------- */
.cpe-modal-scrim { position: fixed; inset: 0; z-index: 60; background: rgba(27,36,64,.38); }
.cpe-modal { position: fixed; z-index: 61; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(680px, calc(100vw - 2 * var(--gutter))); max-height: min(80dvh, 720px);
  display: flex; flex-direction: column; gap: var(--s3); padding: var(--s5); background: #fff; border-radius: var(--r-sheet); box-shadow: 0 30px 80px -20px rgba(27,36,64,.5); animation: cpe-in 240ms var(--e-settle, ease-out); }
@keyframes cpe-in { from { opacity: 0; transform: translate(-50%, calc(-50% + 12px)) scale(.98); } }
.cpe-modal h2 { margin: 0; font-size: var(--fs-h2); }
.cpe-plist { list-style: none; margin: 0; padding: 0; overflow-y: auto; display: grid; gap: var(--s3); min-height: 0; flex: 1; }
.cpe-plist > li { border: 1px solid var(--line); border-radius: var(--r-ctl); padding: var(--s3); }
.cpe-pi { display: flex; gap: var(--s3); align-items: flex-start; margin-bottom: var(--s2); cursor: pointer; }
.cpe-pi input { width: 20px; height: 20px; min-height: 0; margin-top: 2px; flex: none; accent-color: var(--blue); }
.cpe-pi span { display: grid; font-size: var(--fs-sm); }
.cpe-pi small { color: var(--muted); }
.cpe-mact { display: flex; justify-content: flex-end; align-items: center; gap: var(--s4); }
.cpe-progress { display: grid; justify-items: center; text-align: center; gap: var(--s3); padding: var(--s4) 0 var(--s2); }
.cpe-orb { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--pale); color: var(--blue); }
.cpe-spin { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--light); border-top-color: var(--blue); animation: cpe-rot 800ms linear infinite; }
@keyframes cpe-rot { to { transform: rotate(360deg); } }
.cpe-progress.done .cpe-orb { background: var(--ok-bg); color: var(--ok); animation: m-pop 320ms var(--e-float, ease-out); }
.cpe-progress.done .cpe-orb .ic { font-size: 34px; }
.cpe-bar-track { width: min(360px, 100%); height: 6px; border-radius: 999px; background: var(--bg); overflow: hidden; }
.cpe-bar-fill { height: 100%; background: var(--blue); transform-origin: 0 50%; transition: transform 300ms cubic-bezier(.2,0,0,1); }
.cpe-progress.done .cpe-bar-fill { background: var(--ok); }
.cpe-progress .cpe-hint { margin: 0; }

/* ---------- tablet / phone: canvas on top, the panel as a bottom sheet ---------- */
@media (max-width: 1099px) {
  .cpe-body { grid-template-columns: minmax(0, 1fr) 340px; }
  .cpe-cur b { max-width: 160px; }
}
@media (max-width: 899px) {
  .cpe-bar { flex-wrap: wrap; }
  .cpe-go { margin-left: 0; width: 100%; }
  .cpe-primary { flex: 1; }
  .cpe-menu { grid-template-columns: 1fr 1fr; position: fixed; left: var(--gutter); right: var(--gutter); top: calc(var(--topbar) + 120px); width: auto; }
  .cpe-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 42fr) minmax(0, 58fr); gap: 0; }
  .cpe-canvas { border-radius: var(--r-card) var(--r-card) 0 0; }
  .cpe-panel { border-radius: var(--r-sheet) var(--r-sheet) 0 0; margin-top: -14px; box-shadow: 0 -8px 24px -12px rgba(27,36,64,.35); }
  .cpe-panel::before { content: ""; position: absolute; z-index: 2; top: 6px; left: 50%; width: 36px; height: 4px; margin-left: -18px; border-radius: 4px; background: var(--line); }
  .cpe-search { margin-top: var(--s4); }
  .cpe-ehead { padding-top: var(--s4); }
  .cpe-modal { padding: var(--s4); }
}
@media (max-width: 599px) {
  .cpe-tools { order: 3; }
  .cpe-pick { min-width: 0; flex: 0 1 auto; } .cpe-cur { max-width: 100%; }
  .cpe-variant { order: 1; flex: 1 1 0; min-width: 120px; } .cpe-variant select { max-width: none; width: 100%; }
  .cpe-go { order: 2; }
  .cpe-menu { grid-template-columns: 1fr; }
  .cpe-review { display: none; }
  .cpe-mode span { display: none; }
  .cpe-mode .ic { margin-right: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .cpe-view, .cpe-stage iframe.cpf, .cpe-cur > .ic:last-child, .cpe-more > summary .ic, .cpc-spot, .cpe-bar-fill { transition: none; }
  .cpe-menu, .cpe-modal, .cpe-progress.done .cpe-orb, .cpe-more[open] > :not(summary) { animation: none; }
  .cpe-stage::after, .cpc-page::after { animation: none; }
  .cpe-toast { transition: none; }
}

/* ---------- side-by-side diff ---------- */
.cp-diff { display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); font-size: var(--fs-sm); line-height: 1.5; }
.cp-diff > div { background: var(--bg); border-radius: var(--r-ctl); padding: var(--s3); }
.cp-diff small { font-size: var(--fs-xs); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.cp-diff del { background: var(--err-bg); color: var(--err); text-decoration-thickness: 1px; border-radius: 3px; }
.cp-diff ins { background: var(--ok-bg); color: var(--ok); text-decoration: none; border-radius: 3px; font-weight: 600; }


/* ---------- review queue (/admin/copy/review) ---------- */
.cp-review { margin-top: var(--s3); }
.cp-review + .cp-review { margin-top: var(--s3); }
.cp-rhead { display: flex; margin-bottom: var(--s3); }
.cp-rhead a { color: inherit; }
.cp-diff p { white-space: pre-wrap; overflow-wrap: anywhere; margin: var(--s1) 0 0; }
.cpe-plist .cp-diff p { max-height: 9.5em; overflow-y: auto; }

/* A venue fact (address, centre name): read-only here, edited in the venue details. */
.cpe-venue { display: grid; gap: var(--s2); justify-items: start; }
.cpe-venue-val { margin: 0; padding: var(--s3); border-radius: 12px; background: var(--bg); border: 1px solid var(--line); font-weight: 600; justify-self: stretch; }
.cpe-venue .cpe-hint { margin: 0; }
