/* canva2 — one stylesheet, Apple-ish: system type, quiet greys, one blue. */
:root {
  --bg: #F5F5F7; --panel: #FFFFFF; --sunk: #ECECF0; --line: #E5E5EA; --line-strong: #D2D2D7;
  --text: #1D1D1F; --text-2: #424245; --muted: #6E6E73;
  --blue: #0071E3; --blue-ink: #0058B0; --blue-tint: #E3EEFB;
  --green: #248A3D; --green-tint: #E8F6EC; --amber: #8A4B00; --amber-tint: #FFF4E0; --red: #C4161C; --red-tint: #FDECEC;
  --radius: 12px; --radius-lg: 16px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: 14px; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: #0066CC; }
code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .92em; color: var(--muted); }
h1 { font-size: 30px; font-weight: 700; letter-spacing: -.02em; margin: 2px 0 6px; }
h2 { font-size: 15px; font-weight: 600; margin: 0 0 6px; }
h3 { font-size: 13px; font-weight: 600; margin: 0 0 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.lede { font-size: 15px; line-height: 1.5; color: var(--muted); margin: 0 0 22px; max-width: 640px; }
.hint { font-size: 12px; line-height: 1.45; color: var(--muted); margin: 4px 0 0; }
.eyebrow { font-size: 13px; font-weight: 500; color: var(--muted); }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 20px; background: rgba(255,255,255,.86); backdrop-filter: saturate(180%) blur(16px); border-bottom: 1px solid var(--line); }
.logo { font-weight: 700; font-size: 16px; letter-spacing: -.02em; color: var(--text); text-decoration: none; margin-right: 6px; }
.logo span { color: var(--blue); }
.org-switch { display: inline-flex; align-items: center; gap: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 0 8px; color: var(--text); }
.org-switch select { border: 0; background: transparent; font: inherit; font-weight: 500; padding: 6px 2px; color: var(--text); outline: none; }
.crumb-sep { color: var(--muted); }
.crumb { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; color: var(--text); text-decoration: none; }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; flex: none; }
.save-state { font-size: 12px; color: var(--muted); min-width: 64px; text-align: right; }
.save-state[data-kind="ok"] { color: var(--green); }
.save-state[data-kind="error"] { color: var(--red); font-weight: 600; }

/* Buttons and fields */
.btn { font: inherit; font-size: 14px; cursor: pointer; border: 1px solid var(--line-strong); background: var(--panel); color: var(--text); border-radius: 10px; padding: 9px 16px; min-height: 40px; }
.btn:hover { background: #FAFAFC; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 600; }
.btn.primary:hover { background: #0077ED; }
.btn.add { border-style: dashed; color: #0066CC; font-weight: 500; background: transparent; align-self: flex-start; margin-top: 12px; }
.btn.danger-text { color: var(--red); border-color: var(--line); }
.icon-btn { flex: none; width: 40px; height: 40px; border: 1px solid var(--line); background: var(--panel); border-radius: 8px; cursor: pointer; color: var(--text-2); font-size: 15px; }
.icon-btn.danger { color: var(--red); }
input, textarea, select { font: inherit; font-size: 14px; color: var(--text); background: #fff; border: 1px solid var(--line-strong); border-radius: 10px; padding: 9px 12px; width: 100%; outline: none; }
textarea { resize: vertical; line-height: 1.45; }
input:focus, textarea:focus, select:focus, .btn:focus-visible, .step:focus-visible { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,113,227,.2); outline: none; }
input[type="range"] { padding: 0; border: 0; box-shadow: none; accent-color: var(--blue); background: transparent; }
input[type="color"] { width: 52px; height: 40px; padding: 2px; flex: none; }
input.strong { font-weight: 600; }
label, .label { display: block; font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.field-error { display: block; font-size: 12px; color: var(--red); margin-top: 4px; min-height: 0; }
.fields { display: flex; flex-wrap: wrap; gap: 12px; }
.fields .field { flex: 1 1 160px; }
.hex-input { display: flex; gap: 8px; }
.segmented { display: inline-flex; flex-wrap: wrap; background: var(--sunk); border-radius: 9px; padding: 2px; }
.segmented button { font: inherit; font-size: 13px; border: 0; background: transparent; border-radius: 7px; padding: 6px 13px; cursor: pointer; color: var(--text); min-height: 32px; }
.segmented button[aria-pressed="true"] { background: var(--panel); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.slider-row { display: grid; grid-template-columns: 120px minmax(0, 1fr) 120px; gap: 12px; align-items: center; font-size: 13px; }
.slider-row label { margin: 0; }
.slider-row output { font-weight: 600; }
.slider-row > span:last-child, .slider-row output { text-align: right; }
.slider-row .lean { font-weight: 600; color: var(--text); }
.slider-row > span { color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { font-size: 12px; font-weight: 500; background: #F2F2F7; border-radius: 20px; padding: 4px 10px; }
.badge { font-size: 11px; font-weight: 600; border-radius: 6px; padding: 2px 7px; vertical-align: middle; }
.badge.good { background: var(--green-tint); color: #1B6B30; }
.badge.warn { background: var(--amber-tint); color: var(--amber); }
.badge.bad { background: var(--red-tint); color: #A3161B; }
.facts { display: flex; flex-wrap: wrap; gap: 8px; font-size: 12px; }
.facts > span:not(.hint) { background: #F2F2F7; border-radius: 8px; padding: 6px 10px; }

/* Pages */
.page { padding: 32px 24px 60px; }
.page.narrow { max-width: 1080px; margin: 0 auto; }
.page-title { font-size: 34px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.tile, .brand-tile { display: flex; flex-direction: column; gap: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px; text-decoration: none; color: var(--text); min-height: 150px; }
.tile:hover, .brand-tile:hover { border-color: var(--line-strong); box-shadow: 0 4px 18px rgba(0,0,0,.05); }
.tile-icon { width: 40px; height: 40px; border-radius: 10px; background: var(--text); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 18px; margin-bottom: auto; }
.tile-title { font-size: 16px; font-weight: 600; }
.tile-sub { font-size: 12px; color: var(--muted); }
.tile-new { border-style: dashed; background: transparent; justify-content: flex-end; }
.brand-tile .strip { display: flex; height: 64px; border-radius: 10px; overflow: hidden; margin-bottom: auto; border: 1px solid rgba(0,0,0,.05); }

/* Workspace: steps | editor | preview */
.workspace { display: flex; flex-wrap: wrap; min-height: calc(100vh - 58px); align-items: stretch; }
.steps { flex: 1 1 220px; max-width: 260px; min-width: 200px; padding: 20px 12px; border-right: 1px solid var(--line); }
.steps-label { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 0 10px 10px; }
.step { display: flex; width: 100%; text-align: left; align-items: center; gap: 10px; padding: 9px 10px; border: 0; border-radius: 10px; margin-bottom: 2px; background: transparent; cursor: pointer; font: inherit; color: var(--text); }
.step:hover { background: rgba(0,0,0,.04); }
.step[aria-current="step"] { background: var(--blue-tint); }
.step[aria-current="step"] .step-title { color: var(--blue-ink); }
.step-num, .step-glyph { width: 26px; height: 26px; border-radius: 50%; background: #E5E5EA; color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex: none; }
.step-glyph { border-radius: 8px; }
.step[aria-current="step"] .step-num, .step[aria-current="step"] .step-glyph { background: var(--blue); color: #fff; }
.step-num[data-done="1"] { background: #34C759; color: transparent; position: relative; }
.step-num[data-done="1"]::after { content: "✓"; color: #fff; position: absolute; }
.step-text { display: flex; flex-direction: column; }
.step-title { font-size: 14px; font-weight: 600; }
.step-sub { font-size: 12px; color: var(--muted); }
.note { margin: 18px 10px 0; padding: 12px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); font-size: 12px; line-height: 1.5; color: var(--text-2); }
.editor { flex: 999 1 520px; min-width: 0; padding: 28px 32px 48px; }
.editor > section, .pager { max-width: 760px; }
.pager { display: flex; gap: 10px; margin-top: 22px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px; margin-bottom: 16px; }
.card.flush { padding: 6px 12px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack > .card { margin-bottom: 0; }
.card.split { display: flex; flex-wrap: wrap; gap: 20px; }
.card.split > div { flex: 1 1 260px; min-width: 0; }
.row-card { display: flex; flex-direction: column; gap: 10px; }
.row-head { display: flex; align-items: center; gap: 10px; }
.row-head.wrap { flex-wrap: wrap; align-items: flex-start; }
.row-head.wrap input { flex: 1 1 180px; width: auto; }
.row-head.wrap textarea { flex: 2 1 260px; width: auto; }
.row-head .grow { flex: 1; margin: 0; }
.row-num { width: 24px; flex: none; font-size: 13px; font-weight: 700; color: var(--muted); }
.caption { white-space: pre-line; font-size: 14px; line-height: 1.55; background: var(--bg); border-radius: var(--radius); padding: 12px 14px; }
.rules { display: grid; grid-template-columns: 1fr auto; margin: 0; font-size: 12px; }
.rules dt, .rules dd { padding: 7px 0; border-bottom: 1px solid #F2F2F7; margin: 0; }
.rules dt { color: var(--muted); }
.rules dd { font-weight: 600; text-align: right; }
.check { display: flex; width: 100%; align-items: center; gap: 10px; padding: 10px 0; border: 0; border-bottom: 1px solid #F2F2F7; background: transparent; text-align: left; font: inherit; color: var(--text); cursor: pointer; }
.check > span:nth-child(2) { flex: 1; }
.check .dot.ok { background: #34C759; } .check .dot.todo { background: #FF9F0A; }
.check .ok { color: var(--green); font-weight: 600; font-size: 12px; } .check .todo { color: var(--amber); font-weight: 600; font-size: 12px; }
.check .dot { width: 10px; height: 10px; }
.page-picker { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.page-thumb { font: inherit; font-size: 13px; font-weight: 600; text-align: left; border: 2px solid var(--line); border-radius: var(--radius); padding: 8px; background: #fff; cursor: pointer; color: var(--text); }
.page-thumb[aria-pressed="true"] { border-color: var(--blue); }
.thumb { display: block; aspect-ratio: 16/9; border-radius: 6px; margin-bottom: 6px; background: var(--bg); }
.thumb.t0 { background: var(--b-primary, #333); }
.json { margin: 0; max-height: 260px; overflow: auto; background: var(--text); color: #F5F5F7; border-radius: 10px; padding: 12px; font-size: 12px; line-height: 1.5; white-space: pre-wrap; }
.render { display: block; width: 270px; max-width: 100%; height: auto; aspect-ratio: 4/5; border-radius: 6px; background: var(--sunk); box-shadow: 0 8px 24px rgba(0,0,0,.08); }

/* Colour */
.swatch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.swatch { font: inherit; text-align: left; border: 2px solid transparent; border-radius: var(--radius); padding: 6px; background: #fff; cursor: pointer; color: var(--text); }
.swatch[aria-pressed="true"] { border-color: var(--blue); }
.swatch-chip { display: block; height: 56px; border-radius: 8px; border: 1px solid rgba(0,0,0,.06); }
.swatch-name { display: block; font-size: 13px; font-weight: 600; margin-top: 6px; }
.swatch-meta { display: block; font-size: 11px; color: var(--muted); }
.swatch.add { border: 1px dashed #A1A1A6; color: #0066CC; font-weight: 500; min-height: 104px; text-align: center; }
.matrix { display: flex; flex-direction: column; gap: 6px; overflow-x: auto; }
.matrix-row { display: flex; gap: 6px; min-width: 540px; }
.matrix-name { width: 100px; flex: none; font-size: 12px; font-weight: 600; display: flex; align-items: center; }
.cell { flex: 1; min-width: 70px; border-radius: 8px; padding: 6px; border: 1px solid rgba(0,0,0,.06); display: flex; flex-direction: column; gap: 3px; }
.cell .aa { font-size: 18px; font-weight: 700; line-height: 1; }
.cell .badge { align-self: flex-start; font-size: 10px; }

/* Typography */
.style-row { display: flex; width: 100%; align-items: center; gap: 14px; padding: 12px 8px; border: 0; border-bottom: 1px solid #F2F2F7; background: transparent; text-align: left; border-radius: 8px; cursor: pointer; color: var(--text); font: inherit; }
.style-row:last-child { border-bottom: 0; }
.style-row[aria-pressed="true"] { background: #F0F6FD; }
.style-label { width: 84px; flex: none; font-size: 12px; font-weight: 600; color: var(--muted); }
.style-sample { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.style-meta { font-size: 11px; color: var(--muted); flex: none; }

/* Logo */
.logo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.logo-tile { height: 90px; border-radius: 10px; border: 1px solid rgba(0,0,0,.06); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 17px; letter-spacing: .02em; text-align: center; padding: 6px; }
.logo-tile small { font-size: 10px; letter-spacing: 0; }

/* Preview column */
.preview { flex: 1 1 420px; max-width: 540px; min-width: 0; padding: 28px 24px; border-left: 1px solid var(--line); background: var(--sunk); }
.preview-head { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.preview-head span:last-child { font-weight: 400; color: var(--muted); font-size: 12px; }
.guide-page { aspect-ratio: 16/9; border-radius: 6px; overflow: hidden; box-shadow: 0 8px 24px rgba(0,0,0,.08); margin-bottom: 20px; background: var(--b-paper, #fff); }
.feeds .feed { display: flex; gap: 10px; align-items: flex-start; padding: 7px 0; border-top: 1px solid #F2F2F7; font-size: 13px; line-height: 1.4; color: var(--text-2); }
.pill { flex: none; font-size: 11px; font-weight: 600; color: var(--blue-ink); background: #E8F1FC; border-radius: 6px; padding: 2px 7px; }

/* Guide pages (miniature, drawn in the brand's colours) */
.gp { height: 100%; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; color: var(--b-primary, #222); background: var(--b-paper, #fff); font-family: var(--b-body, Inter), Inter, sans-serif; font-size: 7px; line-height: 1.45; }
.gp-head, .gp-foot { display: flex; gap: 16px; font-size: 6px; letter-spacing: .14em; font-weight: 600; text-transform: uppercase; }
.gp-no { margin-left: auto; } .gp-foot { justify-content: space-between; font-size: 5px; margin-top: auto; }
.gp-p { color: var(--b-ink, #555); display: block; }
.gp-h { font-weight: 700; text-transform: uppercase; letter-spacing: .04em; font-size: 8.5px; display: block; }
.gp-num { color: var(--b-accent, #888); font-weight: 700; display: block; }
.gp-label { font-size: 5.5px; letter-spacing: .14em; font-weight: 600; text-transform: uppercase; opacity: .7; }
.gp-cover { flex-direction: row; padding: 0; gap: 0; }
.gp-left { flex: 1; background: var(--b-primary); color: var(--b-paper); padding: 16px; display: flex; flex-direction: column; justify-content: space-between; }
.gp-brand { font-family: var(--b-display), Inter, sans-serif; font-size: 22px; font-weight: 700; line-height: 1.05; }
.gp-kicker { font-size: 6px; letter-spacing: .14em; font-weight: 600; text-transform: uppercase; }
.gp-kicker.accent { color: var(--b-accent); }
.gp-right { flex: 1.3; padding: 14px; display: flex; flex-direction: column; gap: 5px; color: var(--b-ink); }
.gp-lead { font-size: 9.5px; font-weight: 600; color: var(--b-primary); }
.gp-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.gp-chips span { background: var(--b-accent); color: var(--b-paper); border-radius: 20px; padding: 2px 7px; font-weight: 600; }
.gp-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: auto; }
.gp-cols > div { display: flex; flex-direction: column; gap: 3px; }
.gp-split { flex-direction: row; gap: 14px; }
.gp-side { width: 28%; display: flex; flex-direction: column; gap: 6px; }
.gp-side.wide { width: auto; flex: 1.2; }
.gp-title { font-family: var(--b-display), Inter, sans-serif; font-size: 11px; font-weight: 600; }
.gp-table { flex: 1; display: flex; flex-direction: column; }
.gp-row { display: grid; grid-template-columns: 14px 1fr 1.6fr; gap: 8px; padding: 4px 0; border-bottom: 1px solid color-mix(in srgb, var(--b-primary) 15%, transparent); }
.gp-th { font-size: 5px; letter-spacing: .14em; font-weight: 600; text-transform: uppercase; border-bottom-color: var(--b-accent); }
.gp-one { font-size: 8px; }
.gp-sliders { flex: 1; display: flex; flex-direction: column; gap: 7px; justify-content: center; }
.gp-slider > div:first-child { display: flex; justify-content: space-between; font-size: 6px; color: var(--b-ink); }
.gp-track { position: relative; height: 2px; background: color-mix(in srgb, var(--b-primary) 15%, transparent); margin-top: 3px; }
.gp-track i { position: absolute; top: -3px; width: 8px; height: 8px; margin-left: -4px; border-radius: 50%; background: var(--b-accent); }
.gp-palette { flex: 1; display: flex; min-height: 0; }
.gp-palette > div { padding: 5px; font-size: 5px; letter-spacing: .08em; text-transform: uppercase; line-height: 1.55; border: .5px solid rgba(0,0,0,.05); }
.gp-palette b { display: block; }
.gp-type { flex: 1; display: flex; gap: 12px; min-height: 0; }
.gp-specimen { flex: 1; display: flex; flex-direction: column; gap: 4px; overflow: hidden; min-width: 0; }
.gp-specimen small { font-size: 4.5px; letter-spacing: .12em; text-transform: uppercase; opacity: .7; }
.gp-aa { width: 34%; border-radius: 3px; display: flex; align-items: center; justify-content: center; font-size: 46px; }
.gp-logo { flex: 1; display: flex; gap: 10px; min-height: 0; }
.gp-logo-main { flex: 1.2; display: flex; align-items: center; justify-content: center; background: #fff; border-radius: 3px; }
.gp-clear { border: 1px dashed; font-size: 16px; }
.gp-misuse { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.gp-misuse > div { border-radius: 3px; display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; font-size: 8px; white-space: nowrap; }
.gp-misuse small { font-size: 4.5px; color: var(--red); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; margin-top: 4px; }
.gp-photos { flex: 1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; min-height: 0; }
.gp-photos figure { margin: 0; display: flex; flex-direction: column; gap: 3px; min-height: 0; }
.gp-photos svg { width: 100%; flex: 1; min-height: 0; border-radius: 2px; }
.gp-photos figcaption { font-size: 5px; letter-spacing: .12em; text-transform: uppercase; font-weight: 600; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; background: var(--text); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 13px; transition: .2s; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 900px) {
  .steps { max-width: none; border-right: 0; border-bottom: 1px solid var(--line); }
  .preview { max-width: none; border-left: 0; }
  .editor { padding: 22px 16px 40px; }
  .slider-row { grid-template-columns: 90px minmax(0, 1fr) 90px; }
}

/* Small buttons */
.btn.small { min-height: 32px; padding: 5px 12px; font-size: 13px; border-radius: 8px; }

/* Logo slots (identity → logo) */
.logo-slots { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.logo-slot { display: flex; gap: 12px; align-items: center; }
.logo-slot-img { width: 120px; height: 84px; flex: none; border-radius: 10px; border: 1px dashed var(--line-strong); background: #fff center/16px 16px; display: flex; align-items: center; justify-content: center; padding: 8px; }
.logo-slot-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-slot-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.logo-slot-text .row-head { margin-top: 4px; gap: 6px; }
.logo-tile img { max-width: 70%; max-height: 46px; object-fit: contain; }
.gp-clear img { display: block; height: 26px; width: auto; }
.gp-misuse img { height: 14px; width: auto; }
.gp-photos img { width: 100%; flex: 1; min-height: 0; object-fit: cover; border-radius: 2px; }

/* Photo thumbnails on imagery categories */
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumbs img { width: 76px; height: 76px; object-fit: cover; border-radius: 8px; }
.thumb-add { font: inherit; font-size: 12px; color: #0066CC; min-width: 76px; height: 76px; padding: 0 12px; border: 1px dashed #A1A1A6; border-radius: 8px; background: transparent; cursor: pointer; }

/* Media library window */
body.modal-open { overflow: hidden; }
.media-overlay { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.38); display: flex; align-items: center; justify-content: center; padding: 24px; }
.media-dialog { position: relative; width: min(1120px, 100%); height: min(720px, 100%); background: var(--panel); border-radius: 18px; box-shadow: 0 24px 80px rgba(0,0,0,.28); display: flex; flex-direction: column; overflow: hidden; }
.media-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.media-head h2 { margin: 0; font-size: 17px; }
.media-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.media-toolbar input[type="search"] { flex: 1 1 220px; width: auto; }
.upload-btn { margin: 0; display: inline-flex; align-items: center; cursor: pointer; font-size: 14px; color: #fff; }
.media-body { flex: 1; display: flex; min-height: 0; }
.media-grid { flex: 1; overflow: auto; padding: 16px 18px; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); grid-auto-rows: 160px; gap: 12px; align-content: start; }
.media-tile { position: relative; font: inherit; border: 2px solid transparent; border-radius: 12px; background: var(--bg); padding: 0; cursor: pointer; overflow: hidden; display: flex; flex-direction: column; color: var(--text); }
.media-tile img { flex: 1; min-height: 0; width: 100%; object-fit: cover; }
.media-tile.is-logo img { object-fit: contain; padding: 14px; background: #fff; }
.media-name { font-size: 12px; padding: 6px 8px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--panel); border-top: 1px solid var(--line); }
.media-tile:hover { border-color: var(--line-strong); }
.media-tile[aria-pressed="true"] { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,113,227,.18); }
.media-check { position: absolute; top: 8px; right: 8px; width: 22px; height: 22px; border-radius: 50%; background: var(--blue); color: #fff; font-size: 12px; display: none; align-items: center; justify-content: center; }
.media-tile[aria-pressed="true"] .media-check { display: flex; }
.media-tile.pending { align-items: center; justify-content: center; gap: 8px; font-size: 12px; color: var(--muted); cursor: default; }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--blue); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.media-empty { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 60px 20px; text-align: center; border: 1px dashed var(--line-strong); border-radius: 14px; }
.media-details { width: 280px; flex: none; border-left: 1px solid var(--line); padding: 16px; overflow: auto; display: flex; flex-direction: column; gap: 12px; background: #FBFBFD; }
.media-preview { border-radius: 10px; overflow: hidden; background: var(--sunk); display: flex; align-items: center; justify-content: center; aspect-ratio: 4/3; }
.media-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.media-preview.is-logo { background: #fff; border: 1px solid var(--line); padding: 12px; }
.media-foot { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--line); }
.media-foot .hint { margin: 0 auto 0 0; }
.media-drop { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; font-size: 18px; font-weight: 600; color: var(--blue-ink); background: rgba(227,238,251,.92); border: 3px dashed var(--blue); border-radius: 18px; pointer-events: none; }
.media-dialog.dragging .media-drop { display: flex; }
@media (max-width: 760px) {
  .media-details { display: none; }
  .media-overlay { padding: 0; }
  .media-dialog { border-radius: 0; height: 100%; }
}
.gp-photos { grid-auto-rows: minmax(0, 1fr); }
.gp-more { display: flex; align-items: center; justify-content: center; border-radius: 2px; background: color-mix(in srgb, var(--b-primary) 10%, transparent); font-size: 8px; font-weight: 600; }

/* Brand overview */
.hero { display: flex; flex-wrap: wrap; gap: 24px; align-items: center; margin-bottom: 24px; }
.hero-mark { width: 180px; height: 180px; border-radius: 28px; background: var(--b-paper); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; padding: 20px; flex: none; color: var(--b-primary); font-weight: 700; font-size: 22px; text-align: center; }
.hero-mark img { max-width: 100%; max-height: 100%; object-fit: contain; }
.hero-text { flex: 1 1 320px; min-width: 0; }
.hero-text .lede { margin-bottom: 14px; }
.strip { display: flex; height: 18px; border-radius: 9px; overflow: hidden; border: 1px solid rgba(0,0,0,.05); }
.hero-strip { max-width: 420px; }
.overview-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.status-card { display: flex; flex-direction: column; gap: 10px; margin: 0; }
.status-card .btn { align-self: flex-start; text-decoration: none; margin-top: auto; }
.status-head { display: flex; justify-content: space-between; align-items: center; }
.status-head h2 { margin: 0; }
.status-row { display: flex; gap: 10px; align-items: center; font-size: 14px; padding: 4px 0; border-bottom: 1px solid #F2F2F7; }
.status-row > span:nth-child(2) { flex: 1; }
.status-row .dot { width: 10px; height: 10px; }
.dot.ok { background: #34C759; } .dot.todo { background: #FF9F0A; }
.guide-thumb { aspect-ratio: 16/9; border-radius: 10px; display: flex; flex-direction: column; justify-content: space-between; padding: 16px; text-decoration: none; box-shadow: 0 8px 24px rgba(0,0,0,.1); }
.guide-thumb img { max-height: 40%; max-width: 60%; object-fit: contain; align-self: flex-start; }
.guide-thumb b { font-size: 22px; }
.guide-thumb small { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; }

/* Brand guide document: 16:9 sheets that scale with their width (cqw units) and print one per page */
.guide-bar { max-width: 1200px; margin: 0 auto; padding: 28px 24px 8px; display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; justify-content: space-between; }
.guide-bar h1 { margin: 0; }
.guide { max-width: 1200px; margin: 0 auto; padding: 16px 24px 60px; display: flex; flex-direction: column; gap: 28px; }
.sheet { container-type: inline-size; aspect-ratio: 16/9; background: var(--g-paper); color: var(--g-primary); border-radius: 6px; box-shadow: 0 10px 30px rgba(0,0,0,.08); padding: 3.2cqw 3.6cqw; display: flex; flex-direction: column; gap: 2cqw; overflow: hidden; font-family: var(--g-body), Inter, sans-serif; font-size: 1.15cqw; line-height: 1.45; }
.sheet.dark { background: var(--g-primary); color: var(--g-paper); }
.sheet p { margin: 0; color: var(--g-ink); }
.sheet.dark p { color: inherit; }
.g-head, .g-foot { display: flex; gap: 4cqw; font-size: .8cqw; letter-spacing: .16em; text-transform: uppercase; font-weight: 600; }
.g-no { margin-left: auto; }
.g-foot { justify-content: space-between; margin-top: auto; font-size: .7cqw; }
.g-label { display: block; font-size: .72cqw; letter-spacing: .16em; text-transform: uppercase; font-weight: 600; opacity: .7; margin-bottom: .4cqw; }
.g-small { font-size: .95cqw; }
.g-lead { font-size: 2cqw; line-height: 1.25; color: var(--g-primary) !important; }
.g-title { margin: 0; color: var(--g-primary); line-height: 1.05; }
.g-cover { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; }
.g-cover .g-logo { max-height: 22cqw; max-width: 50cqw; }
.g-cover-foot { margin-top: auto; width: 100%; display: flex; justify-content: space-between; font-size: .9cqw; letter-spacing: .16em; text-transform: uppercase; font-weight: 600; }
.g-cover .g-cover-foot:first-child { margin-top: 0; }
.g-logo { display: block; max-width: 100%; height: auto; object-fit: contain; }
.g-wordmark { font-weight: 700; letter-spacing: .02em; line-height: 1; }
.g-thanks { font-size: 7cqw; font-weight: 700; margin-top: auto; }
.g-divider { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; }
.g-divider span { font-size: 2cqw; opacity: .7; }
.g-divider b { font-family: var(--g-display), Inter, sans-serif; font-size: 7cqw; line-height: 1; }
.g-contents { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 4cqw; align-content: center; }
.g-contents b { display: block; font-family: var(--g-display), Inter, sans-serif; font-size: 2.4cqw; margin: .4cqw 0 1cqw; }
.g-contents ol { margin: 0; padding-left: 1.4em; font-size: 1.3cqw; line-height: 1.8; color: var(--g-ink); }
.g-big { font-size: 1.2cqw; opacity: .6; }
.g-split { flex: 1; display: flex; gap: 4cqw; min-height: 0; }
.g-side { width: 30%; display: flex; flex-direction: column; gap: 1.2cqw; }
.g-fields { flex: 1; display: flex; flex-direction: column; gap: 1.6cqw; justify-content: center; }
.g-values { display: flex; flex-wrap: wrap; gap: .6cqw; }
.g-values span { background: var(--g-accent); color: var(--g-paper); border-radius: 2cqw; padding: .3cqw 1.1cqw; font-weight: 600; font-size: 1cqw; }
.g-cols { flex: 1; display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 3cqw; align-content: end; }
.g-cols h3 { margin: .4cqw 0 .8cqw; color: var(--g-primary); }
.g-num { color: var(--g-accent); font-weight: 700; }
.g-table { flex: 1; display: flex; flex-direction: column; }
.g-tr { display: grid; grid-template-columns: 3cqw 1fr 1.7fr; gap: 1.6cqw; padding: 1cqw 0; border-bottom: 1px solid color-mix(in srgb, var(--g-primary) 18%, transparent); color: var(--g-ink); }
.g-th { font-size: .72cqw; letter-spacing: .16em; text-transform: uppercase; font-weight: 600; color: var(--g-primary); border-bottom-color: var(--g-accent); }
.g-one { font-size: 1.6cqw; line-height: 1.2; color: var(--g-primary); font-family: var(--g-display), Inter, sans-serif; }
.g-pillars { flex: 1.2; display: flex; flex-direction: column; gap: 1.4cqw; }
.g-pillars b { font-size: 1.3cqw; }
.g-sliders { flex: 1; display: flex; flex-direction: column; gap: 1.6cqw; justify-content: center; }
.g-slider > div:first-child { display: flex; justify-content: space-between; font-size: 1cqw; color: var(--g-ink); }
.g-track { position: relative; height: .2cqw; background: color-mix(in srgb, var(--g-primary) 18%, transparent); margin-top: .6cqw; }
.g-track i { position: absolute; top: -.6cqw; width: 1.4cqw; height: 1.4cqw; margin-left: -.7cqw; border-radius: 50%; background: var(--g-accent); }
.g-logo-main { flex: 1.2; display: flex; flex-direction: column; gap: 1.5cqw; justify-content: center; align-items: center; background: #fff; border-radius: .6cqw; padding: 2cqw; }
.g-logo-main .g-logo { max-height: 9cqw; max-width: 30cqw; }
.g-clear { border: 1px dashed var(--g-accent); }
.g-logo-on { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 1cqw; }
.g-logo-on > div { border-radius: .5cqw; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .6cqw; padding: 1.2cqw; border: 1px solid rgba(0,0,0,.05); }
.g-logo-on .g-logo { max-height: 5cqw; max-width: 80%; }
.g-logo-on small { font-size: .75cqw; letter-spacing: .1em; text-transform: uppercase; }
.g-misuse { flex: 1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.6cqw; }
.g-misuse > div { background: #fff; border-radius: .5cqw; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2cqw; overflow: hidden; border: 1px solid rgba(0,0,0,.05); }
.g-misuse > div > span { display: block; }
.g-misuse .g-logo { max-height: 5cqw; max-width: 16cqw; }
.g-misuse small { color: #C4161C; font-weight: 700; font-size: .85cqw; letter-spacing: .1em; text-transform: uppercase; }
.g-palette { flex: 1; display: flex; min-height: 0; border-radius: .4cqw; overflow: hidden; }
.g-palette > div { padding: 1.2cqw; display: flex; flex-direction: column; gap: .3cqw; font-size: .8cqw; letter-spacing: .08em; text-transform: uppercase; border: .5px solid rgba(0,0,0,.05); }
.g-palette b { font-size: .95cqw; letter-spacing: .12em; margin-bottom: .4cqw; }
.g-palette em { margin-top: auto; font-style: normal; opacity: .8; }
.g-type { flex: 1; display: flex; gap: 3cqw; min-height: 0; }
.g-specimen { flex: 1; display: flex; flex-direction: column; gap: 1.1cqw; justify-content: center; min-width: 0; }
.g-specimen > div > div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.15; color: var(--g-primary); }
.g-aa { width: 32%; background: var(--g-primary); color: var(--g-paper); border-radius: .5cqw; display: flex; align-items: center; justify-content: center; font-size: 14cqw; }
.g-imagery { flex: 1; display: flex; gap: 3cqw; min-height: 0; }
.g-cats { width: 28%; display: flex; flex-direction: column; gap: 1.2cqw; }
.g-cats b { font-size: 1.2cqw; }
.g-photos { flex: 1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: minmax(0, 1fr); gap: 1cqw; min-height: 0; }
.g-photos figure { margin: 0; display: flex; flex-direction: column; gap: .4cqw; min-height: 0; }
.g-photos img { flex: 1; min-height: 0; width: 100%; object-fit: cover; border-radius: .3cqw; }
.g-photos figcaption { font-size: .7cqw; letter-spacing: .12em; text-transform: uppercase; font-weight: 600; }
.g-empty { border: 1px dashed currentColor; border-radius: .5cqw; padding: 1.2cqw; opacity: .7; font-size: 1cqw; }

@media print {
  @page { size: 297mm 167mm; margin: 0; }
  body { background: #fff; }
  .topbar, .no-print, .toast { display: none !important; }
  .guide { max-width: none; padding: 0; gap: 0; }
  .sheet { width: 297mm; height: 167mm; aspect-ratio: auto; border-radius: 0; box-shadow: none; break-after: page; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Brand home (Canva-style) */
.home { max-width: 1240px; margin: 0 auto; padding: 24px 24px 60px; }
.home-hero { position: relative; border-radius: 22px; padding: 44px 40px; display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; min-height: 170px; }
.home-hero h1 { font-size: 36px; margin: 0; max-width: 720px; }
.home-hero-logo { display: block; max-height: 56px; max-width: 220px; margin-bottom: 14px; }
.big-plus { flex: none; width: 92px; height: 92px; border-radius: 50%; border: 0; background: #fff; font-size: 54px; font-weight: 300; line-height: 1; cursor: pointer; box-shadow: 0 10px 30px rgba(0,0,0,.25); transition: transform .2s; display: flex; align-items: center; justify-content: center; }
.big-plus:hover { transform: scale(1.05); }
.big-plus.open { transform: rotate(45deg); }
.big-plus:focus-visible { outline: 3px solid #fff; outline-offset: 4px; }
.create-menu { display: none; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin: 16px 0 0; }
.create-menu.open { display: grid; }
.format { font: inherit; text-align: left; border: 1px solid var(--line); background: var(--panel); border-radius: 16px; padding: 14px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; color: var(--text); }
.format:hover, .format:focus-visible { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,113,227,.15); outline: none; }
.format-shape { height: 72px; display: flex; align-items: center; justify-content: center; margin-bottom: 6px; }
.format-shape i { display: block; background: var(--blue-tint); border: 2px solid var(--blue); border-radius: 4px; }
.format-name { font-weight: 600; font-size: 14px; }
.format-sub { font-size: 12px; color: var(--muted); }
.format.custom { cursor: default; gap: 8px; }
.custom-fields { display: flex; align-items: center; gap: 6px; }
.custom-fields input { padding: 6px 8px; }
.shelf { margin-top: 32px; }
.shelf-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.shelf-head h2 { font-size: 20px; margin: 0; }
.shelf-row { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 6px; }
.shelf-tile { flex: none; width: 200px; font: inherit; text-decoration: none; color: var(--text); display: flex; flex-direction: column; gap: 4px; border: 0; background: transparent; padding: 0; cursor: pointer; text-align: left; }
.plus-tile { height: 200px; border: 2px dashed var(--line-strong); border-radius: 16px; align-items: center; justify-content: center; color: #0066CC; font-weight: 600; gap: 6px; }
.plus-tile span { font-size: 44px; font-weight: 300; line-height: 1; }
.plus-tile:hover { border-color: var(--blue); background: #F5F9FF; }
.design-thumb { height: 200px; border-radius: 14px; background: var(--sunk); display: flex; align-items: center; justify-content: center; overflow: hidden; padding: 10px; }
.design-thumb img { max-width: 100%; max-height: 100%; box-shadow: 0 4px 14px rgba(0,0,0,.12); border-radius: 3px; }
.image-tile { width: 160px; height: 160px; border-radius: 14px; overflow: hidden; background: var(--sunk); }
.image-tile img { width: 100%; height: 100%; object-fit: cover; }
.image-tile.is-logo { background: #fff; border: 1px solid var(--line); }
.image-tile.is-logo img { object-fit: contain; padding: 16px; }
.image-tile + .image-tile, .plus-tile + .image-tile { }
.shelf-row .image-tile, .shelf-row .plus-tile[data-open-library] { width: 160px; height: 160px; }
.empty-tile { width: auto; max-width: 520px; border: 1px dashed var(--line-strong); border-radius: 16px; padding: 22px; cursor: default; gap: 6px; }
.doc-tile { width: 260px; }
.doc-cover { aspect-ratio: 16/10; border-radius: 14px; display: flex; flex-direction: column; justify-content: space-between; padding: 16px; overflow: hidden; box-shadow: 0 6px 18px rgba(0,0,0,.08); }
.doc-cover.light { background: var(--panel); border: 1px solid var(--line); color: var(--text); box-shadow: none; }
.doc-cover img { max-height: 40%; max-width: 60%; object-fit: contain; align-self: flex-start; }
.doc-cover b { font-size: 20px; }
.doc-cover small { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; }
.doc-progress { display: block; height: 6px; border-radius: 3px; background: var(--sunk); overflow: hidden; }
.doc-progress i { display: block; height: 100%; background: #34C759; }

/* Design page */
.back-link { display: inline-block; margin-bottom: 14px; color: var(--muted); text-decoration: none; }
.design-layout { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.design-stage { flex: 999 1 480px; background: var(--sunk); border-radius: 18px; padding: 28px; display: flex; justify-content: center; }
.design-stage img { max-width: 100%; max-height: 72vh; box-shadow: 0 10px 30px rgba(0,0,0,.15); }
.design-side { flex: 1 1 280px; margin: 0; }
.design-side .btn { text-align: center; text-decoration: none; }
.notice { font-size: 13px; line-height: 1.5; background: var(--blue-tint); color: var(--blue-ink); border-radius: 10px; padding: 10px 12px; }

/* Story chapter photo picker */
.chapter-body { display: flex; gap: 12px; align-items: stretch; }
.chapter-body textarea { flex: 1; }
.chapter-photo { position: relative; flex: none; width: 96px; min-height: 86px; border: 1px dashed #A1A1A6; border-radius: 10px; background: transparent; color: #0066CC; font: inherit; font-size: 12px; cursor: pointer; padding: 0; overflow: hidden; }
.chapter-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.chapter-photo-clear { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 11px; }
.g-story { flex: 1; display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); grid-template-rows: minmax(0, 1fr) auto; column-gap: 3cqw; row-gap: 1.6cqw; min-height: 0; }
.g-story img { width: 100%; height: 100%; min-height: 0; object-fit: cover; border-radius: .4cqw; }
.g-story h3 { margin: .4cqw 0 .8cqw; color: var(--g-primary); }
.g-story-title { grid-column: 1 / -1; align-self: center; }

/* Guide v2: half-page photos, roomier logos, messages that fit */
.sheet.half { flex-direction: row; padding: 0; gap: 0; }
.sheet.half > .g-half-text { flex: 1; min-width: 0; padding: 3.2cqw 3.6cqw; display: flex; flex-direction: column; gap: 1.6cqw; }
.sheet.half.no-img > .g-half-text { flex: 1; }
.g-half-img { width: 50%; flex: none; overflow: hidden; }
.g-half-img img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; display: block; }
.sheet.half .g-fields { justify-content: flex-start; gap: 1.3cqw; }
.sheet.half .g-lead { font-size: 1.7cqw; }
.sheet.half .g-pillars { flex: none; gap: 1cqw; }
.sheet.half .g-pillars b { font-size: 1.15cqw; }
.sheet.half .g-pillars p { font-size: 1.05cqw; }
.sheet.half .g-sliders { flex: none; gap: 1cqw; margin-top: .6cqw; }
.g-cover { justify-content: space-between; }
.g-cover .g-logo { max-height: 18cqw; max-width: 34cqw; margin-top: 6cqw; }
.g-divider { justify-content: flex-end; }
.g-divider b { font-size: 5.5cqw; }

/* story: landscape-ish frames so less of each photo is cropped */
.g-story { grid-template-rows: 22cqw auto; align-content: start; }
.g-story img { object-position: 50% 25%; }
.g-story.no-pics { grid-template-rows: minmax(0, 1fr) auto; }

/* messages: rows share the height; type scales by --msg */
.g-table { justify-content: flex-start; }
.g-tr { padding: calc(1cqw * var(--msg, 1)) 0; font-size: calc(1.05cqw * var(--msg, 1)); line-height: 1.4; align-items: baseline; }
.g-th { font-size: .72cqw; }
.g-one { font-size: calc(1.45cqw * var(--msg, 1)); }
.g-exp { color: var(--g-ink); }

/* logos big enough to read */
.g-logo-main .g-logo { max-height: 16cqw; max-width: 34cqw; }
.g-logo-on .g-logo { max-height: 9cqw; max-width: 70%; }
.g-logo-on small { margin-top: .6cqw; }
.g-misuse .g-logo { max-height: 11cqw; max-width: 17cqw; }

/* imagery: a hero photo plus a grid */
.g-photos { grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); }
.g-photos .g-hero { grid-column: span 2; grid-row: span 2; }
.g-photos[style*="--n: 1"] .g-hero { grid-column: 1 / -1; }
.g-photos img { object-position: 50% 30%; }

/* Guide v3: subject-aware photos are background crops */
.g-ph, .g-half-img, .g-bleed, .cover-photo { background-repeat: no-repeat; background-color: color-mix(in srgb, var(--g-primary) 12%, transparent); }
.g-ph { width: 100%; height: 100%; min-height: 0; border-radius: .4cqw; }
.g-photos figure .g-ph { flex: 1; }
.g-half-img { height: 100%; }
.guide-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.guide-actions .label { margin: 0; }

/* Cover A: photo first */
.sheet.cover-a { position: relative; padding: 0; }
.cover-a .g-bleed { position: absolute; inset: 0; }
.cover-a .cover-panel { position: absolute; left: 4cqw; top: 4cqw; bottom: 4cqw; width: 30cqw; background: var(--g-primary); color: var(--g-paper); border-radius: .8cqw; padding: 3.4cqw; display: flex; flex-direction: column; justify-content: space-between; }
.cover-a .g-logo { max-width: 100%; max-height: 20cqw; }
/* Cover B: centred and calm */
.sheet.cover-b { padding: 0; gap: 0; }
.cover-b .cover-centre { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.6cqw; }
.cover-b .g-logo { max-height: 22cqw; max-width: 40cqw; }
.cover-b .cover-strip { height: 32%; display: grid; grid-template-columns: repeat(4, 1fr); gap: .3cqw; }
.cover-b .cover-strip .g-ph { border-radius: 0; }
/* Cover C: editorial */
.sheet.cover-c { padding: 0; gap: 0; }
.cover-c .cover-photo { height: 58%; }
.cover-c .cover-band { flex: 1; background: var(--g-primary); color: var(--g-paper); padding: 2.6cqw 3.6cqw; display: flex; flex-direction: column; justify-content: space-between; }
.cover-c h1 { margin: 0; line-height: 1; color: var(--g-paper); }
.cover-c .cover-meta { display: flex; justify-content: space-between; align-items: flex-end; font-size: .9cqw; letter-spacing: .16em; text-transform: uppercase; font-weight: 600; color: var(--g-accent); }
.cover-c .cover-meta .g-logo { max-height: 5cqw; max-width: 14cqw; }

/* Typography: bigger specimens */
.g-specimen { gap: 1.5cqw; }
.g-specimen .g-label { font-size: .75cqw; margin-bottom: .3cqw; }
.g-aa { width: 26%; flex-direction: column; gap: 1cqw; }
.g-aa span { font-size: 12cqw; line-height: 1; }
.g-aa small { font-size: .85cqw; letter-spacing: .14em; text-transform: uppercase; opacity: .75; }

/* Subject area editor (media library) */
.subject-stage { position: relative; margin: 0 auto; border-radius: 8px; overflow: hidden; cursor: crosshair; touch-action: none; user-select: none; background: var(--sunk); }
.subject-stage img { width: 100%; height: 100%; display: block; pointer-events: none; }
.subject-box { position: absolute; border: 2px solid #fff; box-shadow: 0 0 0 9999px rgba(0,0,0,.45); border-radius: 4px; pointer-events: none; }
.subject-box.unset { border-style: dashed; box-shadow: 0 0 0 9999px rgba(0,0,0,.2); }
.fit-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.fit { font-size: 11px; font-weight: 600; border-radius: 6px; padding: 2px 7px; }
.fit.ok { background: var(--green-tint); color: #1B6B30; }
.fit.no { background: var(--red-tint); color: #A3161B; }
.link-btn { border: 0; background: none; color: #0066CC; font: inherit; padding: 0; cursor: pointer; text-decoration: underline; }

/* Full-screen subject editor */
.subject-editor { position: fixed; inset: 0; z-index: 60; background: #111214; color: #F5F5F7; display: flex; flex-direction: column; }
.se-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 20px; border-bottom: 1px solid #2A2B2F; flex-wrap: wrap; }
.se-head h2 { margin: 0; font-size: 17px; }
.se-head .hint { color: #A1A1A6; margin: 2px 0 0; }
.se-actions { display: flex; gap: 8px; }
.subject-editor .btn:not(.primary) { background: #2A2B2F; border-color: #3A3B40; color: #F5F5F7; }
.se-body { flex: 1; display: flex; min-height: 0; }
.se-stage-wrap { flex: 1; min-width: 0; min-height: 0; overflow: hidden; padding: 28px; display: flex; align-items: center; justify-content: center; }
.se-stage { position: relative; touch-action: none; user-select: none; cursor: crosshair; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.se-stage img { width: 100%; height: 100%; display: block; pointer-events: none; }
.se-box { position: absolute; border: 2px solid #fff; box-shadow: 0 0 0 9999px rgba(0,0,0,.55); cursor: move; }
.se-box.unset { border-style: dashed; box-shadow: 0 0 0 9999px rgba(0,0,0,.25); }
.se-box.unset .se-h { display: none; }
.se-stage { overflow: hidden; }
.se-h { position: absolute; width: 14px; height: 14px; background: #fff; border-radius: 3px; box-shadow: 0 1px 4px rgba(0,0,0,.5); }
.se-h.nw { left: -8px; top: -8px; cursor: nwse-resize; } .se-h.ne { right: -8px; top: -8px; cursor: nesw-resize; }
.se-h.sw { left: -8px; bottom: -8px; cursor: nesw-resize; } .se-h.se { right: -8px; bottom: -8px; cursor: nwse-resize; }
.se-h.n { left: calc(50% - 7px); top: -8px; cursor: ns-resize; } .se-h.s { left: calc(50% - 7px); bottom: -8px; cursor: ns-resize; }
.se-h.w { top: calc(50% - 7px); left: -8px; cursor: ew-resize; } .se-h.e { top: calc(50% - 7px); right: -8px; cursor: ew-resize; }
.se-side { width: 300px; flex: none; border-left: 1px solid #2A2B2F; padding: 18px; overflow: auto; display: flex; flex-direction: column; gap: 12px; }
.se-side h3 { margin: 0; color: #F5F5F7; }
.se-side .hint { color: #A1A1A6; }
.se-previews { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: end; }
.se-previews figure { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.se-crop { width: 100%; max-height: 180px; background-repeat: no-repeat; border-radius: 4px; background-color: #222; }
.se-previews figure:has(.se-crop[style*="aspect-ratio:0.5625"]) .se-crop { width: 60%; }
.se-previews figcaption { font-size: 12px; font-weight: 600; color: #8FE3A8; }
.se-previews figure.no .se-crop { opacity: .35; }
.se-previews figure.no figcaption { color: #FF8A8A; }
@media (max-width: 760px) { .se-body { flex-direction: column; } .se-side { width: auto; border-left: 0; border-top: 1px solid #2A2B2F; } }

.se-range { font-size: 13px; color: #F5F5F7; margin: 0; line-height: 1.45; }
.fit-range { flex-basis: 100%; margin: 4px 0 0; }

/* Covers on the brand's background colour */
.cover-a .cover-panel { background: var(--g-paper); color: var(--g-primary); box-shadow: 0 1cqw 3cqw rgba(0,0,0,.18); }
.cover-a .cover-panel .g-logo { margin: 0 auto; }
.cover-c .cover-photo { height: auto; flex: none; aspect-ratio: 16 / 5.6; }
.cover-c .cover-band { background: var(--g-paper); color: var(--g-primary); }
.cover-c h1 { color: var(--g-primary); }
.cover-c .cover-meta { color: var(--g-primary); }
.cover-c .cover-meta .g-logo { max-height: 7cqw; max-width: 18cqw; }

/* Photos whose subject can't fill a frame: whole subject over a blurred backdrop */
.g-fit { position: relative; overflow: hidden; background: none !important; }
.g-fit-bg { position: absolute; inset: -8%; background-repeat: no-repeat; }
.g-fit-fg { position: absolute; inset: 0; background-repeat: no-repeat; }

.guide-note { margin: 0 0 -12px; font-size: 13px; line-height: 1.5; background: var(--amber-tint); color: var(--amber); border-radius: 10px; padding: 10px 14px; }

/* Back page credit (quiet footer) */
.g-back { flex: 1; display: flex; align-items: center; }
.g-back .g-thanks { margin: 0; line-height: 1; }
.g-credit { border-top: 1px solid color-mix(in srgb, var(--g-paper) 25%, transparent); padding-top: 1.6cqw; display: flex; justify-content: space-between; align-items: flex-end; gap: 3cqw; }
.g-studio { display: flex; align-items: center; gap: .9cqw; margin: .3cqw 0 .4cqw; }
.g-studio b { font-size: 1.5cqw; letter-spacing: -.01em; }
.g-studio-dot { flex: none; width: 1.1cqw; height: 1.1cqw; border-radius: 50%; box-shadow: 0 0 0 .3cqw rgba(37,99,235,.3); }
.sheet.dark p.g-studio-line { font-size: 1cqw; opacity: .8; max-width: 44cqw; }
.g-studio-contact { font-size: .95cqw; line-height: 1.6; opacity: .8; text-align: right; }

.g-studio-right { display: flex; align-items: flex-end; gap: 1.6cqw; }
.g-qr { width: 7.5cqw; height: 7.5cqw; border-radius: .5cqw; display: block; }

/* Dark pages use the palette's darkest/lightest pair, so dark brands still get contrast */
.sheet.dark { background: var(--g-deep); color: var(--g-light); }
.sheet.dark .g-credit { border-top-color: color-mix(in srgb, var(--g-light) 25%, transparent); }

/* Guide v4: photos fill frames, dark-brand fixes */
.g-photo { position: relative; overflow: hidden; background: none !important; }
.g-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.g-photos figure .g-photo { flex: 1; min-height: 0; border-radius: .4cqw; }
.g-story .g-photo { border-radius: .4cqw; }
/* logo pages sit on the brand's own background, not hard white */
.g-logo-main { background: var(--g-paper); border: 1px solid color-mix(in srgb, var(--g-primary) 14%, transparent); }
.g-logo-main .g-small { color: var(--g-ink) !important; }
.g-misuse > div { background: var(--g-paper); border-color: color-mix(in srgb, var(--g-primary) 14%, transparent); }
.g-misuse .g-wordmark { font-size: 2cqw !important; white-space: nowrap; }
/* swatches the same colour as the page still show their edge */
.g-palette > div { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--g-primary) 16%, transparent); }
.g-qr { background: var(--g-light); padding: .4cqw; box-sizing: content-box; }

/* text tones (Identity::tones): labels in the muted grey, panels on the raised surface, rules in the line colour */
.g-head, .g-foot, .g-label, .g-th, .g-big, .g-cover-foot, .g-photos figcaption, .g-aa small { color: var(--g-muted); opacity: 1; }
.g-head span:first-child { color: var(--g-accent); }
.sheet.dark .g-head, .sheet.dark .g-foot, .sheet.dark .g-label { color: inherit; opacity: .7; }
.g-tr { border-bottom-color: var(--g-line); }
.g-th { border-bottom-color: var(--g-accent); }
.g-track { background: var(--g-line); }
.g-aa { background: var(--g-surface); color: var(--g-on-surface); }
.g-aa small { color: var(--g-on-surface); opacity: .7; }
.g-logo-main, .g-misuse > div { border-color: var(--g-line); }

/* brand on a page: purpose, audience and promise share one size, colour and rhythm */
.sheet .g-fields > div > p:not(.g-values) { font-size: 1.45cqw; line-height: 1.4; color: var(--g-ink); max-width: 46em; }
.sheet.half .g-fields { gap: 1.6cqw; }

/* cover settings popover */
.cover-settings { position: relative; }
.cover-settings > summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.cover-settings > summary::-webkit-details-marker { display: none; }
.cover-settings-pop { position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; width: 260px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,.14); padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.cover-swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.cover-swatches button { width: 30px; height: 30px; border-radius: 50%; border: 1px solid rgba(0,0,0,.15); cursor: pointer; padding: 0; }
.cover-swatches button[aria-checked="true"] { outline: 2px solid #0071E3; outline-offset: 2px; }
.cover-toggle { display: flex; align-items: center; gap: 8px; font-size: 13px; flex-wrap: wrap; }
.cover-toggle small { color: var(--muted); width: 100%; padding-left: 24px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* covers: panel / band take the chosen colour and its own text tones */
.cover-a .cover-panel, .cover-c .cover-band, .sheet.cover-b { background: var(--c-bg); color: var(--c-head); }
.cover-a .cover-panel .g-logo { margin: 0; max-height: 9cqw; max-width: 100%; }
.cover-title { display: flex; flex-direction: column; gap: 1.2cqw; margin-top: auto; margin-bottom: 3cqw; }
.cover-rule { display: block; width: 3.4cqw; height: .22cqw; background: var(--g-accent); }
.cover-title h1 { margin: 0; line-height: 1; color: var(--c-head); }
.sheet .cover-title p { margin: 0; font-size: 1.25cqw; line-height: 1.45; color: var(--c-body); }
.cover-a .g-cover-foot, .cover-b .g-label { color: var(--c-muted); }
.cover-a.swap .cover-panel { left: auto; right: 4cqw; }
.cover-b .cover-tagline { margin: 0; text-align: center; color: var(--c-head); max-width: 60cqw; line-height: 1.15; }
.cover-b.swap { flex-direction: column-reverse; }
.cover-c h1, .cover-c .cover-meta { color: var(--c-head); }
.cover-c.swap { flex-direction: column-reverse; }

/* cover settings: grouped rows */
.cover-settings-pop { width: 300px; gap: 16px; padding: 16px; }
.cs-group { display: flex; flex-direction: column; gap: 8px; }
.cs-group + .cs-group { border-top: 1px solid var(--line); padding-top: 14px; }
.cs-label { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.cover-settings-pop .segmented { display: flex; }
.cover-settings-pop .segmented button { flex: 1; padding: 6px 8px; }
.cs-input { font-size: 13px; padding: 7px 10px; border-radius: 8px; }
.cs-hint { font-size: 11px; color: var(--muted); line-height: 1.4; }
label.cs-check { display: flex; align-items: flex-start; gap: 8px; margin: 0; font-size: 13px; font-weight: 500; color: var(--text); cursor: pointer; }
.cs-check input { width: 16px; height: 16px; margin: 2px 0 0; padding: 0; flex: none; accent-color: var(--blue); }
.cs-check small { display: block; font-size: 11px; font-weight: 400; color: var(--muted); margin-top: 2px; }

/* editorial cover: tagline reads as a headline, not a billboard */
.cover-c .cover-c-title { max-width: 62%; line-height: 1.08; text-wrap: balance; }

/* editorial cover v2: photo takes the space, one balanced band underneath —
   eyebrow + headline on the left, logo on the right, both sitting on the same bottom line */
.sheet.cover-c .cover-photo { flex: 1; height: auto; aspect-ratio: auto; min-height: 0; }
.sheet.cover-c .cover-band { flex: none; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; column-gap: 6cqw; padding: 3.4cqw 3.6cqw; }
.cover-band-text { display: flex; flex-direction: column; gap: 1.4cqw; }
.cover-eyebrow { display: flex; align-items: center; gap: 1cqw; font-size: .85cqw; letter-spacing: .2em; text-transform: uppercase; font-weight: 600; color: var(--c-muted); }
.cover-eyebrow .cover-rule { width: 2.4cqw; }
.cover-c .cover-c-title { margin: 0; max-width: 58cqw; }
.sheet.cover-c .cover-band .g-logo { max-height: 4.6cqw; max-width: 20cqw; margin-bottom: .4cqw; }

/* cover settings: chosen photo */
.cs-photo { display: flex; gap: 10px; align-items: center; }
.cs-photo img, .cs-auto { width: 64px; height: 44px; border-radius: 6px; object-fit: cover; flex: none; }
.cs-auto { display: flex; align-items: center; justify-content: center; background: var(--sunk); font-size: 11px; color: var(--muted); }
.cs-photo b { display: block; font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 190px; }
.cs-photo-actions { display: flex; gap: 10px; }

/* create dialog (the big +) */
.create-dialog { width: min(880px, calc(100vw - 32px)); max-height: min(720px, calc(100vh - 48px)); padding: 0; border: 0; border-radius: 18px; background: var(--panel); color: var(--text); box-shadow: 0 30px 80px rgba(0,0,0,.3); display: none; flex-direction: column; overflow: hidden; }
.create-dialog[open] { display: flex; }
.create-dialog::backdrop { background: rgba(0,0,0,.35); backdrop-filter: blur(4px); }
.create-head { display: flex; align-items: center; gap: 16px; padding: 18px 20px; border-bottom: 1px solid var(--line); margin: 0; }
.create-head h2 { margin: 0; font-size: 20px; }
.create-head .segmented { margin-right: auto; }
.create-head .count { font-size: 11px; color: var(--muted); margin-left: 2px; }
.icon-btn { border: 0; background: var(--sunk); width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 13px; color: var(--text-2); }
.create-body { flex: 1; overflow: auto; padding: 20px; }
.create-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.create-grid .format[aria-checked="true"] { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,113,227,.2); background: var(--blue-tint, #EAF3FF); }
.create-grid .format.custom { cursor: pointer; }
.create-grid.templates { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.template-thumb { height: 150px; display: flex; align-items: center; justify-content: center; background: var(--sunk); border-radius: 10px; margin-bottom: 8px; overflow: hidden; }
.template-thumb img { max-width: 100%; max-height: 100%; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.create-empty { text-align: center; padding: 48px 20px; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.create-empty .hint { max-width: 380px; }
.create-foot { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--bg); }
.create-foot .hint { margin: 0 auto 0 0; }
.tag { align-self: flex-start; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); background: var(--sunk); border-radius: 6px; padding: 3px 8px; }

/* shelf headers: compact actions on the right */
.shelf-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.shelf-actions .btn span[aria-hidden] { font-size: 16px; line-height: 1; margin-right: 2px; }
.shelf-empty { margin: 0; padding: 8px 0 4px; }

/* ===================== design editor ===================== */
body:has(.ed) { overflow: hidden; height: 100vh; display: flex; flex-direction: column; }
body:has(.ed) > .topbar { flex: none; }
.ed { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--bg); }
.ed-bar { flex: none; display: flex; align-items: center; gap: 12px; padding: 8px 14px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.ed-back { color: var(--muted); text-decoration: none; font-size: 13px; white-space: nowrap; }
.ed-sep { width: 1px; height: 20px; background: var(--line); }
.ed-name { width: auto; min-width: 140px; max-width: 280px; border-color: transparent; background: transparent; font-weight: 600; padding: 6px 8px; }
.ed-name:hover { border-color: var(--line); }
.ed-kind { font-size: 12px; color: var(--muted); white-space: nowrap; }
.ed-modes { margin-left: auto; }
.ed-tools { display: flex; align-items: center; gap: 8px; }
.ed-tools .btn { min-height: 34px; padding: 6px 14px; font-size: 13px; }
.ed-tools .icon-btn { display: inline-flex; align-items: center; justify-content: center; }
.ed-status { font-size: 12px; color: var(--muted); min-width: 64px; text-align: right; }
.ed-more { position: relative; }
.ed-more > summary { list-style: none; display: flex; align-items: center; justify-content: center; }
.ed-more > summary::-webkit-details-marker { display: none; }
.ed-more-pop { position: absolute; right: 0; top: calc(100% + 6px); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,.14); padding: 8px; z-index: 30; white-space: nowrap; }

.ed-body { flex: 1; min-height: 0; display: flex; }
.ed-left { flex: 0 0 260px; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.ed.is-fill .ed-left { display: none; }
.ed-right { flex: 0 0 320px; background: var(--panel); border-left: 1px solid var(--line); overflow-y: auto; }

.ed-add-wrap { position: relative; padding: 12px; }
.ed-add { width: 100%; height: 38px; border: 0; border-radius: 10px; background: var(--text); color: #fff; font: inherit; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; }
.ed-add span { font-size: 18px; line-height: 1; }
.ed-add-menu { position: absolute; left: 12px; right: 12px; top: 56px; z-index: 20; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 18px 40px rgba(0,0,0,.16); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.ed-add-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-bottom: 4px; }
.ed-add-grid.text { grid-template-columns: 1fr; gap: 2px; }
.ed-add-item { font: inherit; font-size: 12px; border: 1px solid var(--line); background: var(--panel); border-radius: 9px; padding: 9px 8px; cursor: pointer; text-align: left; color: var(--text); }
.ed-add-item:hover { border-color: var(--blue); background: var(--blue-tint); }
.ed-add-grid.text .ed-add-item { border: 0; background: transparent; }
.ed-add-grid.text .ed-add-item:hover { background: var(--sunk); }
.ed-add-item.k-display { font-size: 16px; font-weight: 700; }
.ed-add-item.k-title { font-size: 14px; font-weight: 600; }
.ed-add-item.k-caption { font-size: 10px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; }

.ed-panel-head { display: flex; justify-content: space-between; align-items: baseline; padding: 4px 14px 6px; }
.ed-panel-head > span:first-child, .ed-label { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.ed-panel-head .hint { margin: 0; font-size: 11px; }
.ed-layers { flex: 1; overflow-y: auto; padding: 0 8px 8px; }
.ed-layer { display: flex; align-items: center; gap: 6px; padding: 5px 6px 5px calc(6px + var(--depth) * 16px); border-radius: 8px; cursor: pointer; font-size: 13px; min-height: 32px; }
.ed-layer:hover { background: var(--sunk); }
.ed-layer.on { background: var(--blue-tint); }
.ed-twisty { width: 18px; height: 18px; border: 0; background: none; padding: 0; cursor: pointer; color: var(--muted); font-size: 11px; flex: none; }
.ed-twisty-gap { width: 18px; flex: none; }
.ed-layer-icon { width: 24px; height: 24px; border-radius: 6px; background: var(--sunk); display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--muted); flex: none; }
.ed-layer-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-badge { font-size: 10px; font-weight: 600; border-radius: 5px; padding: 1px 6px; flex: none; }
.ed-badge.slot { color: var(--blue-ink); background: var(--blue-tint); }
.ed-badge.free { color: var(--muted); background: var(--sunk); }
.ed-lock { font-size: 11px; opacity: .6; }
.ed-tip { margin: 0; padding: 10px 14px; border-top: 1px solid var(--line); font-size: 11px; line-height: 1.5; color: var(--muted); }

.ed-stage { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px; position: relative; overflow: hidden; }
.ed-artboard { position: relative; box-shadow: 0 20px 50px rgba(0,0,0,.16); background: #fff; flex: none; }
.ed-frame { position: absolute; inset: 0; width: 100%; height: 100%; display: block; user-select: none; -webkit-user-drag: none; }
.ed-frame:not([src]) { visibility: hidden; }
.ed-overlay { position: absolute; inset: 0; touch-action: none; }
.ed-stage-foot { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.ed-busy { color: var(--blue); }
.ed-sel, .ed-hover, .ed-slot { position: absolute; pointer-events: none; }
.ed-sel { outline: 1.5px solid var(--blue); }
.ed-sel.locked { outline-color: #8E8E93; outline-style: dashed; }
.ed-sel.dragging { opacity: 0; }
.ed-sel-tag { position: absolute; left: -1px; top: -22px; background: var(--blue); color: #fff; font-size: 10px; font-weight: 600; border-radius: 5px; padding: 2px 7px; white-space: nowrap; }
.ed-sel.locked .ed-sel-tag { background: #8E8E93; }
.ed-handle { position: absolute; right: -6px; bottom: -6px; width: 11px; height: 11px; background: #fff; border: 1.5px solid var(--blue); border-radius: 3px; pointer-events: auto; cursor: nwse-resize; }
.ed-hover { outline: 1px solid rgba(0,113,227,.55); }
.ed-slot { outline: 1.5px dashed rgba(0,113,227,.8); background: rgba(0,113,227,.06); }
.ed-slot span { position: absolute; left: 0; top: 0; background: var(--blue); color: #fff; font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 0 0 5px 0; }
.ed.is-fill .ed-overlay { cursor: pointer; }
.ed-sprite { position: absolute; pointer-events: none; outline: 1.5px solid var(--blue); will-change: transform; }
.ed-resize-box { background: rgba(0,113,227,.06); }
.ed-guide { position: absolute; pointer-events: none; background: #FF3B30; }
.ed-guide.v { top: 0; bottom: 0; width: 1px; }
.ed-guide.h { left: 0; right: 0; height: 1px; }

.ed-insp { padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.ed-insp h3 { margin: 0; font-size: 16px; }
.ed-insp .hint { margin: 0; }
.ed-insp-head { display: flex; align-items: center; gap: 8px; }
.ed-layer-title { font-weight: 600; font-size: 15px; border-color: transparent; padding: 6px 8px; margin-left: -8px; }
.ed-layer-title:hover { border-color: var(--line); }
.ed-kindtag { font-size: 11px; color: var(--muted); background: var(--sunk); border-radius: 5px; padding: 2px 7px; flex: none; }
.ed-group { display: flex; flex-direction: column; gap: 8px; }
.ed-group textarea { font-size: 14px; }
.ed-pos { border-top: 1px solid var(--line); padding-top: 14px; }
.ed-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ed-row4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
label.ed-num { display: flex; flex-direction: column; gap: 3px; margin: 0; font-size: 10px; font-weight: 600; color: var(--muted); }
.ed-num input { padding: 6px 7px; font-size: 12px; border-radius: 7px; }
.ed-num input:disabled { background: var(--sunk); color: var(--muted); }
.ed-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.ed-actions .btn { min-height: 30px; padding: 4px 10px; font-size: 12px; }
.ed-seg { align-self: flex-start; }
.ed-seg button { padding: 5px 12px; }
.ed-styles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.ed-styles button { font: inherit; text-align: left; border: 1px solid var(--line); background: var(--panel); border-radius: 9px; padding: 7px 9px; cursor: pointer; display: flex; flex-direction: column; gap: 1px; color: var(--text); }
.ed-styles button b { font-size: 12px; }
.ed-styles button small { font-size: 10px; color: var(--muted); }
.ed-styles button[aria-pressed="true"] { border-color: var(--blue); background: var(--blue-tint); }
.ed-sws { display: flex; flex-wrap: wrap; gap: 7px; }
.ed-sw { width: 26px; height: 26px; border-radius: 50%; border: 1px solid rgba(0,0,0,.15); cursor: pointer; padding: 0; }
.ed-sw.on { outline: 2px solid var(--blue); outline-offset: 2px; }
.ed-sw.none { background: linear-gradient(135deg, #fff 45%, #FF3B30 45%, #FF3B30 55%, #fff 55%); }
.ed-photo { display: flex; align-items: center; gap: 10px; }
.ed-photo img, .ed-photo .cs-auto { width: 84px; height: 58px; object-fit: cover; border-radius: 8px; }
.ed-template { border: 1px solid #CFE3FF; background: #F5F9FF; border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
label.ed-field, div.ed-field { display: flex; flex-direction: column; gap: 6px; margin: 0; font-size: 12px; font-weight: 600; color: var(--text-2); border-radius: 10px; transition: box-shadow .3s; }
.ed-field textarea { font-weight: 400; }
.ed-field.flash { box-shadow: 0 0 0 4px rgba(0,113,227,.25); }
.ed-lockmsg { margin: 0; font-size: 13px; color: var(--muted); }
@media (max-width: 1000px) { .ed-left { flex-basis: 210px; } .ed-right { flex-basis: 270px; } }
/* the hidden attribute must win over the display rules above */
.ed [hidden] { display: none !important; }

/* layers tree: children sit inside their parent, with a guide line down the left */
.ed-layer { padding-left: 4px; }
.ed-children { margin-left: 13px; padding-left: 6px; border-left: 1px solid var(--line-strong); }
.ed-node:has(> .ed-layer.on) > .ed-children { border-left-color: var(--blue); }
.ed-layer.page .ed-layer-name { font-weight: 600; }
.ed-layer-icon.group { background: transparent; border: 1.5px solid var(--line-strong); color: var(--muted); }
.ed-badge.flow { color: var(--muted); background: transparent; border: 1px solid var(--line); font-weight: 500; }

/* ===================== editor v2: Lucide icons, add panel, inspector sections ===================== */
@font-face { font-family: "lucide-ui"; src: url("/fonts/icons/lucide.woff2") format("woff2"); font-display: block; }
.ic { width: 16px; height: 16px; flex: none; fill: currentColor; vertical-align: -3px; }
.lucide-glyph, .ed-glyph { font-family: "lucide-ui"; font-style: normal; line-height: 1; }

.ed-tabs { display: flex; gap: 2px; margin: 12px 12px 8px; background: var(--sunk); border-radius: 10px; padding: 3px; }
.ed-tabs button { flex: 1; font: inherit; font-size: 13px; font-weight: 500; border: 0; background: transparent; border-radius: 8px; padding: 7px 8px; cursor: pointer; color: var(--text-2); display: flex; align-items: center; justify-content: center; gap: 6px; }
.ed-tabs button[aria-selected="true"] { background: var(--panel); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.ed-add-panel, .ed-layers-panel { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ed-add-panel[hidden], .ed-layers-panel[hidden] { display: none; }
.ed-search-wrap { position: relative; margin: 0 12px 8px; }
.ed-search-wrap .ic { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.ed-search { padding: 8px 10px 8px 32px; font-size: 13px; border-radius: 9px; }
.ed-add-list { flex: 1; overflow-y: auto; padding: 0 12px 16px; }
.ed-add-cat { border-top: 1px solid var(--line); }
.ed-add-cat-head { width: 100%; display: flex; justify-content: space-between; align-items: center; font: inherit; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); border: 0; background: none; padding: 12px 2px; cursor: pointer; }
.ed-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding-bottom: 12px; }
.ed-tile { font: inherit; font-size: 12px; color: var(--text-2); border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 14px 6px 10px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; line-height: 1.2; transition: border-color .15s, box-shadow .15s, color .15s; }
.ed-tile .ic { width: 22px; height: 22px; color: var(--text); }
.ed-tile:hover, .ed-tile:focus-visible { border-color: var(--blue); color: var(--blue-ink); box-shadow: 0 2px 10px rgba(0,113,227,.12); outline: none; }
.ed-tile:hover .ic { color: var(--blue); }

.ed-twisty { display: flex; align-items: center; justify-content: center; }
.ed-twisty .ic { width: 13px; height: 13px; }
.ed-layer-icon .ic { width: 14px; height: 14px; }
.ed-lock .ic { width: 12px; height: 12px; }
.ed-empty { position: absolute; pointer-events: none; outline: 1.5px dashed rgba(0,113,227,.45); background: rgba(0,113,227,.04); }
.ed-empty span { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-size: 10px; font-weight: 600; color: var(--blue-ink); background: rgba(255,255,255,.85); border-radius: 5px; padding: 2px 6px; white-space: nowrap; }

.ed-insp { gap: 0; padding: 0; }
.ed-insp > .ed-insp-head, .ed-insp > .hint, .ed-insp > .ed-template, .ed-insp > .ed-lockmsg { margin: 14px 16px 6px; }
.ed-insp-head .ic { width: 18px; height: 18px; color: var(--muted); }
.ed-insp-head h3 { margin: 0; font-size: 15px; }
.ed-sec { border-top: 1px solid var(--line); }
.ed-sec > summary { list-style: none; display: flex; align-items: center; gap: 8px; padding: 12px 16px; cursor: pointer; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-2); }
.ed-sec > summary::-webkit-details-marker { display: none; }
.ed-sec > summary .ic { color: var(--muted); }
.ed-sec > summary .chev { margin-left: auto; width: 14px; height: 14px; transition: transform .15s; }
.ed-sec:not([open]) > summary .chev { transform: rotate(-90deg); }
.ed-sec-body { padding: 0 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.ed-seg button { display: inline-flex; align-items: center; gap: 4px; }
.ed-slider { display: flex; flex-direction: column; gap: 4px; margin: 0; font-size: 12px; font-weight: 500; color: var(--text-2); }
.ed-slider > span { display: flex; justify-content: space-between; }
.ed-slider output { color: var(--muted); font-variant-numeric: tabular-nums; }
.ed-slider input { width: 100%; }
label.ed-flag { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 13px; font-weight: 500; color: var(--text); cursor: pointer; }
.ed-flag > span { flex: 1; }
.ed-flag .ic { color: var(--muted); }
.ed-flag input { appearance: none; width: 34px; height: 20px; padding: 0; border: 0; border-radius: 99px; background: var(--line-strong); position: relative; cursor: pointer; transition: background .15s; flex: none; }
.ed-flag input::after { content: ""; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.ed-flag input:checked { background: #34C759; }
.ed-flag input:checked::after { transform: translateX(14px); }
.ed-photo-btns .btn, .ed-photo .btn { display: inline-flex; align-items: center; gap: 6px; }
.ed-actions .btn { display: inline-flex; align-items: center; gap: 5px; }
.ed-actions .btn .ic { width: 14px; height: 14px; }
.ed-focus-row { display: flex; gap: 12px; align-items: flex-start; }
.ed-focus { display: grid; grid-template-columns: repeat(3, 22px); gap: 3px; padding: 4px; background: var(--sunk); border-radius: 8px; flex: none; }
.ed-focus button { width: 22px; height: 22px; border: 0; border-radius: 5px; background: var(--panel); cursor: pointer; padding: 0; position: relative; }
.ed-focus button::after { content: ""; position: absolute; inset: 8px; border-radius: 50%; background: var(--line-strong); }
.ed-focus button[aria-pressed="true"] { background: var(--blue); }
.ed-focus button[aria-pressed="true"]::after { background: #fff; }
.ed-focus-modes { display: flex; flex-direction: column; gap: 6px; }
.chip { font: inherit; font-size: 12px; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel); border-radius: 99px; padding: 5px 10px; cursor: pointer; color: var(--text-2); }
.chip .ic { width: 14px; height: 14px; }
.chip[aria-pressed="true"] { border-color: var(--blue); background: var(--blue-tint); color: var(--blue-ink); }
.ed-glyph { font-size: 44px; width: 64px; height: 64px; display: flex; align-items: center; justify-content: center; background: var(--sunk); border-radius: 10px; }
.ed-lockmsg { display: flex; align-items: center; gap: 6px; }

.icon-picker { width: min(760px, calc(100vw - 32px)); }
.icon-picker .create-head .ed-search { margin-right: auto; max-width: 360px; padding-left: 12px; }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; }
.icon-grid button { font: inherit; border: 1px solid transparent; background: none; border-radius: 10px; padding: 10px 4px 6px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--text); }
.icon-grid button:hover { border-color: var(--blue); background: var(--blue-tint); }
.icon-grid .lucide-glyph { font-size: 26px; }
.icon-grid small { font-size: 10px; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-insp.fill { padding: 16px; gap: 16px; }

/* side panels keep their width whatever is inside them (long layer names, the Add tiles) */
.ed-left { width: 260px; min-width: 260px; max-width: 260px; overflow: hidden; }
.ed-right { width: 320px; min-width: 320px; max-width: 320px; overflow-x: hidden; }
.ed-layers, .ed-add-list { min-width: 0; }
.ed-layer { min-width: 0; }
@media (max-width: 1000px) { .ed-left { width: 220px; min-width: 220px; max-width: 220px; } .ed-right { width: 280px; min-width: 280px; max-width: 280px; } }
.ed-sw[data-value="transparent"] { background: repeating-conic-gradient(#D2D2D7 0% 25%, #fff 0% 50%) 50% / 10px 10px !important; }
/* component tiles and property form */
.ed-tile.comp { padding: 8px 6px; }
.ed-tile.comp img { width: 100%; height: 64px; object-fit: contain; background: var(--sunk); border-radius: 6px; }
.ed-comp-empty { font-size: 12px; color: var(--muted); line-height: 1.5; padding: 0 2px 12px; margin: 0; }
.ed-badge.prop { color: #8E44AD; background: #F4ECFA; }
.ed-propdef { display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; }
.ed-proprow { display: flex; align-items: center; gap: 6px; }
.ed-proprow input { flex: 1; padding: 6px 8px; font-size: 13px; }
.ed-proprow .ed-kindtag { flex: none; }
.ed-proprow .icon-btn { width: 28px; height: 28px; flex: none; }
.ed-propmark { position: absolute; pointer-events: none; outline: 1.5px dashed #8E44AD; background: rgba(142,68,173,.06); }
.ed-propmark span { position: absolute; left: 0; top: 0; background: #8E44AD; color: #fff; font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 0 0 5px 0; white-space: nowrap; }

/* media library: upload progress, keywords */
.upload-progress { position: fixed; right: 20px; bottom: 20px; z-index: 200; width: 320px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 14px 40px rgba(0,0,0,.18); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.up-row { display: flex; align-items: center; gap: 10px; }
.up-row > span { flex: 1; font-weight: 500; }
.up-bar { height: 6px; border-radius: 99px; background: var(--sunk); overflow: hidden; }
.up-bar i { display: block; height: 100%; width: 0; background: var(--blue); border-radius: 99px; transition: width .25s; }
.up-errors { margin: 0; font-size: 11px; color: #C4161C; line-height: 1.4; }
.media-tagbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 0 20px 10px; }
.media-tagbar[hidden] { display: none; }
.media-tagbar .hint { margin: 0 4px 0 0; }
.media-tagbar .chip small { color: var(--muted); font-size: 10px; }
.tag-editor { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; border: 1px solid var(--line-strong); border-radius: 10px; padding: 6px; background: #fff; }
.tag-editor:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,113,227,.2); }
.tag-editor .tag { display: inline-flex; align-items: center; gap: 4px; background: var(--blue-tint); color: var(--blue-ink); border-radius: 6px; padding: 3px 4px 3px 8px; font-size: 12px; font-weight: 500; }
.tag-editor .tag button { border: 0; background: none; color: inherit; cursor: pointer; font-size: 10px; padding: 0 3px; opacity: .7; }
.tag-editor input { flex: 1; min-width: 90px; border: 0; padding: 4px; box-shadow: none !important; }
.media-multi-title { margin: 0 0 12px; font-size: 16px; }
.media-multi-actions { display: flex; gap: 8px; margin: 12px 0; flex-wrap: wrap; }

/* code editor (edit the document as JSON) */
.ed-code-btn span { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; }
.ed-code-btn[aria-pressed="true"] { background: var(--text); color: #fff; border-color: var(--text); }
.ed.is-code .ed-artboard, .ed.is-code .ed-stage-foot { display: none; }
.ed.is-code .ed-stage { padding: 0; align-items: stretch; justify-content: stretch; }
.ed-code { flex: 1; min-height: 0; display: flex; flex-direction: column; background: #1D1D1F; color: #F5F5F7; }
.ed-code[hidden] { display: none; }
.ed-code-bar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid #3A3A3C; flex-wrap: wrap; }
.ed-code-bar b { font-size: 13px; margin-right: 6px; }
.ed-code-bar .segmented { background: #2C2C2E; }
.ed-code-bar .segmented button { color: #D1D1D6; }
.ed-code-bar .segmented button[aria-pressed="true"] { background: #48484A; color: #fff; }
.ed-code-bar .btn { min-height: 30px; padding: 4px 12px; font-size: 12px; background: #2C2C2E; color: #F5F5F7; border-color: #48484A; }
.ed-code-bar .btn.primary { background: var(--blue); border-color: var(--blue); }
.ed-code-msg { margin-right: auto; font-size: 12px; color: #AEAEB2; }
.ed-code-msg.bad { color: #FF6961; }
.ed-code-msg.good { color: #30D158; }
.ed-code-wrap { flex: 1; min-height: 0; display: flex; overflow: hidden; }
.ed-code-lines { margin: 0; padding: 14px 10px 14px 14px; text-align: right; color: #636366; user-select: none; overflow: hidden; min-width: 44px; }
.ed-code-lines, .ed-code textarea { font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.ed-code textarea { flex: 1; resize: none; border: 0; border-radius: 0; background: transparent; color: #F5F5F7; padding: 14px; white-space: pre; overflow: auto; tab-size: 2; box-shadow: none !important; caret-color: #0A84FF; }
.ed-code textarea::selection { background: rgba(10,132,255,.4); }
.ed-code-help { margin: 0; padding: 8px 14px; border-top: 1px solid #3A3A3C; font-size: 11px; color: #AEAEB2; line-height: 1.6; }
.ed-code-help code { background: #2C2C2E; border-radius: 4px; padding: 1px 4px; color: #F5F5F7; }

/* top bar: undo, redo, status and one ⋯ menu */
.ed-more-pop { min-width: 230px; padding: 6px; display: flex; flex-direction: column; }
.ed-menu-item { font: inherit; font-size: 13px; display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 0; background: none; border-radius: 8px; padding: 8px 10px; cursor: pointer; color: var(--text); text-decoration: none; }
.ed-menu-item:hover, .ed-menu-item:focus-visible { background: var(--sunk); outline: none; }
.ed-menu-item .ic { color: var(--muted); }
.ed-menu-item kbd { margin-left: auto; font: 11px ui-monospace, Menlo, monospace; color: var(--muted); }
.ed-menu-item.danger, .ed-menu-item.danger .ic { color: #C4161C; }
.ed-more-pop hr { border: 0; border-top: 1px solid var(--line); margin: 4px 2px; }
.ed-more > summary { width: 32px; height: 32px; border-radius: 50%; background: var(--sunk); cursor: pointer; }

/* in the editor the top bar is just the logo, organisation and brand: the editor has its own back link and media library */
body:has(.ed) .topbar [data-open-library], body:has(.ed) .topbar .save-state { display: none; }
.ed-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.ed-partnote { margin: 10px 16px 0; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* media library folders */
.media-folders { flex: 0 0 200px; width: 200px; border-right: 1px solid var(--line); padding: 12px 8px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.mf-head { display: flex; justify-content: space-between; align-items: center; padding: 0 8px 8px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.mf-head .link-btn { text-transform: none; letter-spacing: 0; font-size: 12px; text-decoration: none; font-weight: 600; }
.mf-row { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 8px; cursor: pointer; font-size: 13px; color: var(--text); outline: none; }
.mf-row:hover, .mf-row:focus-visible { background: var(--sunk); }
.mf-row.on { background: var(--blue-tint); color: var(--blue-ink); font-weight: 600; }
.mf-row.drop { background: var(--blue); color: #fff; }
.mf-icon { width: 16px; text-align: center; opacity: .7; flex: none; }
.mf-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mf-count { font-size: 11px; color: var(--muted); font-weight: 500; }
.mf-row.drop .mf-count { color: #fff; }
.mf-act { display: none; border: 0; background: none; cursor: pointer; font-size: 11px; color: var(--muted); padding: 2px 4px; border-radius: 5px; }
.mf-row:hover .mf-act, .mf-act.armed { display: inline-block; }
.mf-row:hover .mf-count { display: none; }
.mf-act:hover { background: var(--panel); color: var(--text); }
.mf-act.armed { color: #C4161C; font-weight: 600; }
.mf-tip { margin: auto 8px 0; padding-top: 12px; font-size: 11px; color: var(--muted); line-height: 1.45; }
.media-tile[draggable="true"] { cursor: grab; }
@media (max-width: 760px) { .media-folders { display: none; } }

/* Arrange: labelled rows of icon buttons */
.ed-arrange { display: grid; grid-template-columns: 64px 1fr; align-items: center; row-gap: 8px; column-gap: 10px; }
.ed-arr-label { font-size: 12px; color: var(--muted); }
.ed-toolset { display: inline-flex; gap: 2px; background: var(--sunk); border-radius: 9px; padding: 2px; justify-self: start; }
.ed-tool { width: 36px; height: 30px; border: 0; background: transparent; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text); }
.ed-tool:hover:not(:disabled) { background: var(--panel); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.ed-tool:disabled { color: var(--line-strong); cursor: default; }
.ed-delete { margin-top: 6px; align-self: flex-start; font: inherit; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; color: #C4161C; cursor: pointer; padding: 6px 2px; }
.ed-delete:hover { text-decoration: underline; }

/* ===================== template maker ===================== */
body:has(.tm) { overflow: hidden; height: 100vh; display: flex; flex-direction: column; }
body:has(.tm) > .topbar { flex: none; }
.tm { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.tm-bar { flex: none; display: flex; align-items: center; gap: 12px; padding: 8px 14px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tm-size select { width: auto; padding: 6px 10px; font-size: 13px; }
.tm-status { margin-left: auto; font-size: 12px; color: var(--muted); }
.tm-status.unsaved { color: #B25E00; }
.tm-bar .btn { min-height: 34px; padding: 6px 16px; font-size: 13px; }
.tm-body { flex: 1; min-height: 0; display: flex; }
.tm-code { flex: 1 1 55%; min-width: 0; display: flex; flex-direction: column; background: #1D1D1F; color: #F5F5F7; }
.tm-code .ed-code-wrap { flex: 1; min-height: 0; display: flex; overflow: hidden; }
.tm-code textarea { flex: 1; resize: none; border: 0; border-radius: 0; background: transparent; color: #F5F5F7; padding: 14px; white-space: pre; overflow: auto; tab-size: 2; font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; box-shadow: none !important; caret-color: #0A84FF; }
.tm-code .ed-code-help { line-height: 1.9; }
.tm-snippet select { width: auto; font-size: 12px; padding: 4px 8px; background: #2C2C2E; color: #F5F5F7; border-color: #48484A; border-radius: 8px; }
.tm-code .ed-code-bar .btn { min-height: 30px; padding: 4px 12px; font-size: 12px; background: #2C2C2E; color: #F5F5F7; border-color: #48484A; }
.tm-side { flex: 0 0 440px; width: 440px; min-width: 0; background: var(--panel); border-left: 1px solid var(--line); display: flex; flex-direction: column; overflow-y: auto; }
.tm-preview-head { display: flex; align-items: baseline; gap: 10px; padding: 14px 16px 8px; }
.tm-preview-head .hint { margin: 0; }
.tm-stage { height: 420px; flex: none; margin: 0 16px; background: var(--sunk); border-radius: 12px; display: flex; align-items: center; justify-content: center; padding: 14px; }
.tm-stage img { max-width: 100%; max-height: 100%; box-shadow: 0 10px 30px rgba(0,0,0,.16); background: #fff; }
.tm-stage img:not([src]) { visibility: hidden; }
.tm-fields { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.tm-fields > .hint { margin: 0; }
label.tm-field, div.tm-field { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 10px; border: 1px solid var(--line); border-radius: 10px; font-weight: 400; }
.tm-field-head { display: flex; align-items: baseline; gap: 8px; }
.tm-field-head code { font-weight: 600; color: var(--blue-ink); }
.tm-field-head .hint { margin: 0; font-size: 11px; }
body:has(.tm) .topbar [data-open-library], body:has(.tm) .topbar .save-state { display: none; }
@media (max-width: 1000px) { .tm-side { flex-basis: 340px; width: 340px; } }

/* ===================== packs ===================== */
body:has(.pk) { overflow: hidden; height: 100vh; display: flex; flex-direction: column; }
body:has(.pk) > .topbar { flex: none; }
body:has(.pk) .topbar [data-open-library], body:has(.pk) .topbar .save-state { display: none; }
.pk { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.pk-meta { margin: 0; }
.pk-body { flex: 1; min-height: 0; display: flex; }
.pk-content { flex: 0 0 380px; width: 380px; background: var(--panel); border-right: 1px solid var(--line); overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.pk-content-head .hint { margin: 4px 0 0; }
.pk-field { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; }
.pk-field-head { display: flex; align-items: baseline; gap: 8px; }
.pk-field-head code { font-size: 11px; color: var(--muted); }
.pk-field-head .hint { margin: 0 0 0 auto; font-size: 11px; }
.pk-field textarea { resize: vertical; min-height: 54px; }
.pk-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pk-chip { border: 1px solid var(--line); background: var(--sunk); color: var(--ink); border-radius: 999px; padding: 3px 10px; font-size: 12px; cursor: pointer; }
.pk-chip.ok { color: #1E7B34; }
.pk-chip.long { background: #FFF4E5; border-color: #F5C27A; color: #8A4B00; }
.pk-chip.own { background: #EAF2FF; border-color: #A8C8FF; color: var(--blue-ink); }
.pk-chip.open { background: var(--blue); border-color: var(--blue); color: #fff; }
.pk-own { background: var(--sunk); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.pk-own-head { display: flex; align-items: baseline; gap: 8px; }
.pk-own-head .hint { margin: 0 0 0 auto; font-size: 11px; }
.pk-own-actions { display: flex; gap: 12px; justify-content: flex-end; }
.pk-only { display: flex; flex-direction: column; }
.pk-only-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 6px 0 8px; }
.pk-link { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 400; color: var(--muted); margin: 0; }
.pk-link select { width: auto; flex: 1; font-size: 12px; padding: 4px 8px; }
.pk-links { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
.pk .link-btn { color: var(--blue); font-size: 12px; text-decoration: none; }
.pk .link-btn.muted { color: var(--muted); }
.pk-main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--sunk); }
.pk-main-head { display: flex; align-items: baseline; gap: 10px; padding: 16px 20px 0; }
.pk-main-head .hint { margin: 0; }
.pk-cards { flex: 1; overflow-y: auto; padding: 16px 20px; display: flex; flex-wrap: wrap; gap: 16px; align-content: flex-start; }
.pk-card { width: 272px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.pk-card.off { opacity: .55; }
.pk-card-head { display: flex; align-items: center; gap: 8px; }
.pk-card-head > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pk-card-head b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.pk-card-head .hint { margin: 0; font-size: 11px; }
.pk-card-head input { width: auto; }
.pk-card-head .icon-btn { width: 28px; height: 28px; font-size: 13px; text-decoration: none; }
.pk-frame { align-self: center; background: var(--sunk); border-radius: 6px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.pk-frame img { width: 100%; height: 100%; object-fit: contain; display: block; }
.pk-notes { display: flex; flex-wrap: wrap; gap: 4px; }
.pk-note { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--sunk); color: var(--muted); }
.pk-note.ok { background: #E8F6EC; color: #1E7B34; }
.pk-note.warn { background: #FFF4E5; color: #8A4B00; }
.pk-note.own { background: #EAF2FF; color: var(--blue-ink); }
.pk-add { width: 272px; min-height: 260px; border: 2px dashed var(--line); border-radius: 14px; background: transparent; color: var(--muted); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-size: 13px; cursor: pointer; }
.pk-add span { font-size: 28px; line-height: 1; }
.pk-add:hover { border-color: var(--blue); color: var(--blue); }
.pk-export { flex: none; display: flex; align-items: center; gap: 12px; padding: 12px 20px; background: var(--panel); border-top: 1px solid var(--line); }
.pk-export .hint { margin: 0; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1000px) { .pk-content { flex-basis: 320px; width: 320px; } }

/* JSON colours in the template maker: a highlighted copy sits behind a see-through textarea */
.tm-editor { position: relative; flex: 1; min-width: 0; display: flex; }
.tm-hl, .tm-code .tm-editor textarea { margin: 0; padding: 14px; white-space: pre; tab-size: 2; font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: 0; word-spacing: 0; }
.tm-hl { position: absolute; inset: 0; overflow: hidden; pointer-events: none; color: #D4D4D8; }
.tm-code .tm-editor textarea { position: relative; z-index: 1; color: transparent; -webkit-text-fill-color: transparent; background: transparent; caret-color: #F5F5F7; }
.tm-code .tm-editor textarea::selection { background: rgba(10,132,255,.35); -webkit-text-fill-color: transparent; }
.j-key { color: #9CDCFE; }
.j-str { color: #CE9178; }
.j-num { color: #B5CEA8; }
.j-lit { color: #569CD6; }
.j-pun { color: #8E8E93; }
.j-field { color: #FFD60A; font-weight: 600; }
.j-token { color: #C586C0; }
.j-hex { border-bottom: 2px solid var(--hex); }
.j-type { color: #4EC9B0; }

/* home shelves: a gentle lift on hover, drawn inside the shelf so nothing gets cut off */
.shelf-row { padding: 6px 6px 12px; margin: -6px -6px 0; }
.design-thumb, .doc-cover, .image-tile { transition: transform .15s ease, box-shadow .15s ease; }
.design-tile:hover .design-thumb, .doc-tile:hover .doc-cover, .shelf-row .image-tile:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(0,0,0,.12); }
.design-tile:focus-visible, .doc-tile:focus-visible, .image-tile:focus-visible { outline: none; }
.design-tile:focus-visible .design-thumb, .doc-tile:focus-visible .doc-cover, .image-tile:focus-visible { box-shadow: 0 0 0 3px var(--blue); }

/* picked templates (new pack, add templates): blue ring, tint and a tick */
.format { position: relative; }
.format[aria-pressed="true"] { border-color: var(--blue); background: #F5F9FF; box-shadow: 0 0 0 2px rgba(0,113,227,.18); }
.template-card::after { content: ""; position: absolute; top: 10px; right: 10px; width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--line-strong); background: rgba(255,255,255,.9); }
.template-card[aria-pressed="true"]::after { content: "\e06c"; font-family: "lucide-ui"; font-size: 12px; line-height: 15px; text-align: center; color: #fff; background: var(--blue); border-color: var(--blue); }
.template-card:disabled { opacity: .5; cursor: default; }
.template-card:disabled::after { display: none; }

/* media library folders: Lucide icons */
.mf-icon .lucide-glyph { font-size: 16px; display: block; }
.mf-row.on .mf-icon { opacity: 1; color: var(--blue); }
.mf-act .lucide-glyph { font-size: 13px; }
.mf-head .link-btn { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; }
.mf-head .link-btn .lucide-glyph { font-size: 14px; }
.pk-card-head input[type="checkbox"] { width: 15px; height: 15px; margin: 0; flex: none; accent-color: var(--blue); }

/* ===================== pack: click-to-edit popup ===================== */
.pk-edit { min-height: 28px; padding: 3px 12px; font-size: 12px; }
.pk-frame[data-pe-open] { cursor: pointer; transition: box-shadow .15s ease; }
.pk-frame[data-pe-open]:hover { box-shadow: 0 0 0 2px var(--blue); }
dialog.pe { width: min(1280px, 96vw); height: min(900px, 92vh); max-width: none; max-height: none; padding: 0; border: 0; border-radius: 18px; overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,.3); }
dialog.pe[open] { display: flex; flex-direction: column; }
dialog.pe::backdrop { background: rgba(0,0,0,.45); }
.pe-head { flex: none; display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-bottom: 1px solid var(--line); background: var(--panel); }
.pe-title { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 12px; }
.pe-title h2 { margin: 0; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pe-title .hint { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pe-head .btn { min-height: 32px; padding: 5px 14px; font-size: 13px; text-decoration: none; }
.pe-body { flex: 1; min-height: 0; display: flex; }
.pe-stage { flex: 1; min-width: 0; position: relative; background: var(--sunk); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.pe-canvas { position: relative; box-shadow: 0 10px 30px rgba(0,0,0,.18); background: #fff; cursor: pointer; }
.pe-canvas img { display: block; width: 100%; height: 100%; user-select: none; -webkit-user-drag: none; }
.pe-canvas img:not([src]) { visibility: hidden; }
.pe-hover, .pe-sel { position: absolute; pointer-events: none; border-radius: 2px; }
.pe-hover { outline: 1.5px dashed var(--blue); outline-offset: 1px; }
.pe-sel { outline: 2px solid var(--blue); outline-offset: 1px; box-shadow: 0 0 0 9999px rgba(0,0,0,.06); }
.pe-sel::after { content: attr(data-label); position: absolute; left: -2px; top: -24px; background: var(--blue); color: #fff; font-size: 11px; font-weight: 600; padding: 3px 7px; border-radius: 5px 5px 5px 0; white-space: nowrap; }
.pe-busy { position: absolute; top: 12px; right: 14px; font-size: 12px; color: var(--blue); background: var(--panel); padding: 4px 10px; border-radius: 999px; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.pe-side { flex: 0 0 340px; width: 340px; border-left: 1px solid var(--line); background: var(--panel); overflow-y: auto; display: flex; flex-direction: column; }
.pe-panel { padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.pe-empty { margin: 4px 0 0; font-size: 14px; }
.pe-sel-head { display: flex; align-items: baseline; gap: 8px; padding-bottom: 4px; }
.pe-sel-head b { font-size: 15px; }
.pe-sel-head code { font-size: 11px; color: var(--muted); }
.pe-sec { border-top: 1px solid var(--line); }
.pe-sec > summary { list-style: none; cursor: pointer; padding: 10px 0; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); display: flex; justify-content: space-between; }
.pe-sec > summary::-webkit-details-marker { display: none; }
.pe-sec > summary::after { content: "+"; font-size: 15px; line-height: 1; }
.pe-sec[open] > summary::after { content: "–"; }
.pe-sec-body { display: flex; flex-direction: column; gap: 12px; padding-bottom: 14px; }
.pe-row { display: flex; flex-direction: column; gap: 6px; margin: 0; font-size: 13px; font-weight: 500; }
.pe-row > span { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.pe-row output { font-weight: 400; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.pe-row input[type="range"] { width: 100%; padding: 0; accent-color: var(--blue); }
.pe-row textarea { resize: vertical; min-height: 64px; font-size: 14px; }
.pe-check { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; margin: 0; }
.pe-check input { width: 15px; height: 15px; margin: 0; accent-color: var(--blue); }
.pe-seg { display: flex; }
.pe-seg button { flex: 1; font-size: 12px; padding: 5px 6px; }
.pe-swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.pe-swatch { width: 26px; height: 26px; border-radius: 50%; border: 1px solid rgba(0,0,0,.15); background: var(--c); padding: 0; box-shadow: inset 0 0 0 2px #fff; }
.pe-swatch.on { box-shadow: 0 0 0 2px var(--blue), inset 0 0 0 2px #fff; }
.pe-swatch.none { background: linear-gradient(135deg, #fff 45%, #E5484D 45%, #E5484D 55%, #fff 55%); }
.pe-note { margin: 0; font-size: 12px; background: var(--blue-tint); color: var(--blue-ink); padding: 8px 10px; border-radius: 8px; }
.pe-photo { display: flex; align-items: center; gap: 10px; }
.pe-photo img, .pe-photo .cs-auto { width: 84px; height: 58px; object-fit: cover; border-radius: 8px; }
.pe-pin { position: relative; cursor: crosshair; border-radius: 8px; overflow: hidden; background: var(--sunk); line-height: 0; }
.pe-pin img { width: 100%; max-height: 200px; object-fit: contain; }
.pe-pin i { position: absolute; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; border: 2px solid #fff; background: var(--blue); box-shadow: 0 1px 4px rgba(0,0,0,.4); pointer-events: none; }
.pe-focus { display: grid; grid-template-columns: repeat(3, 22px); gap: 3px; }
.pe-focus button { width: 22px; height: 22px; padding: 0; border-radius: 5px; border: 1px solid var(--line-strong); background: var(--panel); }
.pe-focus button[aria-pressed="true"] { background: var(--blue); border-color: var(--blue); }
.pe-actions { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 10px; border-top: 1px solid var(--line); }
.pe-layers { border-top: 1px solid var(--line); margin-top: auto; padding: 8px 16px 14px; }
.pe-layers > summary { cursor: pointer; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 6px 0; }
.pe-layer { display: flex; align-items: center; gap: 6px; padding: 4px 6px 4px calc(6px + var(--d) * 14px); border-radius: 6px; font-size: 12px; cursor: pointer; }
.pe-layer > span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pe-layer:hover { background: var(--sunk); }
.pe-layer.on { background: var(--blue-tint); color: var(--blue-ink); font-weight: 600; }
.pe-layer.off > span { opacity: .45; text-decoration: line-through; }
.pe-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--blue); flex: none; }
.pe-eye { border: 0; background: none; padding: 2px; color: var(--muted); font-size: 14px; line-height: 1; }
.pe-eye .lucide-glyph { font-size: 14px; }
@media (max-width: 900px) { .pe-body { flex-direction: column; } .pe-side { flex: 0 0 45%; width: auto; border-left: 0; border-top: 1px solid var(--line); } .pe-title .hint { display: none; } }

/* ===================== visual template builder ===================== */
body:has(.vb) { overflow: hidden; height: 100vh; display: flex; flex-direction: column; }
body:has(.vb) > .topbar { flex: none; }
body:has(.vb) .topbar [data-open-library], body:has(.vb) .topbar .save-state { display: none; }
.vb { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.vb [hidden] { display: none !important; }
.vb-history { display: flex; gap: 2px; }
.vb-history .icon-btn { width: 32px; height: 32px; font-size: 16px; }
.vb-history .icon-btn:disabled { opacity: .35; cursor: default; }
.vb-body { flex: 1; min-height: 0; display: flex; }

.vb-left { flex: 0 0 248px; width: 248px; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.vb-tabs { margin: 12px 12px 4px; display: flex; }
.vb-tabs button { flex: 1; }
.vb-pane { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 12px 16px; }
.vb-add-group h3 { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 12px 2px 8px; }
.vb-add-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.vb-add-item { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); font: inherit; font-size: 12px; color: var(--text); cursor: pointer; text-align: center; }
.vb-add-item .lucide-glyph { font-size: 20px; color: var(--muted); }
.vb-add-item:hover { border-color: var(--blue); color: var(--blue-ink); background: #F5F9FF; }
.vb-add-item:hover .lucide-glyph { color: var(--blue); }
.vb-add-tip { margin: 14px 2px 0; font-size: 12px; }
.vb-tree { display: flex; flex-direction: column; gap: 1px; }
.vb-node { display: flex; align-items: center; gap: 4px; padding: 5px 6px 5px calc(4px + var(--d, 0) * 14px); border-radius: 6px; font-size: 12.5px; cursor: pointer; border: 1px solid transparent; }
.vb-node:hover { background: var(--sunk); }
.vb-node.on { background: var(--blue-tint); color: var(--blue-ink); font-weight: 600; }
.vb-node.root { font-weight: 600; }
.vb-twist { width: 14px; flex: none; text-align: center; color: var(--muted); font-size: 10px; }
.vb-node-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vb-node code { font-size: 10px; color: var(--muted); background: var(--sunk); padding: 1px 5px; border-radius: 4px; }
.vb-free { font-style: normal; color: var(--muted); font-size: 11px; }
.vb-node.drop-before { border-top: 2px solid var(--blue); }
.vb-node.drop-after { border-bottom: 2px solid var(--blue); }
.vb-node.drop-in { background: var(--blue-tint); border-color: var(--blue); }

.vb-stage { flex: 1; min-width: 0; position: relative; background: var(--sunk); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.vb-canvas { position: relative; background: #fff; box-shadow: 0 12px 40px rgba(0,0,0,.16); touch-action: none; cursor: default; }
.vb-canvas img { display: block; width: 100%; height: 100%; user-select: none; pointer-events: none; }
.vb-canvas img:not([src]) { visibility: hidden; }
.vb-hover, .vb-sel, .vb-ghost, .vb-drop { position: absolute; pointer-events: none; }
.vb-hover { outline: 1.5px dashed var(--blue); outline-offset: 1px; }
.vb-hover::after { content: attr(data-label); position: absolute; left: -1px; bottom: calc(100% + 3px); font-size: 10.5px; font-weight: 600; color: var(--blue-ink); background: rgba(255,255,255,.92); padding: 1px 6px; border-radius: 4px; white-space: nowrap; }
.vb-sel { outline: 2px solid var(--blue); outline-offset: 1px; cursor: move; }
.vb-tools { position: absolute; left: -2px; bottom: calc(100% + 6px); display: flex; align-items: center; gap: 2px; background: var(--blue); color: #fff; border-radius: 8px; padding: 2px 3px 2px 8px; pointer-events: auto; white-space: nowrap; box-shadow: 0 4px 12px rgba(0,0,0,.15); }
.vb-sel.near-top .vb-tools { bottom: auto; top: calc(100% + 6px); }
.vb-tools-name { font-size: 11px; font-weight: 600; margin-right: 4px; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.vb-tools button { border: 0; background: transparent; color: #fff; width: 24px; height: 24px; border-radius: 6px; cursor: pointer; display: grid; place-items: center; padding: 0; }
.vb-tools button:hover { background: rgba(255,255,255,.2); }
.vb-tools .lucide-glyph { font-size: 14px; }
.vb-handle { position: absolute; right: -7px; bottom: -7px; width: 12px; height: 12px; background: #fff; border: 2px solid var(--blue); border-radius: 3px; pointer-events: auto; cursor: nwse-resize; }
.vb-ghost { outline: 2px dashed var(--blue); background: rgba(0,113,227,.08); border-radius: 2px; }
.vb-drop { background: var(--blue); border-radius: 3px; box-shadow: 0 0 0 2px #fff; }
.vb-drop::after { content: attr(data-label); position: absolute; left: 0; top: 6px; font-size: 10.5px; font-weight: 600; background: var(--blue); color: #fff; padding: 2px 7px; border-radius: 5px; white-space: nowrap; }
.vb-tip { position: absolute; bottom: 10px; left: 0; right: 0; text-align: center; margin: 0; font-size: 12px; color: var(--muted); pointer-events: none; }

.vb-right { flex: 0 0 340px; width: 340px; background: var(--panel); border-left: 1px solid var(--line); overflow-y: auto; padding: 14px 16px 24px; display: flex; flex-direction: column; gap: 8px; }
.vb-right .pe-sel-head .hint { margin: 0 0 0 auto; }
.vb-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; font-size: 11.5px; color: var(--muted); }
.vb-crumbs button { border: 0; background: none; padding: 2px 4px; border-radius: 4px; color: var(--blue); cursor: pointer; font: inherit; }
.vb-crumbs button:hover { background: var(--blue-tint); }
.vb-rename { width: 100%; font-weight: 600; font-size: 15px; border-color: transparent; padding: 6px 8px; margin-left: -8px; }
.vb-rename:hover, .vb-rename:focus { border-color: var(--line); }
.vb-mode { margin: 0; font-size: 12.5px; color: var(--muted); }
.vb-mode b { color: var(--text); }
.vb-right textarea { resize: vertical; min-height: 60px; font-size: 14px; }
.vb-field { display: flex; flex-direction: column; gap: 8px; }
.vb-field-row { display: flex; gap: 6px; }
.vb-field-row .vb-num { flex: 1; }
.vb-field-row .vb-num.small { flex: 0 0 64px; }
.vb-num { display: flex; flex-direction: column; gap: 3px; font-size: 11px; font-weight: 500; color: var(--muted); margin: 0; min-width: 0; }
.vb-num input { padding: 6px 8px; font-size: 13px; width: 100%; }
.vb-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.vb-grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.vb-fieldcard { border: 1px solid var(--line); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.vb-fc-head { display: flex; align-items: baseline; gap: 8px; }
.vb-fc-head code { font-weight: 600; color: var(--blue-ink); }
.vb-fc-head .hint { margin: 0; font-size: 11px; }
.vb-icon-now { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.vb-icon-now .lucide-glyph { font-size: 22px; }
.vb-icons { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; max-height: 180px; overflow-y: auto; }
.vb-icons button { aspect-ratio: 1; border: 1px solid var(--line); background: var(--panel); border-radius: 6px; padding: 0; cursor: pointer; display: grid; place-items: center; }
.vb-icons button:hover { border-color: var(--blue); color: var(--blue); }
.vb-icons .lucide-glyph { font-size: 17px; }
.vb-actions { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 12px; border-top: 1px solid var(--line); }
.vb-actions .btn { min-height: 30px; padding: 4px 10px; font-size: 12px; }
.vb-actions .btn:disabled { opacity: .4; }
.btn.danger { color: #C9302C; }
@media (max-width: 1100px) { .vb-left { flex-basis: 200px; width: 200px; } .vb-right { flex-basis: 300px; width: 300px; } }

/* builder: size label + resize dialog */
.vb-size-label { font-size: 12px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ed-more-pop .ed-menu-item .lucide-glyph { font-size: 15px; color: var(--muted); width: 16px; text-align: center; }
.ed-more-pop .ed-menu-item.danger .lucide-glyph { color: inherit; }
dialog.vb-size-dialog { width: min(560px, 94vw); padding: 0; border: 0; border-radius: 18px; box-shadow: 0 30px 80px rgba(0,0,0,.3); }
dialog.vb-size-dialog::backdrop { background: rgba(0,0,0,.35); }
.vb-size-head { display: flex; align-items: baseline; gap: 10px; padding: 16px 18px 10px; }
.vb-size-head h2 { margin: 0; font-size: 18px; }
.vb-size-head .hint { margin: 0; flex: 1; font-size: 12px; }
.vb-size-head .icon-btn { align-self: center; }
.vb-size-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 18px 14px; }
.vb-size-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); font: inherit; text-align: left; cursor: pointer; color: var(--text); }
.vb-size-item:hover { border-color: var(--blue); background: #F5F9FF; }
.vb-size-item.on { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(0,113,227,.18); }
.vb-size-item b { display: block; font-size: 13.5px; }
.vb-size-item small { display: block; font-size: 11.5px; color: var(--muted); }
.vb-size-shape { width: 48px; height: 48px; flex: none; display: grid; place-items: center; background: var(--sunk); border-radius: 8px; }
.vb-size-shape i { display: block; background: #fff; border: 1.5px solid var(--line-strong); border-radius: 2px; }
.vb-size-custom { border-top: 1px solid var(--line); padding: 14px 18px 18px; display: flex; flex-direction: column; gap: 10px; background: var(--sunk); }
.vb-size-custom > b { font-size: 13.5px; }
.vb-size-row { display: flex; align-items: flex-end; gap: 8px; }
.vb-size-row .vb-num { flex: 1; }
.vb-size-row .vb-num select { padding: 6px 8px; font-size: 13px; }
.vb-x { padding-bottom: 8px; color: var(--muted); }
.vb-size-foot { display: flex; align-items: center; gap: 10px; }
.vb-size-foot .hint { flex: 1; margin: 0; font-variant-numeric: tabular-nums; }
.vb-size-note { margin: 0; font-size: 11.5px; }
@media (max-width: 520px) { .vb-size-list { grid-template-columns: 1fr; } .vb-size-row { flex-wrap: wrap; } }

/* ===================== template & component libraries ===================== */
dialog.lib { width: min(1180px, 96vw); height: min(820px, 90vh); max-width: none; max-height: none; padding: 0; border: 0; border-radius: 18px; overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,.3); }
dialog.lib[open] { display: flex; flex-direction: column; }
dialog.lib::backdrop { background: rgba(0,0,0,.4); }
.lib-head { flex: none; display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.lib-head h2 { margin: 0; font-size: 18px; }
.lib-search { flex: 1; max-width: 380px; }
.lib-count { margin: 0 auto 0 0; }
.lib-body { flex: 1; min-height: 0; display: flex; }
.lib-body .media-folders { flex: 0 0 220px; width: 220px; border-right: 1px solid var(--line); overflow-y: auto; padding: 12px; }
.lib-main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--sunk); }
.lib-bulk { flex: none; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 16px; background: var(--blue-tint); color: var(--blue-ink); font-size: 13px; }
.lib-bulk label { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 500; }
.lib-bulk select { width: auto; padding: 4px 8px; font-size: 13px; }
.lib-grid { flex: 1; overflow-y: auto; padding: 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; align-content: start; }
.lib-card { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 10px; display: flex; flex-direction: column; gap: 4px; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease; }
.lib-card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0,0,0,.1); }
.lib-card.on { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(0,113,227,.2); }
.lib-card:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.lib-thumb { height: 150px; display: flex; align-items: center; justify-content: center; background: var(--sunk); border-radius: 10px; overflow: hidden; margin-bottom: 4px; background-image: linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%), linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%); background-size: 16px 16px; background-position: 0 0, 8px 8px; }
.lib-thumb img { max-width: 92%; max-height: 92%; box-shadow: 0 2px 10px rgba(0,0,0,.12); }
.lib-name { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-check { position: absolute; top: 14px; left: 14px; z-index: 1; margin: 0; opacity: 0; transition: opacity .1s; }
.lib-card:hover .lib-check, .lib-card.on .lib-check, .lib-check:focus-within { opacity: 1; }
.lib-check input { width: 16px; height: 16px; margin: 0; accent-color: var(--blue); }
.lib-hint { flex: none; margin: 0; padding: 8px 16px 12px; font-size: 12px; }
.lib-empty { grid-column: 1 / -1; }
.shelf-actions .btn + .btn { margin-left: 6px; }

/* builder: components */
.vb-add-group h3 { display: flex; justify-content: space-between; align-items: baseline; }
.vb-add-group h3 .link-btn { font-size: 11px; text-transform: none; letter-spacing: 0; font-weight: 600; text-decoration: none; color: var(--blue); }
.vb-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.vb-chips .chip { font-size: 11px; padding: 2px 8px; }
.vb-comp-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.vb-comp { min-width: 0; display: flex; flex-direction: column; gap: 4px; padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); cursor: pointer; font: inherit; text-align: left; }
.vb-comp:hover { border-color: var(--blue); background: #F5F9FF; }
.vb-comp-thumb { height: 64px; display: flex; align-items: center; justify-content: center; background: var(--sunk); border-radius: 6px; overflow: hidden; }
.vb-comp-thumb img { max-width: 94%; max-height: 94%; }
.vb-comp-name { font-size: 11.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vb-comp-empty { font-size: 12px; margin: 0; }
.vb-comp-card { display: flex; gap: 10px; align-items: center; }
.vb-comp-card img { width: 96px; max-height: 72px; object-fit: contain; background: var(--sunk); border-radius: 8px; padding: 4px; }
.vb-comp-card div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.vb-comp-card .hint { margin: 0; font-size: 11.5px; }
.vb-comp-banner { background: #F3EBFF; border: 1px solid #D4BFFF; color: #4B2A8A; border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; }
.vb-comp-banner > div { display: flex; gap: 6px; margin-top: 4px; }
.vb-comp-banner .btn { min-height: 28px; padding: 3px 12px; font-size: 12px; }

/* template pickers (new pack, add templates): search + folder chips */
.pick-filter { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 8px 0 12px; }
.pick-filter input[type="search"] { flex: 0 1 260px; padding: 7px 12px; font-size: 13px; }
.pick-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pick-chips .chip { font-size: 12px; padding: 4px 11px; }
.template-card[hidden] { display: none !important; }
.pick-none { grid-column: 1 / -1; margin: 0; }
.vb-comp-fields { display: flex; flex-direction: column; gap: 8px; }
.vb-comp-fields > .hint { margin: 0; font-size: 11.5px; }

/* ===================== reel maker ===================== */
body:has(.rm) { overflow: hidden; height: 100vh; display: flex; flex-direction: column; }
body:has(.rm) > .topbar { flex: none; }
body:has(.rm) .topbar [data-open-library], body:has(.rm) .topbar .save-state { display: none; }
.rm { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.rm [hidden] { display: none !important; }
.rm .tm-bar .btn .lucide-glyph { font-size: 15px; margin-right: 4px; }
.rm-body { flex: 1; min-height: 0; display: flex; }
.rm-scenes { flex: 0 0 236px; width: 236px; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.rm-scenes-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.rm-scenes-head .btn { min-height: 28px; padding: 3px 12px; font-size: 12px; }
.rm-scene-list { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.rm-scene { display: flex; gap: 10px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; background: var(--panel); }
.rm-scene:hover { border-color: var(--line-strong); }
.rm-scene.on { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(0,113,227,.18); }
.rm-scene canvas { width: 54px; height: 96px; border-radius: 6px; background: #1D1D1F; flex: none; }
.rm-scene-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 13px; }
.rm-scene-info .hint { margin: 0; font-size: 11.5px; }
.rm-scene-acts { display: flex; gap: 2px; margin-top: auto; opacity: 0; transition: opacity .1s; }
.rm-scene:hover .rm-scene-acts, .rm-scene.on .rm-scene-acts { opacity: 1; }
.rm-scene-acts button { width: 24px; height: 24px; padding: 0; border: 1px solid var(--line); background: var(--panel); border-radius: 6px; font-size: 12px; cursor: pointer; color: var(--text); }
.rm-scene-acts button:disabled { opacity: .35; cursor: default; }
.rm-stage { flex: 1; min-width: 0; position: relative; background: var(--sunk); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 20px; overflow: hidden; }
.rm-canvas-wrap { position: relative; height: calc(100% - 64px); aspect-ratio: 9 / 16; max-width: 100%; }
.rm-canvas-wrap canvas { width: 100%; height: 100%; display: block; border-radius: 10px; box-shadow: 0 14px 40px rgba(0,0,0,.2); background: #1D1D1F; cursor: default; touch-action: none; }
.rm-sel { pointer-events: none; outline: 2px solid var(--blue); outline-offset: 1px; position: absolute; }
.rm-transport { flex: none; display: flex; align-items: center; gap: 10px; width: min(560px, 100%); background: var(--panel); border-radius: 999px; padding: 6px 16px 6px 8px; box-shadow: 0 4px 14px rgba(0,0,0,.08); }
.rm-transport .icon-btn { width: 34px; height: 34px; font-size: 16px; }
.rm-play { background: var(--blue); color: #fff; }
.rm-transport input[type="range"] { flex: 1; accent-color: var(--blue); padding: 0; }
.rm-time { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 92px; text-align: right; }
.rm-exporting { position: absolute; top: 16px; left: 50%; transform: translateX(-50%); background: #1D1D1F; color: #fff; padding: 10px 18px; border-radius: 12px; display: flex; gap: 8px; align-items: baseline; font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.rm-exporting .hint { color: #AEAEB2; margin: 0 0 0 6px; }
.rm-layers { display: flex; flex-direction: column; gap: 4px; }
.rm-layer { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; text-align: left; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); font: inherit; font-size: 13px; cursor: pointer; color: var(--text); }
.rm-layer:hover { border-color: var(--blue); }
.rm-layer .hint { margin: 0; font-size: 11px; }
.rm-add { display: flex; gap: 6px; }
.rm-add select { flex: 1; font-size: 13px; padding: 6px 8px; }
.rm .pe-seg button { font-size: 11.5px; padding: 5px 4px; }
.reel-thumb { background: linear-gradient(160deg, #2A2A2E, #1D1D1F); }
.reel-glyph { font-size: 44px; color: rgba(255,255,255,.75); }
.rm-presets { display: flex; flex-wrap: wrap; gap: 5px; }
.rm-presets .chip { font-size: 12px; padding: 4px 10px; }
.rm-cam-btn { align-self: flex-start; }
.rm-cam-btn.on { background: var(--blue); color: #fff; border-color: var(--blue); }
.rm-cam-on .rm-canvas-wrap canvas { cursor: move; box-shadow: 0 0 0 3px var(--blue), 0 14px 40px rgba(0,0,0,.2); }

/* reel maker: background positioning, music */
.rm-ghost { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; cursor: grab; }
.rm-canvas-wrap, .rm-transport, .rm-exporting { position: relative; z-index: 1; }
.rm-canvas-wrap canvas { cursor: grab; }
.rm-dragging .rm-ghost, .rm-dragging .rm-canvas-wrap canvas { cursor: grabbing; }
.rm-playing .rm-ghost { cursor: default; }
.rm-bg-media { display: flex; align-items: center; gap: 12px; }
.rm-bg-media img, .rm-bg-media video, .rm-bg-none { width: 54px; height: 96px; object-fit: cover; border-radius: 8px; background: var(--sunk); flex: none; border: 1px solid var(--line); }
.rm-bg-media > div { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.rm-fit { display: flex; gap: 6px; flex-wrap: wrap; }
.rm-fit .btn { min-height: 28px; padding: 3px 10px; font-size: 12px; }
.rm-music-wrap { flex: none; border-top: 1px solid var(--line); padding: 10px 14px 14px; display: flex; flex-direction: column; gap: 8px; }
.rm-music-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.rm-music { display: flex; flex-direction: column; gap: 10px; }
.rm-music-add { align-self: flex-start; }
.rm-music-add .lucide-glyph, .rm-music-head .lucide-glyph { font-size: 15px; }
.rm-music-head { display: flex; align-items: center; gap: 6px; font-size: 13px; min-width: 0; }
.rm-music-head b { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rm-music-head .link-btn { font-size: 12px; }

/* media library: videos and music */
.media-tile video, .image-tile video { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.media-tile, .image-tile { position: relative; }
.video-badge { position: absolute; right: 8px; bottom: 8px; width: 26px; height: 26px; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; font-size: 11px; display: grid; place-items: center; pointer-events: none; }
.audio-tile { display: grid; place-items: center; width: 100%; height: 100%; aspect-ratio: 1; background: linear-gradient(150deg, #F3EBFF, #E3EEFF); color: #6E56CF; }
.audio-tile .lucide-glyph { font-size: 42px; }
.media-preview video { width: 100%; max-height: 320px; border-radius: 10px; background: #000; }
.media-preview.audio { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 20px; background: linear-gradient(150deg, #F3EBFF, #E3EEFF); border-radius: 12px; color: #6E56CF; }
.media-preview.audio .lucide-glyph { font-size: 48px; }
.media-preview.audio audio { width: 100%; }

/* reel maker v2: preview above, transport + keyframe timeline below */
.rm-stage { padding: 0; gap: 0; justify-content: stretch; align-items: stretch; }
.rm-view { flex: 1; min-height: 0; position: relative; display: flex; align-items: center; justify-content: center; padding: 18px; overflow: hidden; touch-action: none; cursor: grab; }
.rm-view .rm-canvas-wrap { height: 100%; aspect-ratio: 9 / 16; max-width: 100%; position: relative; z-index: 1; }
.rm-dragging .rm-view, .rm-dragging .rm-view canvas { cursor: grabbing; }
.rm-sel { position: absolute; pointer-events: none; outline: 2px solid var(--blue); outline-offset: 1px; z-index: 2; transform-origin: center; }
.rm-exporting { z-index: 3; }
.rm-bottom { flex: none; background: var(--panel); border-top: 1px solid var(--line); display: flex; flex-direction: column; }
.rm-bottom .rm-transport { width: auto; margin: 8px 14px 4px; box-shadow: none; background: var(--sunk); align-self: stretch; }
.rm-timeline { max-height: 210px; overflow-y: auto; padding: 0 14px 12px; }
.rm-tl-head { display: grid; grid-template-columns: 170px 1fr; align-items: end; gap: 0; padding: 6px 0 4px; font-size: 12px; position: sticky; top: 0; background: var(--panel); z-index: 2; }
.rm-tl-head b { font-size: 12.5px; }
.rm-tl-head .hint { display: none; }
.rm-tl-ruler { position: relative; height: 16px; border-bottom: 1px solid var(--line); }
.rm-tl-ruler span { position: absolute; bottom: 2px; transform: translateX(-50%); font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }
.rm-tl-ruler span:first-child { transform: none; }
.rm-tl-lanes { position: relative; }
.rm-lane { display: grid; grid-template-columns: 170px 1fr; align-items: center; min-height: 34px; border-bottom: 1px solid var(--line); }
.rm-lane.on { background: var(--blue-tint); }
.rm-lane-name { text-align: left; background: none; border: 0; font: inherit; font-size: 12.5px; padding: 4px 8px 4px 2px; cursor: pointer; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; flex-direction: column; }
.rm-lane-name small { font-size: 10.5px; color: var(--muted); }
.rm-lane.on .rm-lane-name { color: var(--blue-ink); font-weight: 600; }
.rm-lane-track { position: relative; height: 34px; cursor: pointer; background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 1px), rgba(0,0,0,.04) calc(10% - 1px) 10%); }
.rm-key { position: absolute; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; background: var(--blue); transform: rotate(45deg); border-radius: 2px; box-shadow: 0 0 0 2px var(--panel); cursor: grab; }
.rm-key.auto { background: var(--line-strong); cursor: pointer; }
.rm-key.on { background: #FF9F0A; width: 14px; height: 14px; margin: -7px 0 0 -7px; }
.rm-tl-playhead { position: absolute; top: 0; bottom: 0; width: 2px; background: #FF3B30; pointer-events: none; z-index: 1; }
.rm-tl-empty { padding: 10px 0; margin: 0; }
.rm-add-layer { gap: 8px; }
.rm-add-layer .btn { align-self: flex-start; }
.rm-add-layer .btn .lucide-glyph { font-size: 14px; margin-right: 4px; }
.rm-add-layer select { font-size: 13px; padding: 6px 8px; }
.rm-se { display: flex; align-items: center; gap: 8px; }
.rm-se .btn.on { background: var(--blue); color: #fff; border-color: var(--blue); }
.rm-keys-bar { display: flex; gap: 6px; }
.rm-keys-bar .btn { min-height: 30px; padding: 4px 10px; font-size: 12px; }
.rm-key-card { border: 1px solid var(--line); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.link-btn.danger { color: #C9302C; }
.rm .pe-seg button { font-size: 11px; padding: 5px 3px; }

/* reel maker: animation summary + the Animate popup */
.rm-anim-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 10px; background: var(--sunk); }
.rm-anim-sum { display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
.rm-anim-sum b { display: inline-block; min-width: 72px; color: var(--muted); font-weight: 500; }
.rm-anim-card .btn { align-self: stretch; justify-content: center; }
.rm-anim-card .btn .lucide-glyph { font-size: 15px; margin-right: 6px; }
dialog.ra { width: min(1180px, 96vw); height: min(860px, 92vh); max-width: none; max-height: none; padding: 0; border: 0; border-radius: 18px; overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,.35); }
dialog.ra[open] { display: flex; flex-direction: column; }
dialog.ra::backdrop { background: rgba(0,0,0,.5); }
.ra-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.ra-head h2 { margin: 0; font-size: 18px; }
.ra-head .hint { margin: 2px 0 0; font-size: 12px; }
.ra-body { flex: 1; min-height: 0; display: flex; }
.ra-stage { flex: 0 0 42%; min-width: 0; background: #17171A; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 18px; }
.ra-canvas { flex: 1; min-height: 0; aspect-ratio: 9 / 16; max-width: 100%; }
.ra-canvas canvas { width: 100%; height: 100%; display: block; border-radius: 10px; background: #000; cursor: grab; touch-action: none; }
.ra-controls { flex: none; display: flex; align-items: center; gap: 10px; width: 100%; max-width: 420px; color: #fff; }
.ra-controls .icon-btn { background: rgba(255,255,255,.12); color: #fff; width: 34px; height: 34px; }
.ra-controls input { flex: 1; accent-color: #0A84FF; padding: 0; }
.ra-time { font-size: 12px; color: #AEAEB2; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ra-side { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ra-tabs { margin: 14px 18px 6px; display: flex; }
.ra-tabs button { flex: 1; }
.ra-panel { flex: 1; overflow-y: auto; padding: 6px 18px 22px; display: flex; flex-direction: column; gap: 6px; }
.ra-sec { display: flex; flex-direction: column; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.ra-sec:last-child { border-bottom: 0; }
.ra-sec h3 { margin: 0; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.ra-tag { text-transform: none; letter-spacing: 0; background: #FFF1DB; color: #9A5B00; padding: 1px 8px; border-radius: 999px; font-size: 11px; }
.ra-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.ra-card { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 6px 9px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); cursor: pointer; font: inherit; color: var(--text); }
.ra-card:hover { border-color: var(--blue); }
.ra-card.on { border-color: var(--blue); background: #F2F7FF; box-shadow: 0 0 0 2px rgba(0,113,227,.2); }
.ra-card-name { font-size: 12px; font-weight: 500; text-align: center; }
.ra-demo { width: 64px; height: 64px; border-radius: 10px; background: #EDEDF2; position: relative; overflow: hidden; display: grid; place-items: center; }
.ra-demo i { display: block; width: 26px; height: 26px; border-radius: 6px; background: var(--blue); }
.ra-card:not(:hover):not(.on) .ra-demo i { animation-play-state: paused; }
.ra-two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ra-bar { position: relative; height: 14px; border-radius: 7px; background: #EDEDF2; overflow: hidden; }
.ra-bar span { position: absolute; top: 0; bottom: 0; }
.ra-bar-in { background: linear-gradient(90deg, rgba(0,113,227,.15), rgba(0,113,227,.7)); }
.ra-bar-on { background: rgba(0,113,227,.7); }
.ra-bar-out { background: linear-gradient(90deg, rgba(0,113,227,.7), rgba(0,113,227,.12)); }
.ra-track { position: relative; height: 34px; background: #EDEDF2; border-radius: 8px; cursor: pointer; touch-action: none; }
.ra-track .rm-key { cursor: grab; }
.ra-playhead { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: #FF3B30; pointer-events: none; }
.ra-track-ruler { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--muted); margin-top: -6px; }
.ra-key-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ra-keylist { display: flex; flex-direction: column; gap: 4px; }
.ra-keyrow { display: flex; gap: 12px; align-items: baseline; text-align: left; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); font: inherit; font-size: 12.5px; cursor: pointer; color: var(--text); }
.ra-keyrow b { font-variant-numeric: tabular-nums; min-width: 46px; }
.ra-keyrow span { color: var(--muted); }
.ra-keyrow.on { border-color: #FF9F0A; background: #FFF8EC; }
@media (max-width: 860px) { .ra-body { flex-direction: column; } .ra-stage { flex-basis: 45%; } }

/* the little looping demos on the cards */
.demo-in-none, .demo-out-none, .demo-move-none { opacity: .9; }
.demo-in-fade { animation: d-fade 1.8s ease-out infinite; }
.demo-in-rise { animation: d-rise 1.8s ease-out infinite; }
.demo-in-drop { animation: d-drop 1.8s ease-out infinite; }
.demo-in-slide { animation: d-slide 1.8s ease-out infinite; }
.demo-in-pop { animation: d-pop 1.8s cubic-bezier(.34,1.56,.64,1) infinite; }
.demo-in-zoom { animation: d-zoomin 1.8s ease-out infinite; }
.demo-in-spin { animation: d-spin 1.8s cubic-bezier(.34,1.56,.64,1) infinite; }
.demo-move-zoom-in { animation: d-grow 2.4s ease-in-out infinite alternate; }
.demo-move-zoom-out { animation: d-grow 2.4s ease-in-out infinite alternate-reverse; }
.demo-move-pan-left { animation: d-panx 2.4s ease-in-out infinite alternate-reverse; }
.demo-move-pan-right { animation: d-panx 2.4s ease-in-out infinite alternate; }
.demo-move-pan-up { animation: d-pany 2.4s ease-in-out infinite alternate-reverse; }
.demo-move-pan-down { animation: d-pany 2.4s ease-in-out infinite alternate; }
.demo-move-drift { animation: d-drift 3s ease-in-out infinite alternate; }
.demo-move-pulse { animation: d-pulse 1s ease-in-out infinite alternate; }
.demo-out-fade { animation: d-fadeout 1.8s ease-in infinite; }
.demo-out-sink { animation: d-sink 1.8s ease-in infinite; }
.demo-out-shrink { animation: d-shrink 1.8s ease-in infinite; }
@keyframes d-fade { 0%, 10% { opacity: 0; } 50%, 100% { opacity: 1; } }
@keyframes d-rise { 0%, 10% { opacity: 0; transform: translateY(14px); } 50%, 100% { opacity: 1; transform: none; } }
@keyframes d-drop { 0%, 10% { opacity: 0; transform: translateY(-14px); } 50%, 100% { opacity: 1; transform: none; } }
@keyframes d-slide { 0%, 10% { opacity: 0; transform: translateX(30px); } 50%, 100% { opacity: 1; transform: none; } }
@keyframes d-pop { 0%, 10% { opacity: 0; transform: scale(.3); } 50%, 100% { opacity: 1; transform: none; } }
@keyframes d-zoomin { 0%, 10% { opacity: 0; transform: scale(1.6); } 50%, 100% { opacity: 1; transform: none; } }
@keyframes d-spin { 0%, 10% { opacity: 0; transform: rotate(-90deg) scale(.4); } 55%, 100% { opacity: 1; transform: none; } }
@keyframes d-grow { from { transform: scale(1); } to { transform: scale(1.35); } }
@keyframes d-panx { from { transform: translateX(-12px); } to { transform: translateX(12px); } }
@keyframes d-pany { from { transform: translateY(-12px); } to { transform: translateY(12px); } }
@keyframes d-drift { from { transform: translateX(-5px) rotate(-6deg); } to { transform: translateX(5px) rotate(6deg); } }
@keyframes d-pulse { from { transform: scale(1); } to { transform: scale(1.15); } }
@keyframes d-fadeout { 0%, 40% { opacity: 1; } 90%, 100% { opacity: 0; } }
@keyframes d-sink { 0%, 40% { opacity: 1; transform: none; } 90%, 100% { opacity: 0; transform: translateY(14px); } }
@keyframes d-shrink { 0%, 40% { opacity: 1; transform: none; } 90%, 100% { opacity: 0; transform: scale(.4); } }
@media (prefers-reduced-motion: reduce) { .ra-demo i { animation: none !important; } }

/* reel: the recording notice sits over the top of the preview */
.rm-view .rm-exporting { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); z-index: 5; width: max-content; max-width: calc(100% - 32px);
  display: grid; grid-template-columns: auto auto; column-gap: 8px; row-gap: 4px; align-items: baseline; padding: 12px 18px 14px; border-radius: 14px; }
.rm-view .rm-exporting .hint { grid-column: 1 / -1; margin: 0; font-size: 11.5px; white-space: normal; }
.rm-view .rm-exporting::after { content: ""; grid-column: 1 / -1; height: 4px; border-radius: 2px; margin-top: 4px;
  background: linear-gradient(90deg, #FF3B30 var(--p, 0%), rgba(255,255,255,.18) var(--p, 0%)); }
.rm-view .rm-exporting b::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #FF3B30; margin-right: 8px; animation: rec-blink 1s steps(2, start) infinite; }
@keyframes rec-blink { to { visibility: hidden; } }
.vb-component .vb-canvas { background-color: #fff; background-image: linear-gradient(45deg, #EEE 25%, transparent 25%, transparent 75%, #EEE 75%), linear-gradient(45deg, #EEE 25%, transparent 25%, transparent 75%, #EEE 75%); background-size: 20px 20px; background-position: 0 0, 10px 10px; }
.vb-component.vb-on-dark .vb-canvas { background-color: #1D1D1F; background-image: none; }

/* reel covers on the home page */
.reel-thumb { position: relative; }
.reel-thumb img { height: 100%; width: auto; max-width: 100%; object-fit: cover; border-radius: 6px; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.reel-play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; padding-left: 3px; font-size: 15px; color: #fff; background: rgba(0,0,0,.45); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); opacity: .9; transition: opacity .15s ease, transform .15s ease; }
.design-tile:hover .reel-play { opacity: 1; transform: translate(-50%, -50%) scale(1.06); }
.audio-tile { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 14px; background: linear-gradient(160deg, #3A2A55, #1D1D1F); color: #fff; text-align: center; }
.audio-tile .lucide-glyph { font-size: 34px; opacity: .9; }
.audio-tile-name { font-size: 12px; line-height: 1.3; opacity: .85; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* song names on music tiles: readable at a glance */
.audio-tile { justify-content: center; gap: 12px; padding: 16px 14px; }
.audio-tile .audio-tile-name { font-size: 13px; font-weight: 600; line-height: 1.3; opacity: 1; -webkit-line-clamp: 3; word-break: break-word; text-transform: capitalize; }

/* the big +: what are you making? */
.make-dialog { width: min(640px, calc(100vw - 32px)); }
.make-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.make-card { font: inherit; color: var(--text); text-align: left; display: flex; flex-direction: column; gap: 4px; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); cursor: pointer; transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.make-card:hover { border-color: var(--blue); box-shadow: 0 8px 22px rgba(0,0,0,.08); transform: translateY(-2px); }
.make-card:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(0,113,227,.35); }
.make-card:disabled { opacity: .6; cursor: progress; }
.make-card b { font-size: 16px; }
.make-card .hint { font-size: 13px; }
.make-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--blue-tint, #EAF3FF); color: var(--blue); margin-bottom: 8px; }
.make-icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.make-count { margin-top: 6px; font-size: 12px; color: var(--muted, #86868B); }
.make-more { margin: 16px 2px 0; font-size: 13px; }
.pick-empty { grid-column: 1 / -1; }
@media (max-width: 520px) { .make-grid { grid-template-columns: 1fr; } }

/* reel: choosing a clip of a video */
.rm-clip { position: relative; height: 56px; border-radius: 10px; overflow: hidden; background: #1D1D1F; cursor: pointer; user-select: none; touch-action: none; }
.rm-clip.loading { background: repeating-linear-gradient(90deg, #2A2A2E 0 20px, #1D1D1F 20px 40px); }
.rm-clip-strip, .rm-clip-strip canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.rm-clip-strip::after { content: ""; position: absolute; inset: 0; background: rgba(0,0,0,.45); }
.rm-clip-win { position: absolute; top: 0; bottom: 0; min-width: 6px; border: 3px solid #FFD60A; border-radius: 8px; box-shadow: 0 0 0 999px rgba(0,0,0,.0), inset 0 0 0 999px rgba(255,255,255,.0); backdrop-filter: brightness(2.2); -webkit-backdrop-filter: brightness(2.2); cursor: grab; box-sizing: border-box; }
.rm-clip-win:active { cursor: grabbing; }
.rm-clip-edge { position: absolute; right: -6px; top: 50%; width: 10px; height: 26px; transform: translateY(-50%); border-radius: 4px; background: #FFD60A; cursor: ew-resize; box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.rm-clip-head { position: absolute; top: 0; bottom: 0; width: 2px; background: #fff; pointer-events: none; transform: translateX(-1px); }
.rm-clip-times { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; margin-top: 6px; font-variant-numeric: tabular-nums; }
.rm-clip-sec [data-add-clip] { align-self: flex-start; }
.demo-move-across-right { animation: d-across 2.8s ease-in-out infinite alternate; }
.demo-move-across-left { animation: d-across 2.8s ease-in-out infinite alternate-reverse; }
@keyframes d-across { from { transform: translateX(-16px) scale(1.15); } to { transform: translateX(16px) scale(1.15); } }
/* reel: a component's own text and pictures */
.rm-fields { gap: 10px; }
.rm-fields .field input { width: 100%; }
.rm-field-pic { display: inline-flex; align-items: center; gap: 8px; }
.rm-field-pic img { width: 40px; height: 40px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }

/* topbar without the section tabs: the brand crumb goes home, the page you're on shows after it */
.topbar-gap { flex: 1; }
.crumb.here { color: var(--muted); font-weight: 500; }
a.crumb:hover { color: var(--blue); }

/* canva2.ask(): a small naming dialog in place of the browser's prompt() */
.ask-dialog { width: min(420px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 16px; background: var(--panel); color: var(--text); box-shadow: 0 30px 80px rgba(0,0,0,.3); }
.ask-dialog::backdrop { background: rgba(0,0,0,.3); }
.ask-dialog form { display: flex; flex-direction: column; gap: 10px; padding: 22px; }
.ask-dialog h2 { margin: 0; font-size: 17px; }
.ask-dialog .hint { margin: -4px 0 2px; }
.ask-dialog input { font: inherit; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--text); }
.ask-dialog input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,113,227,.2); }
.ask-dialog .ask-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

/* ── Brand strategy as a document ─────────────────────────────────────────── */
.sdoc { display: grid; grid-template-columns: 220px minmax(0, 860px); justify-content: center; gap: 48px; padding: 40px 32px 120px; align-items: start; }
.sdoc-outline { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 2px; font-size: 13.5px; }
.sdoc-outline-label { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px 10px; }
.sdoc-toc { display: grid; grid-template-columns: 30px 1fr 14px; align-items: center; gap: 6px; padding: 7px 10px; border-radius: 8px; color: var(--text-2, #424245); text-decoration: none; }
.sdoc-toc:hover { background: var(--sunk); color: var(--text); }
.sdoc-toc[aria-current] { background: var(--panel); color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.sdoc-toc-num { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.sdoc-tick { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid #C7C7CC; }
.sdoc-tick[data-done="1"] { border-color: #34C759; background: #34C759 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5 9-10'/%3E%3C/svg%3E") center / 9px no-repeat; }
.sdoc-saved { margin: 14px 10px 0; font-size: 12px; color: var(--muted); }

.sdoc-paper { background: #fff; border-radius: 6px; box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 12px 40px rgba(0,0,0,.07); padding: 72px 88px 88px; color: #1D1D1F; }
.sdoc-cover { border-bottom: 1px solid #E5E5EA; padding-bottom: 36px; margin-bottom: 8px; }
.sdoc-kicker { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--b-accent, var(--blue)); }
.sdoc-cover h1 { font-family: var(--b-display); font-size: 52px; line-height: 1.05; letter-spacing: -.02em; margin: 10px 0 14px; color: var(--b-primary, #1D1D1F); }
.sdoc-intro { font-size: 16px; line-height: 1.6; color: #6E6E73; max-width: 60ch; margin: 0; }

.sdoc-sec { padding: 44px 0 8px; scroll-margin-top: 80px; }
.sdoc-sec + .sdoc-sec { border-top: 1px solid #F2F2F7; }
.sdoc-sec-head { display: flex; align-items: baseline; gap: 16px; }
.sdoc-num { font-size: 13px; font-weight: 700; color: var(--b-accent, var(--blue)); font-variant-numeric: tabular-nums; min-width: 30px; }
.sdoc-sec h2 { font-family: var(--b-display); font-size: 30px; letter-spacing: -.01em; margin: 0; }
.sdoc-guide { margin: 6px 0 22px 46px; color: #86868B; font-size: 14.5px; line-height: 1.55; font-style: italic; }
.sdoc-guide code { font-style: normal; }
.sdoc-sub { font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #6E6E73; margin: 30px 0 10px 46px; }

/* a question and its answer: the prompt in the margin, the answer as body text */
.sdoc-q { display: grid; grid-template-columns: 150px 1fr; gap: 0 22px; margin: 0 0 18px 46px; align-items: start; }
.sdoc-prompt { padding-top: 9px; font-size: 13px; font-weight: 700; color: #1D1D1F; line-height: 1.3; }
.sdoc-prompt span { display: block; font-weight: 400; color: #86868B; font-size: 12.5px; margin-top: 2px; }
.sdoc-values { grid-column: 2; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.sdoc-values .chip { background: color-mix(in srgb, var(--b-accent, #0071E3) 12%, white); color: #1D1D1F; border: 0; }

/* answers look like text on the page until you touch them */
.sdoc-text { display: block; width: 100%; box-sizing: border-box; font: inherit; font-size: 17px; line-height: 1.6; color: #1D1D1F; background: transparent; border: 0; border-radius: 6px; padding: 6px 10px; margin-left: -10px; width: calc(100% + 20px); resize: none; overflow: hidden; transition: background .12s ease, box-shadow .12s ease; }
.sdoc-text:hover { background: #F5F5F7; }
.sdoc-text:focus { outline: none; background: #F5F5F7; box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--blue) 55%, transparent); }
.sdoc-text::placeholder { color: #AEAEB2; font-style: italic; }
.sdoc-text:placeholder-shown { background: repeating-linear-gradient(90deg, #D1D1D6 0 4px, transparent 4px 8px) left calc(100% - 4px) / 100% 1px no-repeat; }
.sdoc-text.lead { font-size: 21px; line-height: 1.45; font-family: var(--b-display); letter-spacing: -.01em; }
.sdoc-h3 { font-family: var(--b-display); font-size: 22px; font-weight: 700; line-height: 1.3; }
.sdoc-oneliner { font-weight: 700; font-size: 18px; }

/* repeating rows: story chapters, messages, pillars — tools appear in the margin on hover */
.sdoc-chapter, .sdoc-message, .sdoc-pillar { position: relative; margin: 0 0 26px 46px; }
.sdoc-row-tools { position: absolute; left: -46px; top: 2px; display: flex; flex-direction: column; gap: 2px; opacity: 0; transition: opacity .12s ease; }
.sdoc-chapter:hover .sdoc-row-tools, .sdoc-message:hover .sdoc-row-tools, .sdoc-pillar:hover .sdoc-row-tools, .sdoc-row-tools:focus-within { opacity: 1; }
.sdoc-row-tools button { width: 28px; height: 26px; border: 0; border-radius: 6px; background: #F2F2F7; color: #6E6E73; cursor: pointer; font-size: 12px; }
.sdoc-row-tools button:hover { background: #E5E5EA; color: #1D1D1F; }
.sdoc-row-tools button.danger:hover { background: #FFE5E3; color: #D70015; }
.sdoc-chapter { display: grid; grid-template-columns: 1fr 150px; column-gap: 24px; }
.sdoc-chapter-num { grid-column: 1; font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--b-accent, var(--blue)); margin-bottom: 2px; }
.sdoc-chapter .sdoc-h3, .sdoc-chapter textarea { grid-column: 1; }
.sdoc-figure { grid-column: 2; grid-row: 1 / span 3; aspect-ratio: 4 / 5; border: 1.5px dashed #D1D1D6; border-radius: 8px; background: #FAFAFA; color: #8E8E93; font: inherit; font-size: 13px; cursor: pointer; position: relative; overflow: hidden; padding: 0; }
.sdoc-figure:hover { border-color: var(--blue); color: var(--blue); }
.sdoc-figure img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sdoc-figure:has(img) { border-style: solid; border-color: transparent; }
.sdoc-figure .chapter-photo-clear { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; display: grid; place-items: center; font-size: 11px; }
.sdoc-messages { list-style: none; padding: 0; margin: 0; }
.sdoc-message, .sdoc-pillar { display: grid; grid-template-columns: 34px 1fr; gap: 4px; }
.sdoc-msg-num { padding-top: 9px; font-size: 13px; font-weight: 700; color: #AEAEB2; font-variant-numeric: tabular-nums; }
.sdoc-add { margin: 0 0 8px 46px; border: 0; background: none; color: var(--blue); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; padding: 6px 0; }
.sdoc-add:hover { text-decoration: underline; }

/* tone: scales and a pull-quote caption */
.sdoc-scales { margin-left: 46px; display: grid; gap: 12px; }
.sdoc-scales .slider-row { grid-template-columns: 130px minmax(0, 1fr) 130px; font-size: 14px; color: #86868B; }
.sdoc-scales .slider-row .lean { color: #1D1D1F; font-weight: 600; }
.sdoc-scales input[type="range"] { accent-color: var(--b-accent, var(--blue)); }
.sdoc-sample { margin: 6px 0 18px 46px; padding: 0 0 0 22px; border-left: 3px solid var(--b-accent, var(--blue)); }
.sdoc-sample blockquote { margin: 0; white-space: pre-line; font-family: var(--b-display); font-size: 19px; line-height: 1.55; color: #1D1D1F; }
.sdoc-sample figcaption { margin-top: 10px; font-size: 13px; color: #86868B; font-style: italic; }
.sdoc-rules { margin: 0 0 0 46px; display: grid; grid-template-columns: max-content 1fr; gap: 6px 22px; font-size: 14px; }
.sdoc-rules dt { color: #86868B; }
.sdoc-rules dd { margin: 0; font-weight: 600; }

/* appendix */
.sdoc-checks { margin-left: 46px; display: grid; gap: 2px; }
.sdoc-next { display: flex; gap: 10px; margin: 24px 0 18px 46px; flex-wrap: wrap; }
.sdoc-details { margin: 0 0 10px 46px; border-top: 1px solid #F2F2F7; padding-top: 10px; }
.sdoc-details summary { cursor: pointer; font-size: 14px; color: #6E6E73; padding: 4px 0; }
.sdoc-details img, .sdoc-details pre { margin-top: 12px; }
.sdoc-details pre { max-height: 360px; overflow: auto; }

@media (max-width: 1000px) {
  .sdoc { grid-template-columns: minmax(0, 1fr); gap: 20px; padding: 20px 12px 80px; }
  .sdoc-outline { position: static; flex-direction: row; flex-wrap: wrap; }
  .sdoc-outline-label, .sdoc-saved { display: none; }
  .sdoc-paper { padding: 40px 24px 56px; }
  .sdoc-q { grid-template-columns: 1fr; margin-left: 0; }
  .sdoc-values { grid-column: 1; }
  .sdoc-guide, .sdoc-sub, .sdoc-chapter, .sdoc-message, .sdoc-pillar, .sdoc-add, .sdoc-scales, .sdoc-sample, .sdoc-rules, .sdoc-checks, .sdoc-next, .sdoc-details { margin-left: 0; }
  .sdoc-row-tools { position: static; flex-direction: row; opacity: 1; }
  .sdoc-chapter { grid-template-columns: 1fr 110px; }
}

/* buttons that are links never get the link underline */
a.btn, a.btn:hover, .sdoc a.btn { text-decoration: none; }
.sdoc-print { margin: 16px 10px 0; align-self: flex-start; }

/* ── Visual identity as a document ───────────────────────────────────────── */
.sdoc-block { margin: 0 0 18px 46px; }
.id-palette { display: flex; gap: 0; min-height: 210px; border-radius: 10px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(0,0,0,.06); }
.id-swatch { font: inherit; text-align: left; border: 0; cursor: pointer; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; padding: 14px 14px 12px; min-width: 0; font-size: 11.5px; line-height: 1.35; font-variant-numeric: tabular-nums; position: relative; transition: filter .12s ease; }
.id-swatch b { font-size: 14px; margin-bottom: 4px; }
.id-swatch em { font-style: normal; opacity: .7; margin-top: 6px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; }
.id-swatch:hover { filter: brightness(1.06); }
.id-swatch[aria-pressed="true"] { box-shadow: inset 0 0 0 3px var(--blue), inset 0 0 0 5px #fff; }
.id-swatch.add { flex: 0 0 52px; justify-content: center; align-items: center; background: #F5F5F7; color: #8E8E93; font-size: 22px; }
.id-swatch.add:hover { color: var(--blue); }
.id-editor { margin-top: 14px; padding: 18px 20px; border-radius: 12px; background: #F5F5F7; display: flex; flex-direction: column; gap: 12px; }
.id-editor h2 { font-size: 16px; margin: 0; }
.id-editor[hidden] { display: none; }
.id-specimens { display: flex; flex-direction: column; }
.id-specimens .style-row { padding: 16px 8px; border-radius: 8px; align-items: baseline; }
.id-specimens .style-label { width: 110px; flex: none; font-size: 12px; font-weight: 700; color: #86868B; text-transform: uppercase; letter-spacing: .06em; }
.id-specimens .style-sample { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.15; }
.id-specimens .style-meta { width: 130px; flex: none; text-align: right; font-size: 11.5px; color: #86868B; line-height: 1.4; }
.id-specimens .style-row:hover { background: #F5F5F7; }
.id-rules { display: grid; gap: 12px; margin-top: 16px; max-width: 560px; }
.id-rules .slider-row { grid-template-columns: 170px minmax(0, 1fr) 60px; font-size: 14px; }
.id-rules .slider-row label .hint { display: block; font-size: 11.5px; }
.sdoc-identity .logo-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.sdoc-identity .logo-tile { height: 120px; }
.id-category { position: relative; margin: 0 0 24px 46px; display: flex; flex-direction: column; gap: 4px; }
.id-category .row-head { display: flex; align-items: center; gap: 6px; }
.id-category input { font: inherit; font-family: var(--b-display); font-size: 20px; font-weight: 700; border: 0; background: transparent; padding: 4px 10px; margin-left: -10px; border-radius: 6px; flex: 1; }
.id-category textarea { font: inherit; font-size: 16px; line-height: 1.6; border: 0; background: transparent; padding: 4px 10px; margin-left: -10px; border-radius: 6px; resize: vertical; }
.id-category input:hover, .id-category textarea:hover, .id-category input:focus, .id-category textarea:focus { background: #F5F5F7; outline: none; }
.id-category .thumbs { margin-top: 6px; }
.id-category .thumbs img { width: 96px; height: 96px; }
.id-category .icon-btn { opacity: 0; }
.id-category:hover .icon-btn, .id-category .icon-btn:focus { opacity: 1; }

/* ── Printing the strategy or identity document: A4 pages, just the content ── */
@media print {
  body { background: #fff !important; }
  .sdoc { display: block; padding: 0; }
  .sdoc-outline, .sdoc-add, .sdoc-row-tools, .sdoc-guide, .sdoc-appendix, .id-editor, .id-swatch.add, .id-category .icon-btn, .thumb-add, .logo-slot .row-head, .sdoc-print, .sdoc-saved { display: none !important; }
  .sdoc-figure.empty, .chapter-photo-clear { display: none !important; }
  /* each numbered section starts on a new page, prompts stay in the margin */
  .sdoc-sec { break-before: page; border-top: 0 !important; padding-top: 0 !important; }
  .sdoc-cover + .sdoc-sec { break-before: auto; padding-top: 8mm !important; }   /* the first section shares page 1 with the title */
  .sdoc-q { grid-template-columns: 38mm 1fr !important; margin-left: 0 !important; }
  .sdoc-values { grid-column: 2 !important; margin-top: 4px; }
  #f-values { display: none !important; }   /* the values print as their tags; the typing box would cut them off */
  .sdoc-figure { border: 0 !important; }
  .sdoc { grid-template-columns: 1fr !important; }
  .sdoc-paper { box-shadow: none !important; border-radius: 0 !important; padding: 0 !important; max-width: none !important; }
  .sdoc-cover { padding-top: 0; padding-bottom: 10mm; }
  .sdoc, .sdoc-paper, body > main, body { margin-top: 0 !important; padding-top: 0 !important; }
  .sdoc-cover h1 { font-size: 46px; }
  .sdoc-sec { padding-top: 10mm; }
  .sdoc-sec-head, .sdoc-sub { break-after: avoid; }
  .sdoc-q, .sdoc-chapter, .sdoc-message, .sdoc-pillar, .sdoc-sample, .id-category, .id-palette, .style-row, .logo-tile, .matrix-row { break-inside: avoid; }
  .sdoc-text, .id-category input, .id-category textarea { background: none !important; box-shadow: none !important; }
  .sdoc-text:placeholder-shown { visibility: hidden; height: 0 !important; padding: 0; }
  .sdoc-text::placeholder { color: transparent; }
  .sdoc *, .sdoc-paper { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.btn.danger-text.warn { white-space: normal; text-align: left; line-height: 1.35; background: #FFF4E5; color: #A15C00; }
.rm-missing { margin: 0; padding: 10px 12px; border-radius: 10px; background: #FFF8D6; color: #6B5300; font-size: 13px; }

/* brand home: where the brand is up to, and empty shelves that say what to do */
.home-status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 18px; font-size: 13px; }
.home-status a, .home-status span { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px; background: rgba(255,255,255,.14); color: inherit; text-decoration: none; }
.home-status a:hover { background: rgba(255,255,255,.24); }
.home-status i { width: 8px; height: 8px; border-radius: 50%; background: #FF9F0A; }
.home-status a.ok i { background: #34C759; }
.home-status span { background: none; opacity: .8; padding-left: 4px; }
.shelf-empty-card { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 22px 24px; border: 1.5px dashed var(--line); border-radius: 16px; max-width: 460px; }
.shelf-empty-card b { font-size: 15px; }
.shelf-empty-card p { margin: 0 0 6px; color: var(--muted); font-size: 13.5px; line-height: 1.5; }

/* reel: voiceover */
.rm-voice-start { display: flex; gap: 6px; flex-wrap: wrap; }
.rm-voice-start + .hint { margin: 0; font-size: 12px; }
.rm-rec-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #FF3B30; margin-right: 2px; vertical-align: 0; }
.rm-mic { width: 15px; height: 15px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.rm-view .rm-exporting.rm-voice-rec::after { display: none; }
.rm-voice-rec .btn { justify-self: center; margin-top: 4px; }
@keyframes rm-blink { to { visibility: hidden; } }

/* landscape reels (16:9 videos): previews take the wide shape */
.rm-land .rm-view .rm-canvas-wrap { height: auto; width: 100%; max-height: 100%; max-width: min(100%, calc((100vh - 330px) * 16 / 9)); }
.rm-land .rm-scene canvas { width: 96px; height: 54px; }
.rm-land .ra-canvas { aspect-ratio: 16 / 9; flex: none; width: 100%; height: auto; }

/* ── Reel maker, simple by default ───────────────────────────────────────── */
.rm-scenes-head { gap: 6px; }
.rm-scenes-head b { margin-right: auto; }
.rm-adv-toggle[aria-pressed="true"] { background: var(--blue-tint); border-color: var(--blue); color: var(--blue-ink, var(--blue)); }

/* timeline: a bar for when each layer shows; a moment is one solid block you drag */
.rm-span { position: absolute; top: 12px; height: 10px; border-radius: 5px; background: rgba(0,113,227,.18); pointer-events: none; }
.rm-adv .rm-span { background: rgba(0,0,0,.06); }
.rm-block { position: absolute; top: 5px; height: 24px; border-radius: 7px; background: linear-gradient(180deg, #8E6CEF, #6E56CF); color: #fff; font-size: 11.5px; font-weight: 600; line-height: 24px; padding: 0 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: grab; box-shadow: 0 1px 3px rgba(0,0,0,.2); min-width: 14px; box-sizing: border-box; }
.rm-block:active { cursor: grabbing; }
.rm-lane.moment .rm-lane-name { color: #6E56CF; }
.rm-lane.on .rm-block { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #6E56CF; }

/* the add buttons on the scene panel */
.rm-add { display: flex; flex-direction: column; gap: 8px; padding: 4px 0 12px; }
.rm-add-big { display: grid; grid-template-columns: 34px 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; text-align: left; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); font: inherit; color: var(--text); cursor: pointer; }
.rm-add-big:hover { border-color: var(--blue); background: #F5F9FF; }
.rm-add-ico { grid-row: 1 / span 2; width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--blue-tint); color: var(--blue); font-size: 16px; }
.rm-add-big[data-add-moment] .rm-add-ico { background: #F0EBFF; color: #6E56CF; }
.rm-add-big b { font-size: 13.5px; }
.rm-add-big small { font-size: 11.5px; color: var(--muted); }
.rm-add select { font: inherit; font-size: 12.5px; padding: 7px 8px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel); color: var(--text-2, #424245); }

/* simple animation: three short rows of choices */
.rm-anim-simple { display: flex; flex-direction: column; gap: 8px; }
.rm-anim-simple > .hint { margin: 0; }
.rm-anim-row { display: flex; flex-direction: column; gap: 5px; }
.rm-anim-row > span { font-size: 11.5px; font-weight: 600; color: var(--muted); }
.rm-anim-row .rm-presets { display: flex; flex-wrap: wrap; gap: 4px; }
.rm-anim-row .chip { font-size: 11.5px; padding: 4px 9px; }
.rm-tip { margin: 4px 0 0; font-size: 12px; }
.rm-moment-name { font: inherit; font-size: 16px; font-weight: 700; border: 0; padding: 4px 8px; margin-left: -8px; border-radius: 6px; width: 100%; background: transparent; color: #6E56CF; }
.rm-moment-name:hover, .rm-moment-name:focus { background: var(--sunk); outline: none; }

/* the moments library */
.rm-moments { width: min(980px, calc(100vw - 32px)); }
.rm-mm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.rm-mm-card { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 8px; border: 1px solid var(--line); border-radius: 14px; cursor: pointer; background: var(--panel); }
.rm-mm-card:hover { border-color: #6E56CF; box-shadow: 0 6px 18px rgba(110,86,207,.15); }
.rm-mm-card canvas { width: 100%; height: auto; border-radius: 9px; display: block; background: #3A3A3E; }
.rm-mm-name { font-size: 13px; font-weight: 600; }
.rm-mm-card .hint { margin: 0; font-size: 11.5px; }
.rm-mm-del { position: absolute; top: 12px; right: 12px; border: 0; border-radius: 999px; background: rgba(0,0,0,.55); color: #fff; font-size: 11px; padding: 4px 8px; cursor: pointer; opacity: 0; }
.rm-mm-card:hover .rm-mm-del, .rm-mm-del[data-armed="1"] { opacity: 1; }
.rm-mm-del[data-armed="1"] { background: #D70015; }

/* add footage */
.rm-cutter { width: min(900px, calc(100vw - 32px)); }
.rm-cut-body { display: flex; flex-direction: column; gap: 12px; }
.rm-cut-body video { width: 100%; max-height: 52vh; background: #000; border-radius: 10px; }
.rm-cut-bar { position: relative; height: 22px; border-radius: 6px; background: var(--sunk); cursor: pointer; overflow: hidden; }
.rm-cut-strip span { position: absolute; top: 0; bottom: 0; background: #34C759; opacity: .75; }
.rm-cut-strip span.marking { background: #FF9F0A; }
.rm-cut-strip i { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--text); }
.rm-cut-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rm-cut-parts { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.rm-cut-parts li { display: flex; gap: 10px; align-items: baseline; }
.rm-cut-parts .hint { margin: 0; }
.btn:disabled { opacity: .45; cursor: default; pointer-events: none; }

/* ── Reel maker: one timeline (CapCut style) ─────────────────────────────── */
.rm-cc { display: grid; grid-template-columns: minmax(0, 1fr) 340px; grid-template-rows: minmax(0, 1fr) auto; }
.rm-cc .rm-stage { grid-column: 1; grid-row: 1; min-height: 0; }
.rm-cc .rm-stage > .rm-transport { align-self: center; margin: 0 0 12px; width: min(620px, calc(100% - 32px)); }
.rm-cc .rm-side { grid-column: 2; grid-row: 1; min-height: 0; overflow-y: auto; border-left: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; }
.rm-cc .rm-side > [data-rm-panel] { flex: 1; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.rm-sound { border-top: 1px solid var(--line); padding: 10px 14px 14px; display: flex; flex-direction: column; gap: 8px; }
.rm-sound summary { cursor: pointer; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 2px 0 6px; }
.rm-sound[open] { gap: 8px; }
.rm-sound .rm-music { margin-bottom: 8px; }
.rm-add-row { display: flex; gap: 6px; flex-wrap: wrap; }
.rm-land .rm-view .rm-canvas-wrap { max-width: min(100%, calc((100vh - 420px) * 16 / 9)); }

.rm-tl { grid-column: 1 / -1; grid-row: 2; background: var(--panel); border-top: 1px solid var(--line); user-select: none; }
.rm-tl-dragging, .rm-tl-dragging * { cursor: grabbing !important; }
.tl-tools { display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-bottom: 1px solid var(--line); }
.tl-tools .icon-btn { width: 30px; height: 30px; font-size: 15px; }
.tl-sep { width: 1px; height: 18px; background: var(--line); margin: 0 4px; }
.tl-len { margin: 0 0 0 auto; font-variant-numeric: tabular-nums; font-size: 12px; }
.tl-body { display: grid; grid-template-columns: 96px minmax(0, 1fr); }
.tl-names { display: flex; flex-direction: column; border-right: 1px solid var(--line); background: var(--panel); }
.tl-names > span { display: flex; align-items: center; gap: 6px; padding: 0 10px; font-size: 11.5px; font-weight: 600; color: var(--muted); height: 30px; border-bottom: 1px solid var(--line); box-sizing: border-box; }
.tl-names .tl-n-ruler { height: 22px; }
.tl-names .tl-n-main { height: 56px; }
.tl-names .rm-mic { width: 13px; height: 13px; }
.tl-scroll { overflow-x: auto; overflow-y: hidden; position: relative; }
.tl-inner { position: relative; min-width: 100%; padding-right: 40px; box-sizing: content-box; }
.tl-ruler { position: relative; height: 22px; border-bottom: 1px solid var(--line); cursor: pointer; }
.tl-ruler span { position: absolute; top: 5px; font-size: 10.5px; color: var(--muted); padding-left: 4px; border-left: 1px solid var(--line-strong, #D2D2D7); line-height: 12px; font-variant-numeric: tabular-nums; }
.tl-lane { position: relative; height: 30px; border-bottom: 1px solid var(--line); box-sizing: border-box; }
.tl-main { height: 56px; background: var(--sunk); }
.tl-empty { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-size: 11.5px; color: var(--muted); white-space: nowrap; pointer-events: none; }
.tl-block { position: absolute; height: 24px; border-radius: 6px; background: linear-gradient(180deg, #8E6CEF, #6E56CF); color: #fff; font-size: 11.5px; font-weight: 600; line-height: 24px; padding: 0 10px 0 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: grab; box-sizing: border-box; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.tl-block.on { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #6E56CF; z-index: 2; }
.tl-clip { position: absolute; top: 4px; height: 48px; border-radius: 8px; background: #2C2C30; color: #fff; overflow: hidden; display: flex; align-items: center; gap: 8px; cursor: grab; box-sizing: border-box; border: 2px solid transparent; }
.tl-clip.on { border-color: #FFD60A; z-index: 2; }
.tl-clip canvas { height: 44px; width: auto; flex: none; opacity: .95; }
.tl-clip-label { display: flex; flex-direction: column; font-size: 11px; font-weight: 600; white-space: nowrap; overflow: hidden; min-width: 0; padding-right: 10px; }
.tl-clip-label small { font-weight: 400; opacity: .7; }
.tl-edge { position: absolute; top: 0; bottom: 0; width: 9px; cursor: ew-resize; z-index: 1; }
.tl-edge.l { left: 0; }
.tl-edge.r { right: 0; }
.tl-clip.on .tl-edge, .tl-clip:hover .tl-edge { background: rgba(255,214,10,.85); }
.tl-block .tl-edge.r { width: 7px; }
.tl-block:hover .tl-edge, .tl-block.on .tl-edge { background: rgba(255,255,255,.45); }
.tl-join { position: absolute; top: 18px; width: 20px; height: 20px; margin-left: -10px; border-radius: 50%; border: 0; background: var(--panel); color: var(--muted); font-size: 11px; line-height: 20px; padding: 0; cursor: pointer; z-index: 3; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.tl-join.on { color: var(--blue); }
.tl-voiceblock { position: absolute; top: 4px; height: 22px; border-radius: 6px; background: #E8F7EC; border: 1px solid #34C759; color: #1E7B34; font-size: 11px; font-weight: 600; line-height: 20px; padding: 0 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: grab; box-sizing: border-box; }
.tl-music { height: 26px; }
.tl-musicbar { position: absolute; left: 0; top: 3px; height: 20px; border-radius: 6px; background: repeating-linear-gradient(90deg, #EAF2FF 0 6px, #DCE9FF 6px 9px); border: 1px solid #B7D2FF; color: var(--blue-ink, #0040A0); font-size: 11px; line-height: 18px; padding: 0 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; box-sizing: border-box; }
.tl-playhead { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: #FF3B30; pointer-events: none; z-index: 4; }
.tl-playhead::before { content: ""; position: absolute; top: 0; left: -5px; border: 6px solid transparent; border-top-color: #FF3B30; }
.tl-drop { position: absolute; top: 22px; bottom: 0; width: 3px; margin-left: -1px; background: var(--blue); z-index: 5; pointer-events: none; }

/* reel: the size in the header opens Resize; reels are pixels only (no units, no DPI) */
.rm-size-btn { border: 0; background: none; font: inherit; cursor: pointer; padding: 4px 8px; border-radius: 6px; }
.rm-size-btn:hover { background: var(--sunk); color: var(--text); }
body:has(.rm) .vb-size-dialog .vb-num:has([data-cs-unit]), body:has(.rm) .vb-size-dialog .vb-num:has([data-cs-dpi]), body:has(.rm) .vb-size-note { display: none; }

/* canva2.busy(): a calm full-screen cover with a spinner while something big happens */
.busy-cover { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; background: rgba(245,245,247,.0); backdrop-filter: blur(0); transition: background .2s ease, backdrop-filter .2s ease; }
.busy-cover.on { background: rgba(245,245,247,.72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.busy-card { display: flex; align-items: center; gap: 14px; padding: 18px 24px; border-radius: 16px; background: var(--panel, #fff); box-shadow: 0 20px 60px rgba(0,0,0,.18); font-size: 15px; opacity: 0; transform: translateY(6px) scale(.98); transition: opacity .2s ease, transform .2s ease; }
.busy-cover.on .busy-card { opacity: 1; transform: none; }
.busy-spin { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--blue-tint, #EAF3FF); border-top-color: var(--blue, #0071E3); animation: spin .8s linear infinite; }

/* reel: Edit JSON, the same dark editor as templates */
.rm-json { width: min(1100px, calc(100vw - 32px)); height: min(820px, calc(100vh - 48px)); padding: 0; border: 0; border-radius: 16px; overflow: hidden; background: #1D1D1F; color: #F5F5F7; box-shadow: 0 30px 80px rgba(0,0,0,.4); }
.rm-json[open] { display: flex; flex-direction: column; }
.rm-json::backdrop { background: rgba(0,0,0,.35); }
.rm-json-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid #3A3A3C; flex-wrap: wrap; }
.rm-json-head .hint { color: #AEAEB2; margin: 0 auto 0 4px; font-size: 12.5px; }
.rm-json-head .btn { min-height: 30px; padding: 4px 14px; font-size: 12.5px; }
.rm-json-head .btn:not(.primary) { background: #2C2C2E; color: #F5F5F7; border-color: #48484A; }
.rm-json-head .icon-btn { color: #F5F5F7; background: #2C2C2E; }
.rm-json-err { color: #FF9F0A; font-size: 12px; font-family: ui-monospace, Menlo, monospace; }
.rm-json-code { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.rm-json-code .tm-editor textarea { flex: 1; width: 100%; height: 100%; border: 0; outline: none; resize: none; overflow: auto; }

/* reel panel: what the animation is, and the way into the Animate window */
.rm-anim-sum { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: 10px; background: var(--soft, #f5f5f7); font-size: 13px; }
.rm-anim-sum span { display: flex; justify-content: space-between; gap: 10px; }
.rm-anim-sum b { font-weight: 600; color: var(--muted); }
.rm-anim-open { width: 100%; justify-content: center; margin-top: 8px; }
.rm-anim-parts { display: flex; flex-wrap: wrap; gap: 6px; }

/* tracks: videos on top, and any number of audio tracks */
.tl-tracks, .tl-audio { background: rgba(0,0,0,.015); }
.tl-vblock { background: linear-gradient(180deg, #3A3A3F, #232326); }
.tl-vblock.on { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #FFD60A; }
.tl-vblock .tl-edge.l { width: 7px; }
.tl-ablock { position: absolute; height: 24px; border-radius: 6px; background: repeating-linear-gradient(90deg, #EAF2FF 0 6px, #DCE9FF 6px 9px); border: 1px solid #9DC0FF; color: #0040A0; font-size: 11px; font-weight: 600; line-height: 22px; padding: 0 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: grab; box-sizing: border-box; display: flex; align-items: center; gap: 4px; }
.tl-ablock.talk { background: #E8F7EC; border-color: #34C759; color: #1E7B34; }
.tl-ablock.on { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #0071E3; z-index: 2; }
.tl-ablock .tl-edge { width: 7px; }
.tl-ablock:hover .tl-edge, .tl-ablock.on .tl-edge { background: rgba(0,0,0,.18); }
.tl-ablock .rm-mic { width: 12px; height: 12px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; }
.tl-ablock .rm-mic rect { fill: currentColor; stroke: none; }
.rm-add-audio { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.rm-add-label { font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.rm-side .pe-sel-head .rm-mic { width: 18px; height: 18px; flex: none; }
.rm-note { font-size: 18px; color: var(--muted); }

/* the timeline's right-click menu */
.tl-menu { position: fixed; z-index: 1000; min-width: 220px; padding: 5px; background: var(--panel, #fff); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(0,0,0,.18); }
.tl-menu[hidden] { display: none; }
.tl-menu button { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; padding: 7px 10px; border: 0; border-radius: 6px; background: none; font: inherit; font-size: 13px; color: inherit; text-align: left; cursor: pointer; }
.tl-menu button:hover:not(:disabled) { background: #0071E3; color: #fff; }
.tl-menu button:disabled { opacity: .4; cursor: default; }
.tl-menu button.danger { color: #D70015; }
.tl-menu button.danger:hover { background: #D70015; color: #fff; }
.tl-menu kbd { font: inherit; font-size: 11.5px; opacity: .55; }
.tl-menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 6px; }
/* track lanes: a faint line between the tracks */
.tl-tracks, .tl-audio { background-image: repeating-linear-gradient(to bottom, transparent 0 29px, rgba(0,0,0,.06) 29px 30px); }
/* transition icons */
.tr-ico { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; vertical-align: -2px; }
.tl-join { display: grid; place-items: center; width: 22px; height: 22px; margin-left: -11px; }
.tl-join .tr-ico { width: 13px; height: 13px; }
.tl-join.on { background: var(--blue, #0071E3); color: #fff; }
.pe-seg .tr-ico { margin-right: 3px; }

.tl-tracks:empty, .tl-tracks[style*="height:0px"] { border-bottom: 0; }

.tl-menu { max-height: min(70vh, 520px); overflow-y: auto; }

/* the number box beside every slider */
.range-box { display: inline-flex; align-items: center; gap: 2px; margin-left: auto; flex: none; }
.range-box input { width: 58px; height: 24px; padding: 0 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel, #fff); font: inherit; font-size: 12px; text-align: right; color: inherit; -moz-appearance: textfield; }
.range-box input::-webkit-inner-spin-button, .range-box input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.range-box input:focus { outline: 2px solid var(--blue, #0071E3); outline-offset: 0; border-color: transparent; }
.range-box i { font-style: normal; font-size: 11.5px; color: var(--muted); min-width: 10px; }
.pe-row > span:has(.range-box) { display: flex; align-items: center; gap: 8px; }
.slider-row:has(.range-box) { align-items: center; }

/* side panel: the two buttons into the big window, and a video's part */
.rm-look { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 4px 0 12px; }
.rm-look-btn { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: center; text-align: left; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel, #fff); font: inherit; color: inherit; cursor: pointer; }
.rm-look-btn:hover { border-color: var(--blue, #0071E3); background: rgba(0,113,227,.04); }
.rm-look-ico { grid-row: span 2; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: rgba(0,113,227,.1); color: var(--blue, #0071E3); font-size: 15px; }
.rm-look-btn b { font-size: 13px; }
.rm-look-btn small { font-size: 11.5px; color: var(--muted); line-height: 1.3; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.rm-part { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 8px 10px; border-radius: 8px; background: var(--soft, #f5f5f7); font-size: 13px; margin-bottom: 8px; }
/* Choose the part */
dialog.rm-trim { width: min(980px, 96vw); height: auto; max-height: 92vh; }
.rm-trim-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 12px; overflow: auto; }
.rm-trim-view { display: grid; place-items: center; background: #111; border-radius: 12px; height: min(46vh, 420px); overflow: hidden; }
.rm-trim-view video { max-width: 100%; max-height: 100%; }
.rm-trim-strip { position: relative; height: 58px; border-radius: 8px; overflow: hidden; background: #2a2a2e; cursor: pointer; touch-action: none; }
.rm-trim-strip.loading { opacity: .5; }
.rm-trim-film, .rm-trim-film canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.rm-trim-win { position: absolute; top: 0; bottom: 0; border: 3px solid #FFD60A; border-radius: 8px; box-shadow: 0 0 0 999px rgba(0,0,0,.55); cursor: grab; box-sizing: border-box; }
.rm-trim-edge { position: absolute; top: 0; bottom: 0; width: 14px; cursor: ew-resize; background: #FFD60A; }
.rm-trim-edge.l { left: -3px; border-radius: 6px 0 0 6px; }
.rm-trim-edge.r { right: -3px; border-radius: 0 6px 6px 0; }
.rm-trim-head { position: absolute; top: -2px; bottom: -2px; width: 2px; background: #fff; pointer-events: none; }
.rm-trim-times { display: flex; justify-content: space-between; font-size: 13px; }
.rm-trim-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.rm-trim-acts { display: flex; flex-wrap: wrap; gap: 8px; }
/* the components picker */
.rm-cp-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.rm-cp-pic { display: grid; place-items: center; height: 150px; border-radius: 10px; overflow: hidden; padding: 10px; box-sizing: border-box;
  background: repeating-conic-gradient(#ececf0 0 25%, #f7f7f9 0 50%) 0 0 / 16px 16px; }
.rm-cp-pic.dark { background: #1D1D1F; }
.rm-cp-pic img { max-width: 100%; max-height: 100%; object-fit: contain; }
.rm-cp-card[hidden] { display: none; }
.rm-cp-q { height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: 13px; width: 180px; }
.rm-cp-dark { margin: 0 6px; white-space: nowrap; }
.ra-fit { display: flex; flex-wrap: wrap; gap: 6px; }

/* the preview only picks things now: moving and sizing live in Position */
.rm-view { cursor: default; }

.ra-trans .ra-demo { display: grid; place-items: center; color: var(--blue, #0071E3); }
.ra-trans .ra-demo .tr-ico { width: 28px; height: 28px; }

.rm-trim-speed .pe-seg button { font-variant-numeric: tabular-nums; }

/* signing in, like Blueprint Replay */
.auth-page { min-height: 100vh; margin: 0; display: grid; place-items: center; background: #FAFAFC; }
.auth-wrap { width: min(420px, calc(100vw - 32px)); display: flex; flex-direction: column; align-items: center; gap: 28px; padding: 40px 0; }
.auth-mark { display: flex; align-items: center; gap: 14px; font-size: 22px; font-weight: 600; letter-spacing: -.01em; color: #1D1D1F; }
.auth-mark-ico { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: #1D1D1F; color: #fff; }
.auth-mark-ico svg { width: 20px; height: 20px; }
.auth-card { width: 100%; box-sizing: border-box; background: #fff; border: 1px solid #E5E5EA; border-radius: 18px; padding: 40px 40px 36px; }
.auth-card h1 { font-size: 28px; letter-spacing: -.02em; margin: 0 0 8px; }
.auth-sub { margin: 0 0 26px; font-size: 16px; color: #3A3A3C; }
.auth-card form { display: flex; flex-direction: column; gap: 18px; }
.auth-card .field { display: flex; flex-direction: column; gap: 8px; }
.auth-card .field .label { font-size: 15px; color: #6E6E73; font-weight: 500; }
.auth-card .field input { width: 100%; box-sizing: border-box; height: 52px; padding: 0 14px; border: 1px solid #D2D2D7; border-radius: 12px; font: inherit; font-size: 16px; background: #fff; }
.auth-card .field input:focus { outline: none; border-color: #0071E3; box-shadow: 0 0 0 1px #0071E3; }
.auth-go { display: flex; align-items: center; justify-content: center; width: 100%; height: 52px; margin-top: 4px; border: 0; border-radius: 12px; background: #1D1D1F; color: #fff; font: inherit; font-size: 17px; font-weight: 500; cursor: pointer; text-decoration: none; }
.auth-go:hover { background: #000; }
.auth-row { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.auth-error { margin: 0; color: #D70015; font-size: 14px; }
.auth-foot { margin: 0; font-size: 14px; color: #8E8E93; letter-spacing: .01em; }
.user-menu { position: relative; }
.user-menu summary { list-style: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--blue, #0071E3); color: #fff; font-weight: 600; font-size: 13px; cursor: pointer; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-pop { position: absolute; right: 0; top: calc(100% + 8px); z-index: 50; display: flex; flex-direction: column; gap: 6px; min-width: 220px; padding: 14px; background: var(--panel, #fff); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,.12); }
.user-pop .btn { align-self: flex-start; margin-top: 6px; }

/* the Integrations page */
.int-back { margin: 0 0 6px; font-size: 13px; }
.int-back a, .int-link { color: var(--blue, #0071E3); text-decoration: none; }
.int-card { background: var(--panel, #fff); border: 1px solid var(--line); border-radius: 16px; padding: 22px 24px; margin: 18px 0; }
.int-card h2 { font-size: 17px; margin: 0 0 12px; }
.int-steps { margin: 0 0 18px; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.int-code { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; background: var(--soft, #f5f5f7); padding: 2px 6px; border-radius: 6px; }
.int-new { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; }
.int-new .field { display: flex; flex-direction: column; gap: 4px; }
.int-new .field input { width: 220px; }
.int-token { border: 1px solid #34C759; background: #F0FAF2; border-radius: 12px; padding: 14px 16px; }
.int-token p { margin: 0 0 8px; font-size: 14px; }
.int-token-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.int-token-row code { flex: 1; min-width: 0; overflow-wrap: anywhere; font-family: ui-monospace, Menlo, monospace; font-size: 13px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.int-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.int-table th { text-align: left; font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding: 0 8px 8px 0; }
.int-table td { padding: 10px 8px 10px 0; border-top: 1px solid var(--line); vertical-align: middle; }
.int-act { text-align: right; }
.int-badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--soft, #f2f2f7); color: var(--muted); }
.int-changes { list-style: none; margin: 0; padding: 0; }
.int-changes li { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); font-size: 14px; }
.int-changes li:first-child { border-top: 0; }
.int-changes li p { margin: 2px 0; color: #3A3A3C; font-size: 13px; }
.int-changes li.undone b { text-decoration: line-through; color: var(--muted); }
.int-new[hidden] { display: none; }
/* Integrations: read or write */
.int-access { display: flex; flex-direction: column; gap: 4px; }
.int-seg { display: inline-flex; background: var(--soft, #F2F2F7); border-radius: 10px; padding: 3px; gap: 2px; }
.int-seg label { position: relative; cursor: pointer; }
.int-seg input { position: absolute; opacity: 0; pointer-events: none; }
.int-seg span { display: block; padding: 6px 14px; border-radius: 8px; font-size: 13px; color: var(--muted); }
.int-seg input:checked + span { background: #fff; color: var(--text, #1D1D1F); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.int-seg input:focus-visible + span { outline: 2px solid var(--blue, #0071E3); }
.int-access-note { flex-basis: 100%; margin: 0; }
.int-badge.write { background: #E8F1FD; color: #0040A0; }
