/* Step Guide Studio v3 — scoped to #sgApp so it cannot clash with app.css */
:root { --sg-top: 64px; }

#sgApp, #sgApp *, .sg-menu, .sg-menu *, .sg-modal, .sg-modal *,
#sgCapBar, #sgCapBar *, #sgArea, #sgArea *, #sgToast, #sgDrop { box-sizing: border-box; }

/* Design tokens live on :root, not on #sgApp, because the menus, modals,
   capture bar and area selector are rendered outside #sgApp. Scoping them to
   #sgApp left those overlays with unresolved var() values and therefore
   transparent backgrounds. */
:root {
  --sg-accent: #5b4cf5;
  --sg-bg: #eef0f6;
  --sg-surface: #ffffff;
  --sg-surface2: #f6f7fb;
  --sg-surface3: #eceffa;
  --sg-line: #e1e5f0;
  --sg-line2: #cdd4e6;
  --sg-text: #171b26;
  --sg-text2: #545c73;
  --sg-text3: #8d96ad;
  --sg-danger: #d92d20;
  --sg-ok: #0f9d58;
  --sg-r: 10px;
  --sg-shadow: 0 6px 28px rgba(20, 26, 45, .1);
}
:root[data-theme="dark"] {
  --sg-bg: #0f111a; --sg-surface: #171a26; --sg-surface2: #1d2130; --sg-surface3: #262b3d;
  --sg-line: #262b3b; --sg-line2: #343a4f; --sg-text: #e4e7f3; --sg-text2: #9aa2bd; --sg-text3: #6b7490;
  --sg-shadow: 0 6px 28px rgba(0, 0, 0, .45);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --sg-bg: #0f111a; --sg-surface: #171a26; --sg-surface2: #1d2130; --sg-surface3: #262b3d;
    --sg-line: #262b3b; --sg-line2: #343a4f; --sg-text: #e4e7f3; --sg-text2: #9aa2bd; --sg-text3: #6b7490;
    --sg-shadow: 0 6px 28px rgba(0, 0, 0, .45);
  }
}
#sgApp {
  position: relative;
  height: calc(100dvh - var(--sg-top));
  min-height: 520px;
  display: grid;
  grid-template-rows: auto 1fr;
  background: var(--sg-bg);
  color: var(--sg-text);
  font-family: Manrope, ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: 13px;
  line-height: 1.5;
  overflow: hidden;
  opacity: 0;
  transition: opacity .18s;
}
/* overlays render outside #sgApp, so they need the base typography too */
.sg-menu, .sg-modal, #sgCapBar, #sgArea, #sgToast, #sgDrop {
  font-family: Manrope, ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: 13px; line-height: 1.5;
}
.sg-menu button, .sg-modal button, .sg-modal input, .sg-modal select, .sg-modal textarea,
#sgCapBar button, #sgArea button { font-family: inherit; }
.sg-menu button, #sgCapBar button, #sgArea button { border: 0; background: none; cursor: pointer; color: inherit; }
.sg-modal button { border: 0; background: none; cursor: pointer; }
.sg-modal input, .sg-modal select, .sg-modal textarea { font-size: inherit; color: var(--sg-text); }
.sg-menu, .sg-modal .sg-box { color: var(--sg-text); }
#sgApp.ready { opacity: 1; }
#sgApp button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
#sgApp input, #sgApp select, #sgApp textarea { font: inherit; color: inherit; }
#sgApp [hidden] { display: none !important; }
#sgApp ::-webkit-scrollbar { width: 9px; height: 9px; }
#sgApp ::-webkit-scrollbar-thumb { background: var(--sg-line2); border-radius: 5px; border: 2px solid transparent; background-clip: content-box; }

/* ---------- top bar ---------- */
.sg-top {
  display: flex; align-items: center; gap: 6px; padding: 7px 10px;
  background: var(--sg-surface); border-bottom: 1px solid var(--sg-line); position: relative; z-index: 6;
  overflow-x: auto; scrollbar-width: none;
}
.sg-top::-webkit-scrollbar { display: none; }
#sgTitle {
  flex: 0 1 230px; min-width: 120px; padding: 6px 9px; font-size: 14px; font-weight: 700;
  background: transparent; border: 1px solid transparent; border-radius: 8px;
}
#sgTitle:hover { border-color: var(--sg-line); }
#sgTitle:focus { outline: none; border-color: var(--sg-accent); background: var(--sg-surface2); }
.sg-tbtn {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 10px; border-radius: 9px;
  font-size: 12.5px; font-weight: 600; color: var(--sg-text2); white-space: nowrap; transition: background .12s, color .12s;
}
.sg-tbtn:hover { background: var(--sg-surface2); color: var(--sg-text); }
.sg-tbtn.primary { background: var(--sg-accent); color: #fff; }
.sg-tbtn.primary:hover { filter: brightness(1.08); }
.sg-tbtn:disabled { opacity: .38; cursor: default; }
.sg-tbtn .ic { font-size: 14px; line-height: 1; }
.sg-sep { width: 1px; height: 24px; background: var(--sg-line); flex: none; margin: 0 2px; }
.sg-spacer { flex: 1 1 auto; }
#sgSave { font-size: 11.5px; color: var(--sg-text3); white-space: nowrap; display: flex; align-items: center; gap: 5px; }
#sgSave::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--sg-text3); }
#sgSave.ok::before { background: var(--sg-ok); }
#sgExtState { font-size: 11px; color: var(--sg-text3); }

/* ---------- layout ---------- */
.sg-body { display: grid; grid-template-columns: 216px 1fr 296px; min-height: 0; }
#sgApp.hide-left .sg-body { grid-template-columns: 0 1fr 296px; }
#sgApp.hide-right .sg-body { grid-template-columns: 216px 1fr 0; }
#sgApp.hide-left.hide-right .sg-body { grid-template-columns: 0 1fr 0; }
.sg-side { background: var(--sg-surface); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.sg-side.left { border-right: 1px solid var(--sg-line); }
.sg-side.right { border-left: 1px solid var(--sg-line); }
#sgApp.hide-left .sg-side.left, #sgApp.hide-right .sg-side.right { display: none; }
.sg-side-h {
  display: flex; align-items: center; gap: 6px; padding: 9px 10px; border-bottom: 1px solid var(--sg-line); flex: none;
}
.sg-side-h b { font-size: 12px; font-weight: 700; }
.sg-side-h .n { font-size: 11px; color: var(--sg-text3); }
.sg-mini {
  width: 26px; height: 26px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center;
  color: var(--sg-text2); font-size: 14px;
}
.sg-mini:hover { background: var(--sg-surface2); color: var(--sg-accent); }
.sg-center { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }

/* ---------- page list ---------- */
#sgPageList { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.sg-pg {
  display: grid; grid-template-columns: 62px 1fr auto; gap: 8px; align-items: center;
  padding: 5px; border-radius: 9px; border: 1.5px solid transparent; background: var(--sg-surface2); cursor: pointer;
}
.sg-pg:hover { border-color: var(--sg-line2); }
.sg-pg.on { border-color: var(--sg-accent); background: var(--sg-surface3); }
.sg-pg.drag { opacity: .4; }
.sg-pg.over { border-top: 2px solid var(--sg-accent); }
.sg-pg-th {
  width: 62px; height: 38px; border-radius: 6px; overflow: hidden; background: var(--sg-surface3);
  display: flex; align-items: center; justify-content: center; color: var(--sg-text3);
}
.sg-pg-th img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sg-pg-ico { font-size: 15px; }
.sg-pg-meta { min-width: 0; }
.sg-pg-t { display: block; font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sg-pg-b { display: inline-block; font-size: 9.5px; font-weight: 700; padding: 1px 5px; border-radius: 6px; background: var(--sg-surface3); color: var(--sg-text3); margin-top: 2px; }
.sg-pg.on .sg-pg-b { background: #fff; color: var(--sg-accent); }
.sg-pg-menu { color: var(--sg-text3); padding: 2px 4px; border-radius: 5px; font-size: 14px; }
.sg-pg-menu:hover { background: var(--sg-surface3); color: var(--sg-text); }

/* ---------- object tools ---------- */
#sgTools {
  display: flex; align-items: center; gap: 2px; padding: 5px 8px; background: var(--sg-surface);
  border-bottom: 1px solid var(--sg-line); overflow-x: auto; scrollbar-width: none; flex: none;
}
#sgTools::-webkit-scrollbar { display: none; }
.sg-tool {
  width: 31px; height: 31px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center;
  color: var(--sg-text2); font-size: 15px; flex: none; position: relative;
}
.sg-tool:hover { background: var(--sg-surface2); color: var(--sg-text); }
.sg-tool.on { background: var(--sg-surface3); color: var(--sg-accent); box-shadow: inset 0 0 0 1.5px var(--sg-accent); }
.sg-tool svg { width: 17px; height: 17px; }
.sg-zoom { margin-left: auto; display: flex; align-items: center; gap: 2px; flex: none; }
#sgZoomLbl { font-size: 11.5px; font-weight: 600; color: var(--sg-text2); min-width: 42px; text-align: center; }

/* ---------- stage ---------- */
#sgStageWrap, #sgDocWrap {
  flex: 1; min-height: 0; overflow: auto; display: flex; align-items: flex-start; justify-content: center; padding: 26px;
  background: var(--sg-bg);
  background-image: radial-gradient(circle at 1px 1px, rgba(120, 130, 160, .16) 1px, transparent 0);
  background-size: 22px 22px;
}
#sgStage { position: relative; flex: none; box-shadow: 0 10px 42px rgba(18, 24, 44, .18); border-radius: 6px; background: #fff; }
#sgSvg { display: block; border-radius: 6px; touch-action: none; user-select: none; }
#sgSvg.crosshair { cursor: crosshair; }
#sgObjs [data-oid] { cursor: move; }
#sgObjs [data-oid].on { outline: none; }
.sg-h { fill: #fff; stroke: var(--sg-accent); stroke-width: 1.6; vector-effect: non-scaling-stroke; cursor: pointer; }
.sg-h2 { fill: var(--sg-accent); }
.sg-h3 { fill: #fff; stroke: #f59e0b; }
.sg-guides line { stroke: #ff3b8d; stroke-dasharray: 4 3; }
.sg-marq { fill: rgba(91, 76, 245, .1); stroke: var(--sg-accent); stroke-dasharray: 4 3; }
#sgNoPage {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; text-align: center; color: var(--sg-text3); padding: 30px;
}
#sgNoPage h3 { margin: 0; font-size: 17px; color: var(--sg-text2); }
#sgNoPage p { margin: 0; max-width: 330px; line-height: 1.6; }

/* ---------- document pages ---------- */
#sgDocPage { transform-origin: top center; flex: none; }
.sgd-page {
  width: var(--sgd-w); min-height: var(--sgd-h); padding: var(--sgd-m); background: var(--sgd-bg);
  box-shadow: 0 10px 42px rgba(18, 24, 44, .16); font-family: var(--sgd-b); color: var(--sgd-text);
  display: flex; flex-direction: column; font-size: var(--sgd-body); line-height: 1.65;
}
.sgd-hdr, .sgd-ftr { display: flex; justify-content: space-between; gap: 12px; font-size: 11px; align-items: center; }
.sgd-hdr { padding-bottom: 8px; margin-bottom: 16px; }
.sgd-ftr { padding-top: 8px; margin-top: auto; }
.sgd-hdr.line { border-bottom: 1px solid #e3e7f0; }
.sgd-ftr.line { border-top: 1px solid #e3e7f0; }
.sgd-hdr img { height: 22px; }
.sgd-body { flex: 1; outline: none; }
.sgd-body:focus { outline: none; }
.sgd-body h1 { font-family: var(--sgd-h); font-size: var(--sgd-h1); color: var(--sgd-h1c); margin: 0 0 .5em; line-height: 1.22; }
.sgd-body h2 { font-family: var(--sgd-h); font-size: var(--sgd-h2); color: var(--sgd-h2c); margin: 1.2em 0 .4em; }
.sgd-body h3 { font-family: var(--sgd-h); font-size: var(--sgd-h3); margin: 1em 0 .3em; }
.sgd-body p { margin: 0 0 .75em; }
.sgd-body ul, .sgd-body ol { margin: 0 0 .8em 1.3em; padding: 0; }
.sgd-body li { margin: .18em 0; }
.sgd-body table { border-collapse: collapse; width: 100%; margin: .5em 0 1em; }
.sgd-body td, .sgd-body th { border: 1px solid #d9dee9; padding: 7px 9px; text-align: left; vertical-align: top; }
.sgd-body th { background: #f4f6fb; font-weight: 700; }
.sgd-body.divider { display: flex; flex-direction: column; justify-content: center; }
.sgd-cover { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.sgd-cover h1 { font-family: var(--sgd-h); font-size: var(--sgd-title); line-height: 1.1; margin: 0 0 .3em; }
.sgd-sub { font-size: calc(var(--sgd-body) * 1.35); color: var(--sgd-muted); margin: 0 0 1em; }
.sgd-desc { max-width: 46ch; }
.sgd-band { width: 110px; height: 8px; border-radius: 4px; background: var(--sgd-p); margin-bottom: 22px; }
.sgd-cover-meta { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-top: 28px; font-size: 12px; color: var(--sgd-muted); }
.sgd-cover-logo { height: 40px; margin-bottom: 20px; }
.sgd-cover-img { max-height: 42%; object-fit: contain; align-self: flex-start; margin-top: 22px; }
.sgd-cover.side { flex-direction: row; gap: 28px; align-items: center; }
.sgd-cover.side .sgd-cover-r img { max-width: 100%; border-radius: 10px; }
.sgd-cover.full { background-size: cover; background-position: center; margin: calc(var(--sgd-m) * -1); padding: var(--sgd-m); }
.sgd-cover-scrim { background: rgba(255, 255, 255, .88); padding: 26px; border-radius: 14px; }
.sgd-toc ol { list-style: none; padding: 0; margin: 0; }
.sgd-toc li { padding: 6px 0; border-bottom: 1px dotted #ccd3e0; }
.sgd-toc li.l2 { padding-left: 18px; }
.sgd-toc a { color: inherit; text-decoration: none; }
.sgd-toc h1 { font-family: var(--sgd-h); font-size: var(--sgd-h1); color: var(--sgd-h1c); }

/* text toolbar */
#sgTextTools {
  display: flex; align-items: center; gap: 3px; padding: 5px 8px; background: var(--sg-surface);
  border-bottom: 1px solid var(--sg-line); overflow-x: auto; scrollbar-width: none; flex: none;
}
#sgTextTools::-webkit-scrollbar { display: none; }
#sgTextTools select { padding: 5px 6px; border: 1px solid var(--sg-line); border-radius: 7px; background: var(--sg-surface2); font-size: 12px; }
#sgTextTools .sg-tool { font-weight: 700; }

/* ---------- properties ---------- */
#sgPropsBody { flex: 1; overflow-y: auto; padding: 10px; }
.sg-sec { border: 1px solid var(--sg-line); border-radius: 9px; margin-bottom: 8px; background: var(--sg-surface2); overflow: hidden; }
.sg-sec > summary {
  padding: 8px 10px; font-size: 11.5px; font-weight: 700; cursor: pointer; list-style: none; color: var(--sg-text2);
  display: flex; align-items: center; justify-content: space-between;
}
.sg-sec > summary::-webkit-details-marker { display: none; }
.sg-sec > summary::after { content: "⌄"; font-size: 13px; color: var(--sg-text3); }
.sg-sec[open] > summary { border-bottom: 1px solid var(--sg-line); background: var(--sg-surface); }
.sg-sec[open] > summary::after { content: "⌃"; }
.sg-sec-b { padding: 10px; background: var(--sg-surface); }
.sg-f { display: block; margin-bottom: 9px; }
.sg-f > span { display: block; font-size: 11px; font-weight: 600; color: var(--sg-text2); margin-bottom: 3px; }
.sg-f input[type=text], .sg-f input[type=number], .sg-f input[type=date], .sg-f select, .sg-f textarea {
  width: 100%; padding: 6px 8px; border: 1px solid var(--sg-line); border-radius: 7px;
  background: var(--sg-surface2); font-size: 12px;
}
.sg-f textarea { resize: vertical; min-height: 56px; line-height: 1.45; }
.sg-f input:focus, .sg-f select:focus, .sg-f textarea:focus { outline: none; border-color: var(--sg-accent); background: var(--sg-surface); }
.sg-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sg-row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sg-check { display: flex; align-items: center; gap: 7px; margin-bottom: 7px; font-size: 12px; color: var(--sg-text2); cursor: pointer; }
.sg-check input { accent-color: var(--sg-accent); width: 14px; height: 14px; flex: none; }
.sg-range { display: flex; align-items: center; gap: 7px; }
.sg-range input[type=range] { flex: 1; accent-color: var(--sg-accent); }
.sg-range b { font-size: 11px; color: var(--sg-text3); min-width: 34px; text-align: right; font-weight: 600; }
.sg-colorrow { display: flex; align-items: center; gap: 6px; }
.sg-colorrow input[type=color] { width: 30px; height: 26px; padding: 0; border: 1px solid var(--sg-line); border-radius: 6px; background: none; cursor: pointer; flex: none; }
.sg-colorrow input[type=text] { width: 78px; }
/* .sg-swatches is the row, .sg-sw is one swatch button. They used to share a
   class, which collapsed every swatch to zero size. */
.sg-swatches { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.sg-sw {
  width: 20px; height: 20px; border-radius: 5px; border: 1px solid rgba(0, 0, 0, .18);
  padding: 0; cursor: pointer; flex: none;
}
.sg-sw:hover { transform: scale(1.12); box-shadow: 0 0 0 2px var(--sg-surface), 0 0 0 3px var(--sg-accent); }
.sg-sw.none { background: repeating-linear-gradient(45deg, #fff, #fff 3px, #f3b1b1 3px, #f3b1b1 6px); }
.sg-swrow-lbl { font-size: 10px; color: var(--sg-text3); font-weight: 700; margin-top: 7px; }
.sg-btnrow { display: flex; gap: 5px; flex-wrap: wrap; }
.sg-btn {
  padding: 6px 10px; border-radius: 7px; border: 1px solid var(--sg-line2); background: var(--sg-surface2);
  font-size: 12px; font-weight: 600; color: var(--sg-text2);
}
.sg-btn:hover { background: var(--sg-surface3); color: var(--sg-text); }
.sg-btn.ghost { border-color: transparent; }
.sg-btn.danger { color: var(--sg-danger); border-color: #f3c4c0; }
.sg-btn.primary { background: var(--sg-accent); border-color: var(--sg-accent); color: #fff; }
.sg-btn.wide { width: 100%; justify-content: center; text-align: center; }
.sg-iconbtns { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.sg-iconbtns button { height: 28px; border-radius: 6px; border: 1px solid var(--sg-line); background: var(--sg-surface2); font-size: 13px; color: var(--sg-text2); }
.sg-iconbtns button:hover { border-color: var(--sg-accent); color: var(--sg-accent); }
.sg-empty { padding: 22px 14px; text-align: center; color: var(--sg-text3); }
.sg-empty strong { display: block; color: var(--sg-text2); font-size: 13px; margin-bottom: 4px; }
.sg-empty p { margin: 0; font-size: 12px; line-height: 1.6; }
.sg-empty.sm { padding: 16px 10px; }
.sg-note {
  background: var(--sg-surface3); border-left: 3px solid var(--sg-accent); border-radius: 0 8px 8px 0;
  padding: 9px 11px; font-size: 11.5px; line-height: 1.55; color: var(--sg-text2); margin-top: 10px;
}
.sg-tag { font-size: 11px; font-weight: 700; color: var(--sg-accent); }

/* ---------- menus ---------- */
.sg-menu {
  position: fixed; z-index: 60; min-width: 232px; background: var(--sg-surface); border: 1px solid var(--sg-line);
  border-radius: 11px; box-shadow: var(--sg-shadow); padding: 5px; display: none; max-height: 70vh; overflow-y: auto;
}
.sg-menu.show { display: block; }
.sg-menu button, .sg-menu .sg-mi {
  display: flex; width: 100%; align-items: center; gap: 9px; padding: 7px 9px; border-radius: 7px;
  font-size: 12.5px; text-align: left; color: var(--sg-text);
}
.sg-menu button:hover { background: var(--sg-surface2); }
.sg-menu .ic { width: 18px; text-align: center; font-size: 14px; flex: none; color: var(--sg-text3); }
.sg-menu .k { margin-left: auto; font-size: 10.5px; color: var(--sg-text3); font-weight: 600; }
.sg-menu hr { border: 0; border-top: 1px solid var(--sg-line); margin: 5px 2px; }
.sg-menu .h { font-size: 10.5px; font-weight: 700; color: var(--sg-text3); padding: 6px 9px 3px; }

/* ---------- modals ---------- */
.sg-modal {
  position: fixed; inset: 0; z-index: 70; background: rgba(14, 18, 32, .46); backdrop-filter: blur(3px);
  display: none; align-items: center; justify-content: center; padding: 18px;
}
.sg-modal.show { display: flex; }
.sg-box {
  background: var(--sg-surface); border-radius: 15px; box-shadow: 0 24px 70px rgba(10, 14, 28, .3);
  width: 100%; max-width: 560px; max-height: 92vh; display: flex; flex-direction: column; overflow: hidden;
  color: var(--sg-text); font-size: 13px;
}
.sg-box.wide { max-width: 800px; }
.sg-box.full { max-width: 1180px; height: 92vh; }
.sg-box-h { display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--sg-line); flex: none; }
.sg-box-h b { font-size: 14.5px; }
.sg-box-h .x { margin-left: auto; width: 27px; height: 27px; border-radius: 7px; color: var(--sg-text3); font-size: 16px; display: flex; align-items: center; justify-content: center; }
.sg-box-h .x:hover { background: var(--sg-surface2); color: var(--sg-text); }
.sg-box-b { padding: 16px; overflow-y: auto; flex: 1; }
.sg-box-f { display: flex; gap: 8px; justify-content: flex-end; align-items: center; padding: 11px 16px; border-top: 1px solid var(--sg-line); flex: none; }
.sg-box-f .left { margin-right: auto; }

/* start screen */
.sg-start { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.sg-startopt {
  display: flex; gap: 11px; padding: 14px; border: 1.5px solid var(--sg-line); border-radius: 12px; text-align: left; align-items: flex-start;
}
.sg-startopt:hover { border-color: var(--sg-accent); background: var(--sg-surface3); }
.sg-startopt .ic { font-size: 20px; line-height: 1; flex: none; }
.sg-startopt b { display: block; font-size: 13px; margin-bottom: 2px; }
.sg-startopt span { font-size: 11.5px; color: var(--sg-text3); line-height: 1.5; }

/* capture dialog */
.sg-capgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.sg-capopt { display: block; padding: 11px; border: 1.5px solid var(--sg-line); border-radius: 10px; cursor: pointer; }
.sg-capopt.on { border-color: var(--sg-accent); background: var(--sg-surface3); }
.sg-capopt input { display: none; }
.sg-capopt b { display: block; font-size: 12.5px; margin-bottom: 3px; }
.sg-capopt span { font-size: 11px; color: var(--sg-text3); line-height: 1.45; display: block; }
.sg-capchecks { margin-top: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 2px 14px; }

/* export grid */
.sg-exgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.sg-exopt { padding: 13px 11px; border: 1.5px solid var(--sg-line); border-radius: 11px; text-align: left; }
.sg-exopt:hover { border-color: var(--sg-accent); background: var(--sg-surface3); }
.sg-exopt b { display: block; font-size: 12.5px; margin-bottom: 3px; }
.sg-exopt span { font-size: 11px; color: var(--sg-text3); line-height: 1.45; }
#sgExProg { margin-top: 12px; }
#sgExProg .bar { height: 6px; border-radius: 3px; background: var(--sg-surface3); overflow: hidden; margin-top: 5px; }
#sgExProg .bar i { display: block; height: 100%; background: var(--sg-accent); width: 0; transition: width .2s; }
#sgExProg span { font-size: 11.5px; color: var(--sg-text2); }

/* projects */
.sg-proj { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--sg-line); border-radius: 10px; margin-bottom: 7px; }
.sg-proj.cur { border-color: var(--sg-accent); background: var(--sg-surface3); }
.sg-proj b { display: block; font-size: 13px; }
.sg-proj span { font-size: 11px; color: var(--sg-text3); }
.sg-projbtns { margin-left: auto; display: flex; gap: 6px; align-items: center; }

/* library */
.sg-libtabs { display: flex; gap: 3px; padding: 0 16px; border-bottom: 1px solid var(--sg-line); flex: none; }
.sg-libtab { padding: 10px 12px; font-size: 12.5px; font-weight: 600; color: var(--sg-text3); border-bottom: 2px solid transparent; }
.sg-libtab.on { color: var(--sg-accent); border-bottom-color: var(--sg-accent); }
.sg-libgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 8px; }
.sg-libitem {
  aspect-ratio: 1; border: 1px solid var(--sg-line); border-radius: 10px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 5px; padding: 7px; background: var(--sg-surface2);
}
.sg-libitem:hover { border-color: var(--sg-accent); background: var(--sg-surface3); }
.sg-libitem svg { width: 34px; height: 34px; }
.sg-libitem img { width: 34px; height: 34px; object-fit: contain; }
.sg-libitem span { font-size: 10px; color: var(--sg-text3); text-align: center; line-height: 1.2; }
.sg-libitem.emoji { font-size: 26px; }
.sg-libsearch { display: flex; gap: 7px; margin-bottom: 12px; }
.sg-libsearch input { flex: 1; padding: 8px 10px; border: 1px solid var(--sg-line); border-radius: 8px; background: var(--sg-surface2); }
.sg-credit { font-size: 11px; color: var(--sg-text3); margin-top: 12px; }

/* capture bar */
#sgCapBar {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%) translateY(14px);
  background: rgba(16, 19, 32, .95); color: #eef1fa; border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 44px; padding: 7px 8px 7px 16px; display: flex; align-items: center; gap: 10px;
  box-shadow: 0 12px 44px rgba(0, 0, 0, .4); z-index: 80; opacity: 0; pointer-events: none; transition: all .2s;
  font-size: 12.5px; white-space: nowrap; max-width: calc(100vw - 24px); overflow-x: auto;
}
#sgCapBar.show { opacity: 1; pointer-events: auto; transform: translateX(-50%) translateY(0); }
#sgCapBar .dot { width: 9px; height: 9px; border-radius: 50%; background: #ef4444; animation: sgpulse 1.3s infinite; flex: none; }
@keyframes sgpulse { 0%, 100% { opacity: 1 } 50% { opacity: .35 } }
#sgCapState { font-weight: 600; }
#sgCapCount { color: rgba(220, 226, 245, .6); font-size: 11.5px; }
#sgCapBar button {
  padding: 6px 12px; border-radius: 22px; font-size: 12px; font-weight: 700; background: rgba(255, 255, 255, .12); color: #eef1fa;
}
#sgCapBar button:hover { background: rgba(255, 255, 255, .22); }
#sgCapBar button.go { background: var(--sg-accent); color: #fff; }
#sgCapBar button.stop { background: rgba(239, 68, 68, .2); color: #fca5a5; }

/* area selector */
#sgArea { position: fixed; inset: 0; z-index: 90; background: rgba(8, 10, 18, .82); display: none; }
#sgArea.show { display: block; }
#sgAreaImg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; user-select: none; }
#sgAreaSel { position: absolute; border: 2px solid #fff; box-shadow: 0 0 0 9999px rgba(8, 10, 18, .55); display: none; }
#sgAreaSize {
  position: absolute; top: -26px; left: 0; background: var(--sg-accent); color: #fff; font-size: 11px;
  font-weight: 700; padding: 2px 7px; border-radius: 5px; white-space: nowrap;
}
.sg-areabar {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); display: flex; gap: 9px; align-items: center;
  background: rgba(16, 19, 32, .95); padding: 10px 14px; border-radius: 40px; color: #eef1fa; font-size: 12.5px;
  border: 1px solid rgba(255, 255, 255, .12);
}
.sg-areabar button { padding: 7px 14px; border-radius: 20px; font-weight: 700; background: rgba(255, 255, 255, .13); color: #eef1fa; }
.sg-areabar button.go { background: var(--sg-accent); color: #fff; }

/* timeline */
#sgTimeline {
  display: none; flex-direction: column; background: var(--sg-surface); border-top: 1px solid var(--sg-line);
  height: 208px; flex: none;
}
#sgTimeline.show { display: flex; }
#sgTlHead { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-bottom: 1px solid var(--sg-line); flex: none; flex-wrap: wrap; }
#sgTlHead b { font-size: 12px; }
#sgTlTime { font-size: 11.5px; color: var(--sg-text3); font-variant-numeric: tabular-nums; }
.sg-tlmain { flex: 1; display: grid; grid-template-columns: 236px 1fr; gap: 10px; padding: 9px 10px; min-height: 0; }
#sgVideo { width: 100%; height: 100%; object-fit: contain; background: #0b0d16; border-radius: 8px; }
.sg-tlright { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
#sgTlTrack { position: relative; height: 26px; background: var(--sg-surface3); border-radius: 6px; cursor: pointer; flex: none; }
#sgTlTrack .play { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--sg-accent); border-radius: 2px; }
#sgTlTrack .mk {
  position: absolute; top: 2px; width: 18px; height: 22px; margin-left: -9px; border-radius: 5px;
  background: var(--sg-accent); color: #fff; font-size: 10px; font-weight: 700; display: flex;
  align-items: center; justify-content: center; cursor: grab;
}
#sgTlTrack .mk.on { background: #f59e0b; }
#sgTlThumbs { flex: 1; display: flex; gap: 4px; overflow-x: auto; min-height: 0; padding-bottom: 3px; }
#sgTlThumbs img { height: 100%; border-radius: 5px; cursor: pointer; border: 2px solid transparent; }
#sgTlThumbs img:hover { border-color: var(--sg-accent); }

/* drop zone + toast */
#sgDrop {
  position: fixed; inset: var(--sg-top) 0 0; z-index: 85; background: rgba(91, 76, 245, .14);
  border: 3px dashed var(--sg-accent); display: none; align-items: center; justify-content: center;
  color: var(--sg-accent); font-size: 17px; font-weight: 700; pointer-events: none; backdrop-filter: blur(2px);
}
#sgDrop.show { display: flex; }
#sgToast {
  position: fixed; left: 50%; bottom: 80px; transform: translate(-50%, 12px); background: #101324; color: #fff;
  padding: 9px 16px; border-radius: 10px; font-size: 12.5px; font-weight: 600; box-shadow: 0 8px 30px rgba(0, 0, 0, .3);
  opacity: 0; pointer-events: none; transition: all .2s; z-index: 95; max-width: min(520px, 92vw); text-align: center;
}
#sgToast.show { opacity: 1; transform: translate(-50%, 0); }

/* preview */
#sgPreviewFrame { width: 100%; flex: 1; border: 0; background: #eef0f6; border-radius: 8px; }

/* responsive */
@media (max-width: 1180px) {
  .sg-body { grid-template-columns: 186px 1fr 264px; }
}
@media (max-width: 960px) {
  .sg-body { grid-template-columns: 0 1fr 260px; }
  .sg-side.left { position: absolute; left: 0; top: 0; bottom: 0; width: 200px; z-index: 5; box-shadow: var(--sg-shadow); display: none; }
  #sgApp.show-left .sg-side.left { display: flex; }
  .sg-capgrid, .sg-exgrid, .sg-start { grid-template-columns: 1fr; }
  .sg-capchecks { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .sg-body { grid-template-columns: 0 1fr 0; }
  .sg-side.right { position: absolute; right: 0; top: 0; bottom: 0; width: 264px; z-index: 5; box-shadow: var(--sg-shadow); display: none; }
  #sgApp.show-right .sg-side.right { display: flex; }
  .sg-tlmain { grid-template-columns: 1fr; }
  #sgVideo { max-height: 84px; }
}
@media print { #sgApp { display: none; } }

/* ---------- properties panel widgets ---------- */
.sg-b {
  padding: 6px 9px; border-radius: 7px; border: 1px solid var(--sg-line2); background: var(--sg-surface2);
  font-size: 12px; font-weight: 600; color: var(--sg-text2); line-height: 1.2;
}
.sg-b:hover { background: var(--sg-surface3); color: var(--sg-text); }
.sg-b.on { background: var(--sg-accent); border-color: var(--sg-accent); color: #fff; }
.sg-b.wide { width: 100%; margin-bottom: 5px; }
.sg-b.danger { color: var(--sg-danger); border-color: #f0c3bf; }
.sg-b:disabled { opacity: .45; cursor: default; }
.sg-btn-grid { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }
.sg-grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin-bottom: 8px; }
.sg-grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin-bottom: 8px; }
.sg-grid6 { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; margin-bottom: 8px; }
.sg-grid3 .sg-b, .sg-grid4 .sg-b, .sg-grid6 .sg-b { padding: 6px 2px; text-align: center; }
.sg-chiprow { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 8px; }
.sg-chip {
  padding: 4px 9px; border-radius: 20px; border: 1px solid var(--sg-line2); font-size: 11.5px;
  font-weight: 600; color: var(--sg-text2); background: var(--sg-surface2);
}
.sg-chip.on { background: var(--sg-accent); border-color: var(--sg-accent); color: #fff; }
.sg-color-row { display: flex; align-items: center; gap: 6px; margin-bottom: 9px; }
.sg-color-row > span:first-child { font-size: 11px; font-weight: 600; color: var(--sg-text2); flex: 1; }
.sg-sw-main {
  width: 30px; height: 26px; border-radius: 7px; border: 1px solid var(--sg-line2); position: relative;
  overflow: hidden; flex: none; cursor: pointer;
}
.sg-sw-main input[type=color] { position: absolute; inset: -6px; width: 200%; height: 200%; border: 0; padding: 0; opacity: 0; cursor: pointer; }
.sg-none { position: absolute; inset: 0; background: repeating-linear-gradient(45deg, #fff, #fff 4px, #f0b4b4 4px, #f0b4b4 8px); }
.sg-hex { width: 74px; padding: 5px 6px; border: 1px solid var(--sg-line); border-radius: 6px; background: var(--sg-surface2); font-size: 11.5px; }
.sg-swatches { display: flex; gap: 3px; flex-wrap: wrap; }
.sg-pal { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }
.sg-pal-i { width: 22px; height: 22px; border-radius: 6px; border: 1px solid rgba(0, 0, 0, .16); }
.sg-pal-i.on { box-shadow: 0 0 0 2px var(--sg-accent); }
.sg-f-range { display: flex; align-items: center; gap: 7px; }
.sg-f-range input[type=range] { flex: 1; accent-color: var(--sg-accent); }
.sg-f-range b { font-size: 11px; color: var(--sg-text3); min-width: 36px; text-align: right; }
.sg-f-color { margin-bottom: 8px; }
.sg-sel-head {
  display: flex; align-items: center; gap: 7px; padding: 7px 9px; border-radius: 8px;
  background: var(--sg-surface3); font-size: 12px; font-weight: 700; margin-bottom: 9px;
}
.sg-sel-head span { margin-left: auto; font-size: 11px; font-weight: 600; color: var(--sg-text3); }
.sg-modal-sec { margin-bottom: 18px; }
.sg-modal-sec > h4 {
  margin: 0 0 9px; font-size: 11.5px; font-weight: 700; color: var(--sg-text2);
  padding-bottom: 6px; border-bottom: 1px solid var(--sg-line);
}
.sg-tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
.sg-tbl td, .sg-tbl th { padding: 5px 6px; border-bottom: 1px solid var(--sg-line); text-align: left; }
.sg-tbl th { font-size: 11px; color: var(--sg-text3); font-weight: 600; }
.sg-tbl input, .sg-tbl select { width: 100%; padding: 5px 6px; border: 1px solid var(--sg-line); border-radius: 6px; background: var(--sg-surface2); font-size: 12px; }
.sg-tbl input[type=color] { padding: 0; height: 26px; }
.sg-link { color: var(--sg-accent); font-weight: 600; text-decoration: underline; background: none; padding: 0; }

/* inline text editing on the stage */
.sg-inline-title, .sg-inline-body {
  position: absolute; z-index: 4; border: 2px solid var(--sg-accent); border-radius: 6px;
  background: #fff; color: #111; padding: 4px 6px; font-family: inherit; resize: none; box-shadow: var(--sg-shadow);
}
.sg-inline-title { font-weight: 800; }

/* ---------- insert library ---------- */
.sg-lib-search { display: flex; gap: 7px; margin-bottom: 12px; }
.sg-lib-search input { flex: 1; padding: 8px 10px; border: 1px solid var(--sg-line); border-radius: 8px; background: var(--sg-surface2); }
.sg-lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.sg-lib-grid.wide { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.sg-lib-grid.icons, .sg-lib-grid.images { grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); }
.sg-lib-i {
  border: 1px solid var(--sg-line); border-radius: 10px; background: var(--sg-surface2); padding: 10px 6px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 84px;
}
.sg-lib-i:hover { border-color: var(--sg-accent); background: var(--sg-surface3); }
.sg-lib-i .g { font-size: 22px; line-height: 1; color: var(--sg-text2); }
.sg-lib-i span { font-size: 11px; color: var(--sg-text2); text-align: center; line-height: 1.25; }
.sg-lib-i small { font-size: 10px; color: var(--sg-text3); text-align: center; }
.sg-lib-i.tall { min-height: 122px; }
.sg-lib-i img { max-width: 100%; max-height: 46px; object-fit: contain; }
.sg-lib-i svg { width: 30px; height: 30px; }
.sg-bub-prev { display: block; width: 100%; height: 56px; }
.sg-bub-prev svg { width: 100%; height: 100%; }
.sg-icon-prev, .sg-icon-i img { width: 30px; height: 30px; }
.sg-lib-g { margin-bottom: 16px; }
.sg-lib-g h4 { margin: 0 0 7px; font-size: 11.5px; font-weight: 700; color: var(--sg-text3); }
.sg-emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 4px; }
.sg-emoji {
  height: 40px; border-radius: 8px; border: 1px solid transparent; background: var(--sg-surface2); font-size: 21px; line-height: 1;
}
.sg-emoji:hover { border-color: var(--sg-accent); background: var(--sg-surface3); }
.sgd-cover-l { flex: 1; min-width: 0; }
.sgd-cover-r { flex: 0 0 38%; }


/* ---------- small screens: panels slide over the canvas ---------- */
.sg-only-small { display: none; }
@media (max-width: 960px) {
  .sg-only-small { display: inline-flex; }
  #sgApp .sg-side.left { transform: translateX(-100%); transition: transform .18s; display: flex; }
  #sgApp.show-left .sg-side.left { transform: none; }
  #sgApp.show-left::before, #sgApp.show-right::before {
    content: ""; position: absolute; inset: 0; background: rgba(12, 16, 28, .34); z-index: 4;
  }
}
@media (max-width: 720px) {
  #sgApp .sg-side.right { transform: translateX(100%); transition: transform .18s; display: flex; }
  #sgApp.show-right .sg-side.right { transform: none; }
}


/* ---------- overlays: explicit opaque surfaces ---------- */
.sg-menu { background: var(--sg-surface); border: 1px solid var(--sg-line); }
.sg-modal .sg-box { background: var(--sg-surface); }
.sg-modal .sg-box-h, .sg-modal .sg-box-f { background: var(--sg-surface); }
.sg-modal .sg-box-b { background: var(--sg-surface); }
.sg-libtabs { background: var(--sg-surface); }
#sgPageMenu { background: var(--sg-surface); }
.sg-modal .sg-sec-b, .sg-modal .sg-sec > summary { background: var(--sg-surface); }
.sg-modal .sg-f input, .sg-modal .sg-f select, .sg-modal .sg-f textarea,
.sg-modal input[type=text], .sg-modal input[type=number], .sg-modal input[type=date],
.sg-modal input[type=search], .sg-modal select, .sg-modal textarea {
  background: var(--sg-surface2); border: 1px solid var(--sg-line); border-radius: 7px; padding: 6px 8px;
}
.sg-modal .sg-b, .sg-modal .sg-btn { background: var(--sg-surface2); }
.sg-modal .sg-btn.primary, .sg-modal .sg-b.on { background: var(--sg-accent); color: #fff; }

/* ---------- slide pages look like slides, document pages look like documents ---------- */
.sgd-page.slides { justify-content: flex-start; }
.sgd-page.slides .sgd-ftr { margin-top: auto; }
.sgd-page.slides .sgd-body { display: flex; flex-direction: column; justify-content: center; }
.sgd-page.slides .sgd-body h1 { font-size: calc(var(--sgd-h1) * 1.5); margin-bottom: .35em; }
.sgd-page.slides .sgd-body h2 { font-size: calc(var(--sgd-h2) * 1.35); }
.sgd-page.slides .sgd-body p, .sgd-page.slides .sgd-body li { font-size: calc(var(--sgd-body) * 1.3); }
.sgd-page.slides .sgd-body ul, .sgd-page.slides .sgd-body ol { margin-left: 1.1em; }
.sgd-page.slides .sgd-cover h1 { font-size: calc(var(--sgd-title) * 1.3); }
.sgd-page.slides .sgd-toc li { padding: 10px 0; font-size: calc(var(--sgd-body) * 1.2); }
.sgd-page.document .sgd-body { max-width: 74ch; }

/* slide pages centre their content vertically between header and footer */
.sgd-page.slides .sgd-body,
.sgd-page.slides .sgd-cover,
.sgd-page.slides .sgd-toc { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.sgd-page.slides .sgd-toc ol { margin-top: 8px; }

/* ============================================================
   Timeline v2
   ============================================================ */
#sgTimeline { height: 268px; }
#sgTlHead { gap: 6px; padding: 7px 10px; align-items: center; }
.sg-tlgroup { display: flex; align-items: center; gap: 3px; flex: none; }
.sg-tlgroup .sg-b { padding: 5px 8px; font-size: 11.5px; }
.sg-tlfield { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--sg-text3); font-weight: 600; }
.sg-tlfield select { padding: 4px 5px; border: 1px solid var(--sg-line); border-radius: 6px; background: var(--sg-surface2); font-size: 11.5px; }
#sgTlRead {
  display: flex; align-items: baseline; gap: 8px; padding: 4px 10px; border-radius: 8px;
  background: var(--sg-surface3); font-variant-numeric: tabular-nums; flex: none;
}
#sgTlRead b { font-size: 14px; font-weight: 800; letter-spacing: .01em; }
#sgTlRead span { font-size: 11px; color: var(--sg-text3); font-weight: 600; }
#sgTlZoomLbl { font-size: 11px; color: var(--sg-text3); min-width: 32px; text-align: center; font-weight: 600; }

.sg-tlmain { grid-template-columns: 300px 1fr; gap: 12px; padding: 10px; align-items: stretch; }
.sg-tlvid { background: #0b0d16; border-radius: 10px; overflow: hidden; display: flex; align-items: center; }
#sgVideo { width: 100%; height: 100%; max-height: 100%; object-fit: contain; display: block; }
.sg-tlright { display: flex; flex-direction: column; gap: 6px; min-width: 0; overflow: hidden; }

#sgTlRuler { position: relative; height: 18px; flex: none; cursor: ew-resize; user-select: none; }
#sgTlRuler i { position: absolute; top: 9px; bottom: 0; width: 1px; background: var(--sg-line2); }
#sgTlRuler span {
  position: absolute; top: -1px; transform: translateX(-50%); font-size: 9.5px; color: var(--sg-text3);
  font-variant-numeric: tabular-nums; white-space: nowrap; pointer-events: none;
}
#sgTlTrack {
  position: relative; height: 40px; background: var(--sg-surface3); border-radius: 7px; cursor: ew-resize;
  flex: none; overflow: hidden;
}
#sgTlTrimShade { position: absolute; top: 0; bottom: 0; background: rgba(91, 76, 245, .1); pointer-events: none; }
.sg-trim {
  position: absolute; top: 0; bottom: 0; width: 8px; margin-left: -4px; background: var(--sg-accent);
  border-radius: 3px; cursor: ew-resize; opacity: .85; z-index: 3;
}
.sg-trim::after { content: ""; position: absolute; inset: 14px 3px; border-left: 1px solid rgba(255, 255, 255, .7); border-right: 1px solid rgba(255, 255, 255, .7); }
#sgTlPlayhead {
  position: absolute; top: -18px; bottom: -6px; width: 2px; margin-left: -1px; background: #e11d48;
  pointer-events: none; z-index: 5;
}
#sgTlPlayhead::before {
  content: ""; position: absolute; top: 0; left: -5px; border: 6px solid transparent; border-top-color: #e11d48; border-bottom: 0;
}
.sg-mark {
  position: absolute; top: 7px; width: 22px; height: 26px; margin-left: -11px; border-radius: 6px;
  background: var(--sg-accent); color: #fff; font-size: 11px; font-weight: 800; cursor: grab; z-index: 4;
  border: 2px solid var(--sg-surface);
}
.sg-mark.on { background: #f59e0b; }
.sg-mark:active { cursor: grabbing; }
#sgTlFx { position: relative; height: 24px; flex: none; background: var(--sg-surface2); border-radius: 6px; }
.sg-fx {
  position: absolute; top: 3px; height: 18px; border-radius: 5px; background: #0ea5e9; color: #fff;
  font-size: 10px; font-weight: 700; padding: 0 6px; white-space: nowrap; overflow: hidden; cursor: grab;
  border: 1px solid rgba(255, 255, 255, .5);
}
.sg-fx.on { background: #f59e0b; }
#sgTlFxPanel { flex: none; }
.sg-fxrow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 11.5px; color: var(--sg-text2); }
.sg-fxrow label { display: flex; align-items: center; gap: 5px; }
.sg-fxrow input[type=range] { width: 96px; accent-color: var(--sg-accent); }
.sg-fxrow input[type=text] { width: 76px; padding: 4px 6px; border: 1px solid var(--sg-line); border-radius: 6px; background: var(--sg-surface2); font-variant-numeric: tabular-nums; }
#sgTlThumbs { flex: 1; min-height: 0; display: flex; gap: 4px; overflow-x: auto; }
#sgTlThumbs img { height: 100%; max-height: 62px; border-radius: 5px; border: 2px solid transparent; cursor: pointer; }
#sgTlThumbs img:hover { border-color: var(--sg-accent); }

/* theatre preview */
.sg-theatre .sg-theatre-b { background: #06070d; display: flex; align-items: center; justify-content: center; padding: 0; }
#sgBigVideo { width: 100%; height: 100%; max-height: 78vh; object-fit: contain; }
#sgTheatreHint { font-weight: 600; }

@media (max-width: 900px) {
  .sg-tlmain { grid-template-columns: 1fr; }
  .sg-tlvid { max-height: 110px; }
  #sgTlHead { overflow-x: auto; }
}

/* range rows: label left, live value right */
.sg-f-range { display: block; }
.sg-f-range .sg-f-lbl { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.sg-f-range .sg-f-lbl b { font-size: 11px; font-weight: 700; color: var(--sg-text3); font-variant-numeric: tabular-nums; }
.sg-f-range input[type=range] { width: 100%; accent-color: var(--sg-accent); margin-top: 2px; }

/* ---------- movable boxes on document pages ---------- */
.sgd-page { position: relative; }
.sgd-boxlayer { position: absolute; inset: 0; }
.sgd-box { position: absolute; cursor: move; outline: 1px dashed transparent; }
.sgd-box:hover { outline-color: var(--sg-line2); }
.sgd-box.on { outline: 1.5px solid var(--sg-accent); }
.sgd-box-t { width: 100%; height: 100%; outline: none; overflow: hidden; cursor: text; }
.sgd-box-ph { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: #eef1f8; color: #98a1b6; font-size: 12px; border-radius: 6px; }
.sgd-h {
  position: absolute; width: 11px; height: 11px; background: #fff; border: 1.6px solid var(--sg-accent);
  border-radius: 3px; display: none; z-index: 3;
}
.sgd-box.on .sgd-h, .sgd-box.on .sgd-rot { display: block; }
.sgd-h.nw { left: -6px; top: -6px; cursor: nwse-resize; }
.sgd-h.ne { right: -6px; top: -6px; cursor: nesw-resize; }
.sgd-h.se { right: -6px; bottom: -6px; cursor: nwse-resize; }
.sgd-h.sw { left: -6px; bottom: -6px; cursor: nesw-resize; }
.sgd-rot {
  position: absolute; left: 50%; top: -24px; margin-left: -6px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--sg-accent); display: none; cursor: grab; z-index: 3;
}
.sg-colorbtn { position: relative; overflow: hidden; }
.sg-colorbtn input[type=color] { position: absolute; inset: -6px; width: 200%; height: 200%; opacity: 0; cursor: pointer; border: 0; padding: 0; }

/* playhead grab knob */
#sgTlKnob {
  position: absolute; top: 12px; left: 50%; width: 15px; height: 15px; margin-left: -7.5px;
  background: #e11d48; border: 2px solid #fff; border-radius: 50%; cursor: ew-resize;
  pointer-events: auto; box-shadow: 0 1px 4px rgba(0, 0, 0, .3);
}
#sgTlPlayhead { pointer-events: none; }
#sgTlKnob:active { cursor: grabbing; transform: scale(1.15); }

/* toolbars never wrap; they scroll instead */
#sgTextTools, #sgTools { flex-wrap: nowrap; }
#sgTextTools > *, #sgTools > * { flex: none; }
#sgTextTools .sg-b, #sgTools .sg-b { white-space: nowrap; }
#sgTextTools select { max-width: 132px; }

/* timeline resize grip */
#sgTlGrip { height: 7px; cursor: ns-resize; background: transparent; flex: none; position: relative; }
#sgTlGrip::after { content: ""; position: absolute; left: 50%; top: 2px; width: 46px; height: 3px; margin-left: -23px; border-radius: 2px; background: var(--sg-line2); }
#sgTlGrip:hover::after { background: var(--sg-accent); }

/* recordings gallery */
.sg-clipgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.sg-clip { border: 1.5px solid var(--sg-line); border-radius: 12px; overflow: hidden; background: var(--sg-surface2); }
.sg-clip.on { border-color: var(--sg-accent); }
.sg-clip-th { aspect-ratio: 16/9; background: #0b0d16; display: flex; align-items: center; justify-content: center; }
.sg-clip-th img { width: 100%; height: 100%; object-fit: cover; }
.sg-clip-m { padding: 8px 10px 4px; }
.sg-clip-m b { display: block; font-size: 12.5px; outline: none; }
.sg-clip-m span { font-size: 11px; color: var(--sg-text3); }
.sg-clip-b { display: flex; gap: 4px; padding: 8px 10px 10px; flex-wrap: wrap; }
.sg-clip-b .sg-b { font-size: 11px; padding: 5px 8px; }

/* inline editable cover fields */
.sgd-inline { outline: none; border-radius: 4px; }
.sgd-inline:hover { box-shadow: inset 0 0 0 1px var(--sg-line2); }
.sgd-inline:focus { box-shadow: inset 0 0 0 1.5px var(--sg-accent); background: rgba(91, 76, 245, .04); }

