/* ══════════════════════════════════
   EDITOR VIEW — text/card modes, split panel, comparison drawer, sparkline
══════════════════════════════════ */

/* ── Editor bar buttons ── */
.bar-spacer { flex: 1; }
.eh-del { padding: 4px 9px; border-radius: 7px; font-size: 12px; color: var(--bad);
  border: 1px solid rgba(248,113,113,.25); transition: all .12s; }
.eh-del:hover { background: rgba(248,113,113,.12); }
.eh-tog { padding: 6px 10px; border-radius: 7px; font-size: 12px; color: var(--dim);
  border: 1px solid var(--b2);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease); }
.eh-tog:hover { background: var(--s2); color: var(--text); }
.eh-tog.on { background: var(--accd); border-color: var(--acc); color: #fff; }
/* Back is navigation, not a toggle — drop the border so it doesn't read as one
   of the stateful Peek/Cards buttons sitting beside it */
.eh-back { border-color: transparent; padding-left: 4px; color: var(--dim); }
.eh-back:hover { background: var(--s2); border-color: transparent; }

/* ── Editor layout ── */
.editor-wrap { flex: 1; display: flex; overflow: hidden; position: relative; }
.editor-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; position: relative; }
.editor-scroll { flex: 1; overflow-y: auto; display: flex; flex-direction: column;
  -webkit-overflow-scrolling: touch; overscroll-behavior-y: contain;
  /* keeps pace with the drawer growing/shrinking beneath it */
  transition: padding-bottom var(--dur-slow) var(--ease); }
.editor-scroll::-webkit-scrollbar { width: 3px; }
.editor-scroll::-webkit-scrollbar-thumb { background: var(--s3); border-radius: 2px; }

.session-name-inp { font-size: 24px; font-weight: 800; color: var(--text);
  letter-spacing: -.03em; padding: 16px 18px 4px; width: 100%; }
.session-name-inp::placeholder { color: var(--muted); }
.session-meta-line { padding: 0 18px 10px; font-size: 11px; color: var(--muted); }

/* ── Text mode ── */
#textMode { display: flex; flex-direction: column; flex: 1; }
#sessionBody { flex: 1; padding: 4px 18px 140px; font-size: 15px; color: var(--text);
  line-height: 1.9; min-height: 240px; }
#sessionBody::placeholder { color: var(--muted); }

.ghost-line { padding: 0 18px 8px; display: none; align-items: center; gap: 8px;
  cursor: pointer; -webkit-user-select: none; user-select: none; }
.ghost-line.vis { display: flex; }
.ghost-name { font-size: 14px; color: var(--muted); font-style: italic; }
.ghost-key { font-size: 10px; background: var(--s3); border: 1px solid var(--b2);
  color: var(--muted); padding: 1px 6px; border-radius: 4px; }

/* ── Lint — unreadable set data warnings ── */
.lint-bar { padding: 0 18px 8px; display: none; font-size: 11px; color: var(--bad); line-height: 1.5; }
.lint-bar.vis { display: block; }
.ec-lint { font-size: 11px; color: var(--bad); margin-top: 4px; padding-left: 14px; }

/* ── Card mode ── */
#cardMode { display: none; flex-direction: column; padding: 8px 12px 140px; gap: 7px; }
#cardMode.vis { display: flex; }
.ex-card { background: var(--s1); border: 1px solid var(--b); border-radius: 11px;
  padding: 10px 13px; cursor: pointer;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease); }
.ex-card:hover { background: var(--s2); border-color: var(--b2); }
.ex-card:active { transform: scale(.985); }
.ex-card.sel { border-color: var(--acc); box-shadow: 0 0 0 2px color-mix(in srgb, var(--acc) 20%, transparent); }
.ec-top { display: flex; align-items: center; gap: 7px; margin-bottom: 5px; }
.ec-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.ec-dot.ok   { background: var(--ok); }
.ec-dot.note { background: var(--muted); }
.ec-name { font-size: 14px; font-weight: 600; color: var(--text); }
.ec-sets { display: flex; flex-wrap: wrap; gap: 5px; padding-left: 14px; }
.set-chip { display: inline-flex; align-items: center; gap: 2px; padding: 2px 8px;
  border-radius: 5px; background: var(--s3); font-size: 12px; font-variant-numeric: tabular-nums; }
.sc-l { color: var(--acc); font-weight: 600; }
.sc-u { color: var(--muted); font-size: 10px; }
.sc-x { color: var(--muted); margin: 0 1px; }
.sc-r { color: var(--dim); }
.ec-comment { font-size: 11px; color: var(--warn); font-style: italic; margin-top: 4px; padding-left: 14px; }
.ec-note-line { padding: 8px 13px; background: var(--s2); border: 1px solid var(--b);
  border-radius: 9px; font-size: 13px; color: var(--dim); font-style: italic; }
.ec-perm-note { padding: 8px 13px; background: color-mix(in srgb, var(--acc) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--acc) 22%, transparent);
  border-radius: 9px; font-size: 13px; color: var(--acc-lt); }

/* ── Split panel (peek) ── */
.split-panel { width: 0; min-width: 0; overflow: hidden; display: flex; flex-direction: column;
  background: var(--s2); border-left: 1px solid var(--b);
  transition: width .3s cubic-bezier(.4,0,.2,1); flex-shrink: 0; }
.split-panel.open { width: 42%; min-width: 220px; }
.split-hdr { display: flex; align-items: flex-start; justify-content: space-between;
  padding: 14px 14px 8px; border-bottom: 1px solid var(--b); flex-shrink: 0; }
.split-sess-name { font-size: 16px; font-weight: 800; color: var(--acc); letter-spacing: -.02em; }
.split-badge { font-size: 10px; color: var(--muted); margin-top: 2px; }
.split-close { width: 26px; height: 26px; border-radius: 50%; background: var(--s3);
  color: var(--dim); font-size: 13px; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease); }
.split-close:hover { background: var(--s4); color: var(--text); }
.split-body { flex: 1; overflow-y: auto; padding: 12px 14px; }
.split-body::-webkit-scrollbar { width: 3px; }
.split-body::-webkit-scrollbar-thumb { background: var(--s3); border-radius: 2px; }
.split-text { font-size: 13px; color: var(--dim); line-height: 1.9; white-space: pre-wrap;
  word-break: break-word; }
.split-empty { font-size: 12px; color: var(--muted); font-style: italic; padding: 8px 0; }

/* Mobile: split panel as full overlay */
@media (max-width: 640px) {
  .split-panel { position: absolute; inset: 0; width: 100% !important; min-width: unset;
    border-left: none; z-index: 40; transform: translateX(100%); transition: transform .3s cubic-bezier(.4,0,.2,1);
    will-change: transform; }
  .split-panel.open { transform: translateX(0); width: 100% !important; }
}

/* ── Comparison drawer — composited transform slide ── */
.cmp-drawer { position: absolute; bottom: 0; left: 0; right: 0; z-index: 20;
  background: var(--s1); border-radius: 16px 16px 0 0; border-top: 1px solid var(--b2);
  box-shadow: 0 -6px 30px rgba(0,0,0,.35);
  max-height: 65vh; max-height: 65dvh;
  transform: translateY(101%);
  /* height is animated too: the drawer is content-sized, so switching exercises
     or logging a set changes it — JS sets explicit from/to values around the swap */
  transition: transform var(--dur-slow) var(--ease), height var(--dur-slow) var(--ease);
  will-change: transform;
  display: flex; flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom); }
.cmp-drawer.open { transform: translateY(0); }
.drw-handle { width: 34px; height: 4px; border-radius: 2px; background: var(--s3);
  margin: 9px auto 0; flex-shrink: 0; }
.drw-hdr { display: flex; align-items: flex-start; justify-content: space-between;
  padding: 10px 16px 8px; flex-shrink: 0; }
.drw-hdr > div:first-child { min-width: 0; }
.drw-title { font-size: 15px; font-weight: 700; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drw-sub   { font-size: 11px; color: var(--muted); margin-top: 1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drw-close { width: 26px; height: 26px; border-radius: 50%; background: var(--s2);
  color: var(--dim); font-size: 14px; display: flex; align-items: center; justify-content: center; }
.drw-close:hover { background: var(--s3); }
.drw-body { flex: 1; min-height: 0; overflow-y: auto; padding: 0 14px 16px;
  overscroll-behavior-y: contain; }
.drw-body::-webkit-scrollbar { width: 3px; }
.drw-body::-webkit-scrollbar-thumb { background: var(--s3); border-radius: 2px; }

/* Drawer stats */
.stat-row { display: grid; grid-template-columns: repeat(3,1fr); gap: 6px; margin-bottom: 12px; }
.stat-row.s4 { grid-template-columns: repeat(4,1fr); }
.drw-range-hint { display: flex; gap: 5px; flex-wrap: wrap; padding: 4px 0 8px; }
.drw-range-pill { background: var(--s2); border: 1px solid var(--b); border-radius: 5px;
  padding: 2px 7px; font-size: 10px; color: var(--dim); white-space: nowrap; }
.stat-card { background: var(--s2); border: 1px solid var(--b); border-radius: 9px; padding: 9px 10px; }
.stat-lbl { font-size: 9px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: 2px; }
.stat-val { font-size: 17px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.stat-val small { font-size: 10px; color: var(--muted); font-weight: 400; }
.stat-d { font-size: 10px; margin-top: 1px; }
.d-up  { color: var(--ok); }
.d-dn  { color: var(--bad); }
.d-eq  { color: var(--muted); }

/* Set breakdown */
.sets-lbl { font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: 6px; }
.sets-lbl-hint { text-transform: none; letter-spacing: 0; color: var(--muted); opacity: .8; }

/* Horizontally scrolling history — one column per session, today pinned left.
   Rows (not columns) are the flex containers so set N always lines up across
   sessions even when metric lines make rows different heights. */
.hist-scroll { overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain; padding-bottom: 5px; }
.hist-scroll::-webkit-scrollbar { height: 3px; }
.hist-scroll::-webkit-scrollbar-thumb { background: var(--s3); border-radius: 2px; }
.hist-row { display: flex; gap: 5px; width: max-content; min-width: 100%; }
.hist-cell { flex: 0 0 112px; width: 112px; }
/* First shadow paints an opaque strip over the 5px flex gap so scrolled columns
   can't peek through beside the pinned column; second is the depth cue. */
.hist-cell.pin { position: sticky; left: 0; z-index: 2; background: var(--s1);
  box-shadow: 5px 0 0 0 var(--s1), 9px 0 7px -4px rgba(0,0,0,.35); }
.hist-hdr-cell { font-size: 10px; color: var(--muted); margin-bottom: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist-cell .set-row { margin-bottom: 3px; }
.set-row { background: var(--s2); border: 1px solid var(--b); border-radius: 7px;
  padding: 4px 8px; font-size: 11px; color: var(--dim); margin-bottom: 3px;
  font-variant-numeric: tabular-nums; }
.set-row .ld { color: var(--acc); font-weight: 600; }
.set-row.better     { background: rgba(52,211,153,.1);  border-color: rgba(52,211,153,.3); }
.set-row.worse      { background: rgba(248,113,113,.08); border-color: rgba(248,113,113,.25); }
.set-row.dim-better { background: rgba(52,211,153,.03); border-color: rgba(52,211,153,.10); opacity: .75; }
.set-row.dim-worse  { background: rgba(248,113,113,.03); border-color: rgba(248,113,113,.10); opacity: .75; }
.set-row.dim2       { opacity: .45; }
.sr-arrow { font-size: 10px; font-weight: 700; margin-left: 3px; }
.sr-arrow.up   { color: var(--ok); }
.sr-arrow.down { color: var(--bad); }
.sr-rm   { display: block; font-size: 9px; color: var(--muted); line-height: 1.4; margin-top: 1px; }
.sr-prog { display: block; font-size: 9px; color: var(--warn); font-weight: 600; line-height: 1.4; margin-top: 1px; }
.sr-perf { display: block; font-size: 9px; color: var(--ok); font-weight: 600; line-height: 1.4; }
.sr-pr   { font-size: 9px; font-weight: 700; color: var(--pr); margin-right: 3px; }
.sc-pr { font-size: 9px; color: var(--pr); margin-right: 1px; }
.first-time { text-align: center; padding: 14px; font-size: 12px; color: var(--muted);
  background: var(--s2); border-radius: 9px; }

/* ── Previous session comment ── */
.drw-comment-block { margin-top: 12px; }
.drw-comment-text { font-size: 12px; color: var(--warn); font-style: italic;
  background: rgba(251,191,36,.07); border: 1px solid rgba(251,191,36,.18);
  border-radius: 8px; padding: 8px 11px; line-height: 1.55; }

/* ── Performance display (card view only) ── */
.ec-1rm { font-size: 10px; padding-left: 14px; margin-top: 3px;
  display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.ec-erm-val    { color: var(--muted); font-style: italic; }
.ec-prog-val   { color: var(--warn); font-weight: 600; }
.ec-perf-val   { color: var(--ok); font-weight: 600; }
.ec-actual-val { color: var(--accd); font-size: 9px; }

/* ── History sparkline ── */
.spark-wrap { margin-bottom: 12px; }
.spark-container { position: relative; height: 44px; overflow: visible; }
.spark-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
/* Dots rendered as HTML divs so they stay perfectly round despite SVG x/y stretch */
.spark-dot { position: absolute; width: 6px; height: 6px; border-radius: 50%;
  background: var(--acc); transform: translate(-50%, -50%); cursor: pointer; }
/* A 6px dot is far too small to hit with a thumb — this gives it a 28px target
   without changing how it looks. The label sets pointer-events:none already. */
.spark-dot::after { content: ''; position: absolute; inset: -11px; border-radius: 50%; }
.spark-dot-cur { width: 6px; height: 6px; background: var(--acc-lt); }
.spark-dot-lbl { position: absolute; top: 100%; margin-top: 3px; left: 50%;
  transform: translateX(-50%); font-size: 8px; color: var(--muted);
  white-space: nowrap; line-height: 1; pointer-events: none; }
.spark-dot-cur .spark-dot-lbl { color: var(--acc-lt); font-weight: 600; }

/* ── Sparkline tooltip ── */
.spark-tip { position: fixed; background: var(--s3); border: 1px solid var(--b2);
  border-radius: 8px; padding: 6px 9px; font-size: 11px; color: var(--text);
  z-index: 9000; white-space: nowrap; pointer-events: none;
  box-shadow: 0 2px 12px rgba(0,0,0,.4);
  opacity: 0; visibility: hidden; transform: translateY(3px);
  transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease),
              visibility 0s linear var(--dur-fast); }
.spark-tip.vis { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.spark-tip-lbl  { font-size: 9px; color: var(--muted); margin-bottom: 2px; }
.spark-tip-erm  { color: var(--acc); font-weight: 600; margin-bottom: 1px; }
.spark-tip-prog { color: var(--warn); font-weight: 600; margin-bottom: 1px; }
.spark-tip-perf { color: var(--ok); font-weight: 600; margin-bottom: 2px; }
.spark-tip-set  { color: var(--dim); font-size: 10px; line-height: 1.6; }

/* ── RPE badge ── */
.sc-rpe { font-size: 9px; color: var(--muted); margin-left: 2px; opacity: .8; }
.sc-q   { font-size: 9px; color: var(--warn); margin-left: 1px; font-weight: 700; opacity: .85; }
.sr-q   { color: var(--warn); font-size: 9px; font-weight: 700; margin-left: 2px; }
.sr-rpe { font-size: 9px; color: var(--muted); margin-left: 3px; }

/* ── Quick copy bar ── */
.qc-bar { padding: 0 18px 12px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.qc-lbl { font-size: 11px; color: var(--muted); flex-shrink: 0; }
.qc-btn { font-size: 12px; padding: 3px 10px; border-radius: 7px; background: var(--s2);
  border: 1px solid var(--b2); color: var(--dim); transition: all .12s; white-space: nowrap; }
.qc-btn:hover { background: var(--s3); color: var(--text); }
.qc-btn:active { opacity: .6; }
.qc-more { color: var(--acc); border-style: dashed;
  border-color: color-mix(in srgb, var(--acc) 40%, transparent); background: none; }
.qc-more:hover { background: color-mix(in srgb, var(--acc) 8%, transparent); color: var(--acc); }

/* ── Copy-from picker rows ── */
.copy-row { padding: 11px 0; border-bottom: 1px solid var(--b); cursor: pointer;
  display: flex; flex-direction: column; gap: 3px; }
.copy-row:last-child { border-bottom: none; }
.copy-row:hover { background: var(--s2); }
.copy-row:active { opacity: .6; }
.copy-row-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.copy-name { font-size: 14px; font-weight: 600; color: var(--text); }
.copy-date { font-size: 11px; color: var(--muted); flex-shrink: 0; white-space: nowrap; }
.copy-preview { font-size: 11px; color: var(--dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
