/*
 * Course view (/course/<id>/) on the design system. Was an inline <style> in
 * templates/course-view.php with hard-coded purple gradients; same class names, ds tokens.
 */
.cv-wrap{max-width:1120px;margin:0 auto;padding:var(--sp-6) var(--sp-5) 5rem}
.cv-wrap .icon{width:18px;height:18px}
.cv-top{display:flex;align-items:center;gap:var(--sp-3);flex-wrap:wrap;margin-bottom:var(--sp-5)}
.cv-top a.cv-back{display:inline-flex;align-items:center;gap:var(--sp-1);text-decoration:none;font-size:var(--fs-sm);font-weight:var(--fw-semibold);color:var(--text-2)}
.cv-top a.cv-back .icon{width:16px;height:16px}
.cv-top a.cv-back:hover,.cv-top a.cv-back-primary{color:var(--brand)}
.cv-top .cv-back-sep{color:var(--text-3)}

/* ── Header: calm, on the page surface (was a saturated brand block) ── */
.cv-chips{display:flex;gap:var(--sp-2);flex-wrap:wrap;margin-bottom:var(--sp-3)}
.cv-chip{display:inline-flex;align-items:center;font-size:var(--fs-xs);font-weight:var(--fw-semibold);color:var(--brand);
  background:var(--brand-soft);border-radius:var(--radius-pill);padding:3px var(--sp-3)}
.cv-chip.ok{color:var(--ok);background:var(--ok-soft)}
.cv-hero{display:flex;gap:var(--sp-5);align-items:flex-start;background:var(--surface);color:var(--text);
  border:1px solid var(--border);border-radius:var(--radius-lg);padding:var(--sp-5) var(--sp-6);margin-bottom:var(--sp-6)}
.cv-hero-img{flex:0 0 168px;align-self:stretch;min-height:110px;border-radius:var(--radius);background:var(--brand-soft) center/cover no-repeat}
.cv-hero-body{flex:1;min-width:0}
.cv-hero h1,.cv-head h1{margin:0 0 var(--sp-2);font-size:var(--fs-2xl);font-weight:var(--fw-bold);line-height:1.35;color:var(--text)}
.cv-meta,.cv-facts{display:flex;gap:var(--sp-2) var(--sp-5);flex-wrap:wrap;align-items:center;font-size:var(--fs-sm);color:var(--text-2)}
.cv-meta>span,.cv-facts>span{display:inline-flex;align-items:center;gap:var(--sp-2)}
.cv-meta .icon,.cv-facts .icon{width:16px;height:16px;color:var(--text-3)}
.cv-hero .cv-done{color:var(--ok);font-weight:var(--fw-semibold)}
.cv-hero .cv-done .icon{color:var(--ok)}
.cv-meta-note{color:var(--warn);font-weight:var(--fw-semibold)}
.cv-progress{height:8px;border-radius:var(--radius-pill);background:var(--muted-soft);overflow:hidden;margin:var(--sp-4) 0 var(--sp-1)}
.cv-progress i{display:block;height:100%;border-radius:var(--radius-pill);background:var(--brand)}
.cv-hero .cv-progress-label{font-size:var(--fs-xs);color:var(--text-2)}
.cv-actions{display:flex;gap:var(--sp-2);flex-wrap:wrap;margin-top:var(--sp-4);position:relative}
/* a status pill a module prints among the actions (e.g. the learner's live-session attendance line) wraps inside the
   column: .ds-pill is nowrap and the module's own sheet that relaxes it is not loaded on the learner's page (dashboards
   redesign S3 — at 390px the long line made the page 417px wide) */
.cv-actions>.ds-pill{white-space:normal;max-width:100%;min-width:0;line-height:1.6;padding-block:3px}

.cv-btn{display:inline-flex;align-items:center;justify-content:center;gap:var(--sp-2);height:38px;padding:0 var(--sp-4);border-radius:var(--radius);
  font:inherit;font-size:var(--fs-sm);font-weight:var(--fw-semibold);text-decoration:none;white-space:nowrap;cursor:pointer;
  border:1px solid var(--border-strong);color:var(--text);background:var(--surface)}
.cv-btn .icon{width:16px;height:16px}
.cv-btn:hover{background:var(--surface-2)}
.cv-btn.cv-primary{background:var(--brand);color:var(--brand-ink);border-color:var(--brand)}
.cv-btn.cv-primary:hover{background:var(--brand-hover)}
.cv-btn[disabled]{opacity:.65;cursor:progress}

/* ── Public preview: intro + outline, buy card beside it ── */
.cv-pub{display:grid;grid-template-columns:minmax(0,1fr) 320px;gap:var(--sp-6);align-items:start}
.cv-head{padding:var(--sp-2) 0 var(--sp-6)}
.cv-lead{margin:0 0 var(--sp-4);font-size:var(--fs-md);line-height:1.9;color:var(--text-2);max-width:62ch}
.cv-outline{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-lg);overflow:hidden}
.cv-outline-head{display:flex;align-items:baseline;justify-content:space-between;gap:var(--sp-3);flex-wrap:wrap;padding:var(--sp-4) var(--sp-5);border-bottom:1px solid var(--border)}
.cv-outline-head h2{margin:0;font-size:var(--fs-lg);font-weight:var(--fw-bold)}
.cv-outline-hint{font-size:var(--fs-xs);color:var(--text-3)}
.cv-outline-empty{margin:0;padding:var(--sp-5);color:var(--text-3);font-size:var(--fs-sm)}
.cv-osec+.cv-osec{border-top:1px solid var(--border)}
.cv-osec>summary{list-style:none;cursor:pointer;display:flex;align-items:center;gap:var(--sp-3);padding:var(--sp-4) var(--sp-5);font-weight:var(--fw-semibold)}
.cv-osec>summary::-webkit-details-marker{display:none}
.cv-osec>summary:hover{background:var(--surface-2)}
.cv-osec-name{min-width:0}
.cv-osec-count{margin-inline-start:auto;font-size:var(--fs-xs);font-weight:var(--fw-medium);color:var(--text-3)}
.cv-osec .cv-chev{width:24px;height:24px;flex:0 0 24px;display:grid;place-items:center;color:var(--text-3);transition:transform .2s}
.cv-osec[open]>summary .cv-chev{transform:rotate(-90deg)}
.cv-osec-body{padding:0 var(--sp-5) var(--sp-3)}
.cv-orow{display:flex;align-items:center;gap:var(--sp-3);padding:var(--sp-2) 0;border-top:1px solid var(--border);font-size:var(--fs-sm);color:var(--text-2);scroll-margin-top:80px}
.cv-orow:first-child{border-top:none}
.cv-orow-ic{color:var(--text-3)}
.cv-orow-name{flex:1;min-width:0}
.cv-orow-go{font-size:var(--fs-xs);color:var(--text-3);text-decoration:none;white-space:nowrap}
.cv-orow-go:hover{color:var(--brand)}
.cv-osec .cv-mod{padding-inline:0}
.cv-free.ds-pill{font-size:var(--fs-xs)}

.cv-pub-aside{position:sticky;top:76px}
.cv-buycard{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-lg);overflow:hidden;box-shadow:var(--shadow-sm);scroll-margin-top:90px}
.cv-buycover{height:150px;display:grid;place-items:center;background:var(--brand-soft) center/cover no-repeat;color:var(--brand)}
.cv-buycover .icon{width:40px;height:40px;stroke-width:1.4}
.cv-buybody{padding:var(--sp-5)}
.cv-price{display:flex;align-items:baseline;gap:var(--sp-3);flex-wrap:wrap;line-height:1.2}
.cv-price-now{font-size:var(--fs-2xl);font-weight:var(--fw-bold);color:var(--text)}
.cv-price-old{font-size:var(--fs-sm);text-decoration:line-through;color:var(--text-3)}
.cv-price-dep{margin:var(--sp-2) 0 0;font-size:var(--fs-sm);color:var(--text-2)}
.cv-buycard .cv-actions{flex-direction:column;align-items:stretch;margin-top:var(--sp-4)}
.cv-buycard .cv-actions .cv-btn{width:100%;height:42px}
.cv-buy-state{display:flex;align-items:flex-start;gap:var(--sp-2);font-size:var(--fs-sm);color:var(--text-2);line-height:1.7}
.cv-buy-state.ok{color:var(--ok);font-weight:var(--fw-semibold)}
.cv-buy-state .icon{width:16px;height:16px;margin-top:3px;flex:none}
.cv-buy-msg{margin-top:var(--sp-2);font-size:var(--fs-sm)}
.cv-buy-msg:empty{display:none}
.cv-incl{list-style:none;margin:var(--sp-5) 0 0;padding:var(--sp-4) 0 0;border-top:1px solid var(--border);display:grid;gap:var(--sp-2);font-size:var(--fs-sm);color:var(--text-2)}
.cv-incl li{display:flex;align-items:center;gap:var(--sp-2)}
.cv-incl .icon{width:16px;height:16px;color:var(--text-3)}
.cv-buycard.cv-flash{outline:2px solid var(--brand);outline-offset:3px}

.cv-mbar{position:fixed;inset-inline:0;bottom:0;z-index:50;display:flex;align-items:center;justify-content:space-between;gap:var(--sp-3);
  padding:var(--sp-3) var(--sp-4);background:var(--surface);border-top:1px solid var(--border);box-shadow:0 -4px 16px rgba(0,0,0,.08)}
.cv-mbar[hidden]{display:none}
.cv-mbar-price{display:flex;flex-direction:column;line-height:1.3}
.cv-mbar-price b{font-size:var(--fs-lg)}
.cv-mbar-price small{font-size:var(--fs-xs);color:var(--text-2)}
body.cv-has-mbar .cv-wrap{padding-bottom:7rem}

@media (max-width:900px){
  .cv-pub{grid-template-columns:1fr;gap:var(--sp-5)}
  .cv-pub-aside{position:static;order:-1}
  .cv-pub-main{display:contents}
  .cv-head{order:-2;padding-bottom:0}
  .cv-outline{order:0}
  .cv-buycover{height:120px}
  .cv-buycover.is-empty{display:none} /* no cover image: the placeholder only pushes the price down on a phone */
  .cv-hero{flex-direction:column;padding:var(--sp-5)}
  .cv-hero-img{flex-basis:auto;width:100%;min-height:140px}
}

.cv-note{display:flex;gap:var(--sp-2);align-items:flex-start;border:1px solid var(--border);border-inline-start:3px solid var(--brand);
  border-radius:var(--radius);padding:var(--sp-3) var(--sp-4);font-size:var(--fs-sm);color:var(--text-2);margin-bottom:var(--sp-5);background:var(--surface)}

/* ── Sections ── */
.cv-sec{border:1px solid var(--border);border-radius:var(--radius-lg);margin-bottom:var(--sp-3);overflow:hidden;
  background:var(--surface);scroll-margin-top:70px}
.cv-sec>summary{list-style:none;cursor:pointer;display:flex;align-items:center;gap:var(--sp-3);padding:var(--sp-4) var(--sp-5);
  font-weight:var(--fw-semibold);font-size:var(--fs-base)}
.cv-sec>summary::-webkit-details-marker{display:none}
.cv-sec>summary:hover{background:var(--surface-2)}
.cv-sec .cv-count{font-size:var(--fs-xs);font-weight:var(--fw-semibold);color:var(--text-2);background:var(--muted-soft);border-radius:var(--radius-pill);padding:2px var(--sp-3)}
.cv-sec>summary .cv-chev{margin-inline-start:auto;width:24px;height:24px;flex:0 0 24px;display:grid;place-items:center;
  color:var(--text-3);transition:transform .2s}
.cv-sec[open]>summary .cv-chev{transform:rotate(-90deg)}
.cv-sec .cv-sec-body{padding:0 var(--sp-5) var(--sp-5)}
.cv-sec .cv-summary{font-size:var(--fs-sm);color:var(--text-2);margin-bottom:var(--sp-3);line-height:1.8}

/* ── Locked / restricted ── */
.cv-locked{background:var(--surface-2);border-style:dashed;box-shadow:none}
.cv-locked>summary{color:var(--text-2)}
.cv-locked .cv-lockmsg{padding:0 var(--sp-5) var(--sp-4);font-size:var(--fs-sm);color:var(--text-2);line-height:1.8}
.cv-locked .cv-lockmsg a{color:var(--brand);font-weight:var(--fw-semibold)}

/* ── Modules ── */
.cv-mod{display:flex;gap:var(--sp-3);padding:var(--sp-3) var(--sp-2);border-top:1px solid var(--border);border-radius:var(--radius);scroll-margin-top:80px}
.cv-mod:hover{background:var(--surface-2)}
.cv-mod:target{background:var(--brand-soft);box-shadow:inset 3px 0 0 var(--brand)}
.cv-mod .cv-ic{width:36px;height:36px;flex:0 0 36px;display:grid;place-items:center;border-radius:var(--radius);background:var(--brand-soft);color:var(--brand)}
.cv-mod-locked .cv-ic,.cv-mod .cv-ic:has(use[href="#i-lock"]){background:var(--surface-2);color:var(--text-3)}
.cv-mod .cv-body{flex:1;min-width:0}
.cv-mod .cv-name{font-weight:var(--fw-semibold);font-size:var(--fs-base);line-height:1.5}
.cv-mod .cv-sub{font-size:var(--fs-xs);color:var(--text-3);display:flex;gap:var(--sp-3);flex-wrap:wrap;margin-top:2px}
.cv-mod .cv-desc{font-size:var(--fs-sm);margin-top:var(--sp-2);line-height:1.8}
.cv-mod .cv-go{align-self:center}
.cv-done{color:var(--ok);font-weight:var(--fw-semibold)}
.cv-grade{color:var(--brand);font-weight:var(--fw-semibold)}

/* ── "Text and media" (label) blocks ── */
.cv-label{padding:var(--sp-4) var(--sp-2) var(--sp-2);border-top:1px solid var(--border);font-size:var(--fs-base);line-height:1.9}
.cv-label:first-child,.cv-mod:first-of-type{border-top:none}
.cv-label h1,.cv-label h2,.cv-label h3{margin:var(--sp-2) 0 var(--sp-3)}

/* ── Embedded / inline media ── */
.cv-embed-frame{display:block;width:100%;aspect-ratio:16/9;border:0;border-radius:var(--radius-lg);background:#000;margin:var(--sp-3) 0}
.cv-desc video,.cv-label video,video.cv-embed{display:block;width:100%;max-height:520px;border-radius:var(--radius-lg);background:#000;margin:var(--sp-3) 0}
.cv-desc audio,.cv-label audio,audio.cv-embed{display:block;width:100%;margin:var(--sp-2) 0}
.cv-desc img,.cv-label img,.cv-page img{max-width:100%;height:auto;border-radius:var(--radius)}
.cv-page{font-size:var(--fs-base);line-height:1.85;margin-top:var(--sp-2);border:1px solid var(--border);border-radius:var(--radius);padding:var(--sp-4) var(--sp-5);overflow-x:auto;background:var(--surface)}
.cv-page video,.cv-page audio{max-width:100%;border-radius:var(--radius)}
.cv-files{display:flex;flex-direction:column;gap:var(--sp-2);margin-top:var(--sp-2)}
.cv-file-inline video,.cv-file-inline audio{width:100%;max-height:480px;border-radius:var(--radius-lg);background:#000}
.cv-file-inline img{max-width:100%;border-radius:var(--radius-lg)}
.cv-file-inline iframe{width:100%;height:540px;border:1px solid var(--border);border-radius:var(--radius-lg);background:#fff}

/* ── Section index ── */
.cv-layout{display:grid;grid-template-columns:240px minmax(0,1fr);gap:var(--sp-5);align-items:start}
.cv-layout.cv-nolayout{grid-template-columns:1fr}
.cv-index{position:sticky;top:60px;max-height:calc(100vh - 80px);overflow:auto;border:1px solid var(--border);border-radius:var(--radius-lg);
  background:var(--surface);padding:var(--sp-3);box-shadow:var(--shadow-sm)}
.cv-index h3{margin:2px var(--sp-1) var(--sp-3);font-size:var(--fs-sm);color:var(--text-3);font-weight:var(--fw-semibold)}
.cv-index a{position:relative;display:flex;align-items:center;gap:var(--sp-2);padding:var(--sp-2) var(--sp-3) 10px;border-radius:var(--radius);
  text-decoration:none;color:var(--text-2);font-size:var(--fs-sm);font-weight:var(--fw-medium);line-height:1.4}
.cv-index a .cv-idx-bar{position:absolute;bottom:4px;inset-inline:var(--sp-3);height:3px;border-radius:var(--radius-pill);background:var(--muted-soft);overflow:hidden}
.cv-index a .cv-idx-bar i{display:block;height:100%;border-radius:var(--radius-pill);background:var(--brand)}
.cv-index a:hover{background:var(--surface-2);color:var(--text)}
.cv-index a.cv-active{background:var(--brand-soft);color:var(--brand)}
.cv-index .cv-idx-count{margin-inline-start:auto;font-size:var(--fs-xs);color:var(--text-3);background:var(--muted-soft);border-radius:var(--radius-pill);padding:0 var(--sp-2);flex:0 0 auto}
.cv-index .cv-idx-progress{height:6px;border-radius:var(--radius-pill);background:var(--muted-soft);overflow:hidden;margin:2px var(--sp-1) var(--sp-3)}
.cv-index .cv-idx-progress i{display:block;height:100%;background:var(--brand)}
.cv-index-toggle{display:none}
@media (max-width:900px){
  .cv-layout{grid-template-columns:1fr}
  .cv-index{display:none;position:fixed;inset-inline:12px;bottom:80px;top:auto;max-height:60vh;z-index:60;box-shadow:var(--shadow)}
  .cv-index.cv-open{display:block}
  .cv-index-toggle{display:flex;position:fixed;bottom:18px;inset-inline-end:18px;z-index:61;align-items:center;gap:var(--sp-2);
    background:var(--brand);color:var(--brand-ink);border:none;border-radius:var(--radius-pill);padding:var(--sp-3) var(--sp-4);
    font:inherit;font-weight:var(--fw-semibold);font-size:var(--fs-sm);box-shadow:var(--shadow);cursor:pointer}
}

/* ── Protected video placeholder (VdoCipher — no OTP until click) ── */
/* بطاقة الفيديو المحمي: إطار فيديو داكن كله قابل للنقر، ودائرة تشغيل في الوسط (ألوان ثابتة في الوضعين — إطار فيديو) */
.cv-vdo{position:relative;aspect-ratio:16/9;width:100%;margin:var(--sp-3) 0;border-radius:var(--radius-lg);overflow:hidden;color:#fff;
  background:radial-gradient(120% 90% at 50% 40%,color-mix(in srgb,var(--brand-base) 55%,#0b1020) 0%,#0b1020 75%)}
.cv-vdo-play{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--sp-1);
  width:100%;border:0;padding:var(--sp-4);background:transparent;color:inherit;font:inherit;cursor:pointer}
.cv-vdo-ic{display:grid;place-items:center;width:76px;height:76px;margin-bottom:var(--sp-2);border-radius:50%;
  background:#fff;color:var(--brand-base);box-shadow:0 10px 30px rgba(0,0,0,.35),0 0 0 10px rgba(255,255,255,.12);
  transition:transform .18s ease,box-shadow .18s ease}
.cv-vdo-play:hover .cv-vdo-ic,.cv-vdo-play:focus-visible .cv-vdo-ic{transform:scale(1.08);box-shadow:0 12px 34px rgba(0,0,0,.4),0 0 0 14px rgba(255,255,255,.16)}
.cv-vdo-play:focus-visible{outline:3px solid #fff;outline-offset:-6px;border-radius:var(--radius-lg)}
.cv-vdo-t{font-weight:var(--fw-semibold);font-size:var(--fs-lg,1.125rem)}
.cv-vdo-s{font-size:var(--fs-sm);opacity:.8}
.cv-vdo-play:disabled{cursor:progress}
.cv-vdo-play:disabled .cv-vdo-ic{opacity:.7;transform:none}
.cv-vdo-msg{position:absolute;inset-inline:0;bottom:var(--sp-3);text-align:center;font-size:var(--fs-sm);pointer-events:none}
.cv-vdo-msg:empty{display:none}
/* Cloudflare Stream: the player inside our own container, which owns fullscreen and carries the
   platform's moving watermark (Stream has no per-viewer watermark of its own) */
.cv-cfs{position:absolute;inset:0;background:#000}
.cv-cfs .cv-embed-frame{position:absolute;inset:0;width:100%;height:100%;margin:0;aspect-ratio:auto;border-radius:0}
.cv-cfs-mark{position:absolute;z-index:2;max-width:60%;padding:2px 6px;border-radius:4px;pointer-events:none;user-select:none;
  font-size:clamp(11px,1.6vw,15px);font-weight:var(--fw-semibold);color:rgba(255,255,255,.62);background:rgba(0,0,0,.18);
  text-shadow:0 1px 2px rgba(0,0,0,.6);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;transition:inset-inline-start 1.2s ease,top 1.2s ease}
.cv-cfs-fs{position:absolute;z-index:3;inset-inline-end:10px;top:10px;width:34px;height:34px;border:0;border-radius:8px;
  background:rgba(0,0,0,.45);color:#fff;font-size:18px;line-height:1;cursor:pointer;opacity:.75}
.cv-cfs-fs:hover,.cv-cfs-fs:focus-visible{opacity:1}
.cv-cfs .cv-native{position:absolute;inset:0;width:100%;height:100%;display:block;background:#000;object-fit:contain}
.cv-cfs:fullscreen{inset:auto;width:100vw;height:100vh}
/* a lesson video whose provider is switched off: the same frame, a quiet note, nothing to click */
.cv-vdo-off{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--sp-1);padding:var(--sp-4);text-align:center}
.cv-vdo-off .cv-vdo-ic{opacity:.45;box-shadow:none}
.cv-cfs:fullscreen .cv-cfs-mark{font-size:clamp(14px,1.8vw,22px)}
@media (prefers-reduced-motion:reduce){.cv-vdo-ic{transition:none}}
@media (max-width:480px){.cv-vdo-ic{width:60px;height:60px}.cv-vdo-s{display:none}}

/* ── Teacher edit mode (?edit=1) ── */
.ce-banner{border-inline-start-color:var(--warn)}
.ce-tools{display:flex;flex-wrap:wrap;align-items:center;gap:var(--sp-1);margin-top:var(--sp-2);padding-top:var(--sp-2);border-top:1px dashed var(--border)}
.ce-sec-tools{margin:0 0 var(--sp-3);padding:var(--sp-2) 0;border-top:0;border-bottom:1px dashed var(--border)}
.ce-tools .ds-btn[disabled]{opacity:.45;cursor:not-allowed}
.ce-tools.ce-busy{opacity:.7;cursor:progress}
.ce-tip{display:inline-flex}
.ce-err{flex-basis:100%;color:var(--bad);font-size:var(--fs-sm);min-height:0}
.ce-err:empty{display:none}
.ce-inline{display:inline-flex;flex-wrap:wrap;gap:var(--sp-1);align-items:center;flex:1 1 260px}
.ce-inline-input{height:32px;flex:1 1 180px;min-width:0}
.ce-hidden{opacity:.72;background:repeating-linear-gradient(-45deg,transparent 0 10px,var(--surface-2) 10px 20px)}
.ce-addsec{display:flex;flex-wrap:wrap;gap:var(--sp-2);align-items:center;margin:var(--sp-2) 0 var(--sp-6)}
/* showModal() dialogs centred in the viewport: the legacy/global resets zero dialog margins and
   positioning, which pinned the picker to the top edge — restate the modal box explicitly. */
.ce-dialog{position:fixed;inset:0;margin:auto;height:fit-content;width:min(560px,calc(100vw - 32px));max-width:560px;
  max-height:calc(100dvh - 48px);overflow:auto;border:1px solid var(--border);border-radius:var(--radius-lg);
  padding:0;background:var(--surface);color:var(--text);box-shadow:var(--shadow);direction:rtl;text-align:start}
.ce-dialog:not([open]){display:none}
.ce-dialog::backdrop{background:rgba(0,0,0,.45)}
.ce-form{display:flex;flex-direction:column;gap:var(--sp-4);padding:var(--sp-5)}
.ce-form h3{margin:0;font-size:var(--fs-lg)}
.ce-form-actions{display:flex;gap:var(--sp-2);justify-content:flex-start}
.ce-form .ce-err{display:block}
.ce-types{display:grid;grid-template-columns:repeat(auto-fill,minmax(170px,1fr));gap:var(--sp-3)}
.ce-type{display:flex;flex-direction:column;align-items:flex-start;gap:2px;padding:var(--sp-4);border:1px solid var(--border-strong);border-radius:var(--radius);
  background:var(--surface);color:var(--text);font:inherit;text-align:start;cursor:pointer}
.ce-type:hover,.ce-type:focus-visible{border-color:var(--brand);background:var(--brand-soft)}
.ce-type-ic{font-size:1.4rem}
.ce-type small{color:var(--text-3);font-size:var(--fs-xs)}
@media (max-width:520px){
  /* phone: one compact row per type (icon beside its title/hint) so the picker fits the viewport */
  .ce-types{grid-template-columns:1fr;gap:var(--sp-2)}
  .ce-type{display:grid;grid-template-columns:auto 1fr;column-gap:var(--sp-3);align-items:center;padding:var(--sp-3)}
  .ce-type-ic{grid-row:span 2}
}
.ce-editor{border:1px solid var(--border-strong);border-radius:var(--radius);overflow:hidden}
.ce-editor-bar{display:flex;flex-wrap:wrap;gap:2px;padding:var(--sp-1);background:var(--surface-2);border-bottom:1px solid var(--border)}
.ce-editor-area{min-height:200px;max-height:50vh;overflow:auto;padding:var(--sp-3) var(--sp-4);line-height:1.8;outline:none}
.ce-editor-area:focus{box-shadow:inset var(--focus)}
.ce-progress{width:100%}

/* ── Phase 3b: unlock rules, completion, free preview ── */
.cv-sec .cv-count.cv-rule{background:var(--brand-soft);color:var(--brand)}
.cv-sec .cv-count .icon{width:13px;height:13px;vertical-align:-2px;margin-inline-end:4px}
.cv-mod-locked{opacity:.8}
.cv-mod-locked .cv-ic{background:var(--surface-2);color:var(--text-3)}
.cv-lock-reason{color:var(--text-2)}
.cv-complete{display:flex;flex-wrap:wrap;align-items:center;gap:var(--sp-2)}
.cv-complete-msg{font-size:var(--fs-xs);color:var(--bad)}
.cv-complete-msg:empty{display:none}
.cv-locked>.cv-sec-body{padding-top:0;border-top:1px dashed var(--border);background:var(--surface)}
.ce-tools .ds-btn.ce-on{background:var(--brand-soft);color:var(--brand);border-color:var(--brand)}
.ce-check{display:flex;align-items:center;gap:var(--sp-2);font-weight:var(--fw-semibold);cursor:pointer}

/* ── Error pages ── */
.cv-err{max-width:560px;margin:12vh auto;text-align:center;padding:var(--sp-8);border:1px solid var(--border);border-radius:var(--radius-lg);background:var(--surface);box-shadow:var(--shadow-sm)}

@media (max-width:640px){
  .cv-wrap{padding:var(--sp-4) var(--sp-3) 4rem}
  .cv-hero{padding:var(--sp-5) var(--sp-4)}
  .cv-file-inline iframe{height:65vh}
  .cv-mod .cv-go .cv-btn{padding:0 var(--sp-3);font-size:var(--fs-xs)}
  /* phone: the action button drops below the title rather than pushing the row past the viewport */
  .cv-mod{flex-wrap:wrap}
  .cv-mod .cv-body{min-width:9rem}
  .cv-mod .cv-go{margin-inline-start:auto}
}
