/* Simply DTP */
:root {
  --chrome: #1e2a44; --chrome-2: #2a3858; --chrome-text: #e8ecf5;
  --panel: #f6f7f9; --panel-2: #eceef2; --line: #d8dce3; --text: #1f2430; --muted: #6b7280;
  --accent: #2b6cff; --accent-weak: #e4ecff; --sel: #2b7fff; --smart: #ff2d95; --guide: #00a8e0; --margin: #b07cff;
  --ws: #b9bec7;
  font: 13px/1.35 "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--text);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { overflow: hidden; background: var(--panel); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.grow { flex: 1; }

#app { display: grid; grid-template-rows: 34px 44px minmax(0, 1fr) 28px; height: 100vh; }

/* ---------- menu bar ---------- */
#menubar { display: flex; align-items: center; gap: 4px; background: var(--chrome); color: var(--chrome-text); padding: 0 10px; user-select: none; }
.brand { display: flex; align-items: center; margin: 0 6px 0 2px; cursor: default; }
.brand img { width: 20px; height: 20px; border-radius: 4px; }
#menus { display: flex; }
.menu-btn { background: none; border: 0; color: inherit; padding: 5px 10px; border-radius: 4px; }
.menu-btn:hover, .menu-btn.open { background: var(--chrome-2); }
#docName { opacity: .8; margin-right: 10px; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#installBtn { background: var(--accent); border: 0; color: #fff; padding: 4px 12px; border-radius: 4px; font-weight: 600; }
.menu-pop { position: fixed; z-index: 1000; background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 8px 28px rgba(15, 25, 50, .22); padding: 4px; min-width: 230px; }
.menu-item { display: grid; grid-template-columns: 18px 1fr auto; gap: 6px; align-items: center; width: 100%; text-align: left; border: 0; background: none; padding: 5px 10px 5px 6px; border-radius: 4px; }
.menu-item:hover:not(.disabled) { background: var(--accent-weak); }
.menu-item.disabled { color: #a3a8b3; cursor: default; }
.mi-key { color: var(--muted); font-size: 11.5px; padding-left: 18px; }
.mi-check { color: var(--accent); font-weight: 700; text-align: center; }
.menu-sep { height: 1px; background: var(--line); margin: 4px 6px; }

/* ---------- toolbar ---------- */
#toolbar { display: flex; align-items: center; gap: 6px; padding: 0 10px; background: var(--panel); border-bottom: 1px solid var(--line); user-select: none; overflow-x: auto; }
.tgroup { display: flex; align-items: center; gap: 2px; }
.tdiv { width: 1px; height: 24px; background: var(--line); margin: 0 4px; }
.tsep { width: 1px; height: 18px; background: var(--line); margin: 0 3px; }
.tbtn { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 30px; border: 1px solid transparent; background: none; border-radius: 5px; color: #344055; padding: 0 5px; }
.tbtn:hover:not(:disabled) { background: #e3e7ee; }
.tbtn.on { background: var(--accent-weak); border-color: #b8ccff; color: var(--accent); }
.tbtn:disabled { opacity: .35; cursor: default; }
.tbtn.sm { min-width: 26px; height: 26px; }
.tbtn.txt { font-size: 15px; width: 30px; font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif; }
.tbtn.b { font-weight: 800; } .tbtn.i { font-style: italic; } .tbtn.u { text-decoration: underline; }
.ic { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.text-tools.disabled { opacity: .45; }
.font-btn { display: inline-flex; align-items: center; justify-content: space-between; width: 168px; height: 30px; border: 1px solid var(--line); background: #fff; border-radius: 5px; padding: 0 8px; overflow: hidden; }
.font-btn #fontName { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.font-btn .caret { color: var(--muted); margin-left: 6px; }
.size-box { display: inline-flex; height: 30px; border: 1px solid var(--line); border-radius: 5px; background: #fff; overflow: hidden; }
.size-in { width: 42px; border: 0; padding: 0 6px; background: none; outline: none; }
.size-drop { border: 0; border-left: 1px solid var(--line); background: none; width: 20px; color: var(--muted); padding: 0; }
.size-drop:hover:not(:disabled) { background: #e3e7ee; }
.size-pop .font-list { max-height: 300px; padding: 4px; }
.size-pop .font-item { font-size: 13px; padding: 3px 8px; }
.colour-pick { position: relative; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 5px; cursor: pointer; }
.colour-pick:hover { background: #e3e7ee; }
.colour-pick .cp-a { font-weight: 700; font-size: 14px; line-height: 1; font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif; }
.colour-pick.hl .cp-a { font-size: 12px; background: #fff176; padding: 0 2px; }
.colour-pick input { width: 22px; height: 6px; padding: 0; border: 0; margin-top: 2px; cursor: pointer; }
.colour-pick input::-webkit-color-swatch-wrapper { padding: 0; }
.colour-pick input::-webkit-color-swatch { border: 0; border-radius: 1px; }
#lineSpacing { height: 30px; border: 1px solid var(--line); border-radius: 5px; background: #fff; margin-left: 4px; }

.font-pop { position: fixed; z-index: 1000; width: 280px; background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 8px 28px rgba(15, 25, 50, .22); display: flex; flex-direction: column; }
.font-search { margin: 8px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 4px; }
.font-list { max-height: 360px; overflow-y: auto; padding: 0 4px; }
.font-item { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 5px 8px; font-size: 16px; border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.font-item:hover { background: var(--accent-weak); }
.font-foot { border-top: 1px solid var(--line); padding: 7px 10px; color: var(--muted); font-size: 12px; }
.link-btn { border: 0; background: none; color: var(--accent); padding: 0; font-weight: 600; }

/* ---------- main area ---------- */
#main { display: grid; grid-template-columns: 136px minmax(0, 1fr) 268px; min-height: 0; }
#pagesPanel, #propsPanel { background: var(--panel); min-height: 0; display: flex; flex-direction: column; }
#pagesPanel { border-right: 1px solid var(--line); }
#propsPanel { border-left: 1px solid var(--line); overflow-y: auto; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 6px 6px 10px; font-weight: 600; border-bottom: 1px solid var(--line); }
#pageActions { display: flex; }
#thumbs { overflow-y: auto; padding: 10px 0; display: flex; flex-direction: column; align-items: center; gap: 12px; flex: 1; }
.thumb { display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; padding: 4px; border-radius: 4px; border: 2px solid transparent; }
.thumb.on { border-color: var(--accent); background: var(--accent-weak); }
.thumb.drop-target { border-color: var(--smart); border-style: dashed; }
.thumb-holder { position: relative; overflow: hidden; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.mini-page { position: absolute; left: 0; top: 0; transform-origin: 0 0; background: #fff; pointer-events: none; }
.thumb-n { font-size: 11px; color: var(--muted); }

/* ---------- stage ---------- */
#stage { position: relative; display: grid; grid-template-columns: 20px minmax(0, 1fr); grid-template-rows: 20px minmax(0, 1fr); min-width: 0; min-height: 0; }
#rulerCorner { grid-area: 1 / 1; background: #e4e7ec; border-right: 1px solid #b9bec8; border-bottom: 1px solid #b9bec8; }
#rulerTop { grid-area: 1 / 2; width: 100%; height: 20px; cursor: s-resize; display: block; }
#rulerLeft { grid-area: 2 / 1; width: 20px; height: 100%; cursor: e-resize; display: block; }
.no-rulers #stage { grid-template-columns: 0 minmax(0, 1fr); grid-template-rows: 0 minmax(0, 1fr); }
.no-rulers #rulerTop, .no-rulers #rulerLeft, .no-rulers #rulerCorner { visibility: hidden; }
#workspace { grid-area: 2 / 2; overflow: auto; position: relative; background: var(--ws); }
#workspace.drop { box-shadow: inset 0 0 0 3px var(--accent); }
#workspace:not([data-tool="select"]) { cursor: crosshair; }
#workspace.panning, #workspace.panning * { cursor: grab !important; }
#pasteboard { position: relative; overflow: hidden; }
#pageWrap { position: absolute; }
#page { position: absolute; left: 0; top: 0; transform-origin: 0 0; background: #fff; box-shadow: 0 0 0 calc(.6px * var(--inv)) rgba(0, 0, 0, .25), 0 calc(3px * var(--inv)) calc(14px * var(--inv)) rgba(0, 0, 0, .22); --inv: 1; }
#grid { position: absolute; inset: 0; pointer-events: none; display: none;
  background-image: linear-gradient(to right, rgba(60, 110, 220, .22) calc(.8px * var(--inv)), transparent calc(.8px * var(--inv))),
    linear-gradient(to bottom, rgba(60, 110, 220, .22) calc(.8px * var(--inv)), transparent calc(.8px * var(--inv))); }
#objects { position: absolute; inset: 0; }
#overlay { position: absolute; inset: 0; pointer-events: none; line-height: 1.3; }

/* objects */
.obj { position: absolute; box-sizing: border-box; }
.obj-text { overflow: hidden; display: flex; flex-direction: column; }
.tcontent { outline: none; overflow-wrap: break-word; word-break: normal; min-height: 1em; user-select: none; }
.tcontent p, .tcontent div { margin: 0; }
.tcontent ul, .tcontent ol { margin: 0; padding-left: 1.4em; }
.obj-text.editing { overflow: visible; }
.obj-text.editing .tcontent { user-select: text; cursor: text; }
.obj-text.overflowing::after { content: '+'; position: absolute; right: 0; bottom: 0; width: calc(14px * var(--inv)); height: calc(14px * var(--inv)); line-height: calc(13px * var(--inv)); font: 700 calc(12px * var(--inv)) / calc(13px * var(--inv)) "Segoe UI", sans-serif; text-align: center; color: #fff; background: #e5484d; border-radius: calc(2px * var(--inv)); }
.obj-image { overflow: hidden; }
.obj-image img { width: 100%; height: 100%; display: block; pointer-events: none; user-select: none; }
.obj-line .line-inner { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); }

/* overlay */
.margin-box { position: absolute; border: 1px dashed var(--margin); opacity: .8; }
.guide { position: absolute; pointer-events: auto; z-index: 2; }
.guide.gv { top: -3000em; height: 6000em; width: 7px; transform: translateX(-50%); cursor: ew-resize; }
.guide.gh { left: -3000em; width: 6000em; height: 7px; transform: translateY(-50%); cursor: ns-resize; }
.guide::before { content: ''; position: absolute; }
.guide.gv::before { left: 50%; top: 0; bottom: 0; border-left: 1px solid var(--guide); }
.guide.gh::before { top: 50%; left: 0; right: 0; border-top: 1px solid var(--guide); }
.guide:hover::before { border-color: #0070a0; }
.guide.ghost { pointer-events: none; }
.locked-guides .guide, #workspace:not([data-tool="select"]) .guide { pointer-events: none; }
.sel-box { position: absolute; outline: 1.2px solid var(--sel); outline-offset: 0; }
.sel-box.locked { outline: 1.2px dashed #8a8f99; }
.sel-box.editing { outline: 1.2px dashed var(--sel); }
.sel-group { position: absolute; outline: 1px dashed var(--sel); }
.handle { position: absolute; width: 9px; height: 9px; background: #fff; border: 1.5px solid var(--sel); border-radius: 2px; transform: translate(-50%, -50%); pointer-events: auto; z-index: 3; }
.h-nw { left: 0; top: 0; cursor: nwse-resize; } .h-n { left: 50%; top: 0; cursor: ns-resize; } .h-ne { left: 100%; top: 0; cursor: nesw-resize; }
.h-e { left: 100%; top: 50%; cursor: ew-resize; } .h-se { left: 100%; top: 100%; cursor: nwse-resize; } .h-s { left: 50%; top: 100%; cursor: ns-resize; }
.h-sw { left: 0; top: 100%; cursor: nesw-resize; } .h-w { left: 0; top: 50%; cursor: ew-resize; }
.handle.rot { left: 50%; top: -24px; border-radius: 50%; background: var(--sel); cursor: grab; width: 10px; height: 10px; }
.rot-stem { position: absolute; left: 50%; top: -24px; height: 24px; border-left: 1px solid var(--sel); }
.smart-line { position: absolute; }
.smart-line.vx { border-left: 1px solid var(--smart); }
.smart-line.hy { border-top: 1px solid var(--smart); }
.smart-line.centre.vx { border-left-style: dashed; } .smart-line.centre.hy { border-top-style: dashed; }
.gap-mark { position: absolute; }
.gap-mark.gx { border-top: 1px solid var(--smart); }
.gap-mark.gy { border-left: 1px solid var(--smart); }
.gap-mark.gx::before, .gap-mark.gx::after { content: ''; position: absolute; top: -4px; height: 7px; border-left: 1px solid var(--smart); }
.gap-mark.gx::before { left: 0; } .gap-mark.gx::after { right: 0; }
.gap-mark.gy::before, .gap-mark.gy::after { content: ''; position: absolute; left: -4px; width: 7px; border-top: 1px solid var(--smart); }
.gap-mark.gy::before { top: 0; } .gap-mark.gy::after { bottom: 0; }
.gap-label { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -130%); background: var(--smart); color: #fff; font: 600 10px / 1.3 "Segoe UI", sans-serif; padding: 0 4px; border-radius: 3px; white-space: nowrap; }
.gap-mark.gy .gap-label { transform: translate(15%, -50%); }
.marquee { position: absolute; border: 1px solid var(--sel); background: rgba(43, 127, 255, .08); }
.draw-preview { position: absolute; border: 1px dashed var(--sel); background: rgba(43, 127, 255, .06); }
.draw-preview.round { border-radius: 50%; }
.draw-line { position: absolute; border-top: 1.5px dashed var(--sel); transform-origin: 0 0; }
.tip { position: absolute; z-index: 5; transform: translate(-50%, 0); background: #1f2430; color: #fff; font: 11px / 1.4 "Segoe UI", sans-serif; padding: 2px 6px; border-radius: 3px; white-space: nowrap; }

/* ---------- properties ---------- */
.psec { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.psec-title { font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: #4b5466; margin-bottom: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow { display: grid; grid-template-columns: 88px 1fr; align-items: center; gap: 6px; margin: 5px 0; }
.prow > label { color: var(--muted); font-size: 12px; }
.pctrl { display: flex; align-items: center; gap: 6px; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; column-gap: 10px; }
.grid2 .prow { grid-template-columns: 44px 1fr; }
input.num { width: 100%; min-width: 0; height: 26px; border: 1px solid var(--line); border-radius: 4px; padding: 0 6px; background: #fff; }
.num-wrap { display: flex; align-items: center; width: 100%; position: relative; }
.num-wrap .suffix { position: absolute; right: 22px; color: var(--muted); font-size: 11px; pointer-events: none; }
.pctrl select, .dlg select { height: 26px; border: 1px solid var(--line); border-radius: 4px; background: #fff; min-width: 0; flex: 1; }
.pctrl input[type=color] { width: 38px; height: 26px; border: 1px solid var(--line); border-radius: 4px; padding: 2px; background: #fff; }
.pctrl input[type=range] { flex: 1; min-width: 0; }
.range-v { width: 38px; text-align: right; color: var(--muted); font-size: 12px; }
.chk { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 3px 9px; font-size: 12px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--accent-weak); color: var(--accent); font-weight: 600; }
.pbtn { width: 100%; margin-top: 6px; height: 28px; border: 1px solid var(--line); background: #fff; border-radius: 4px; }
.pbtn:hover { background: var(--accent-weak); border-color: #b8ccff; }
.btnrow { display: flex; gap: 2px; margin-bottom: 4px; flex-wrap: wrap; }
.hint { color: var(--muted); font-size: 11.5px; }
.hint.pad { padding: 4px 0; }
#layers { padding: 10px 12px 16px; }
.layer { display: flex; align-items: center; gap: 7px; padding: 4px 6px; border-radius: 4px; cursor: pointer; color: #344055; }
.layer:hover { background: var(--panel-2); }
.layer.on { background: var(--accent-weak); color: var(--accent); }
.layer.hidden .lname { opacity: .45; }
.lname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lname input { width: 100%; font: inherit; border: 1px solid var(--accent); border-radius: 3px; padding: 0 3px; }
.lbtn { border: 0; background: none; padding: 2px; border-radius: 3px; color: #8a909c; display: inline-flex; }
.lbtn:hover { background: #dde2ea; color: #344055; }
.lbtn.on { color: var(--accent); }

/* ---------- status bar ---------- */
#statusbar { display: flex; align-items: center; gap: 14px; padding: 0 10px; background: var(--panel); border-top: 1px solid var(--line); font-size: 12px; color: #4b5466; user-select: none; }
.mono { font-variant-numeric: tabular-nums; min-width: 120px; }
.stog { border: 1px solid transparent; background: none; padding: 2px 8px; border-radius: 10px; color: var(--muted); font-size: 12px; }
.stog.on { background: var(--accent-weak); color: var(--accent); border-color: #c9d8ff; font-weight: 600; }
.sdiv { width: 1px; height: 16px; background: var(--line); }
.zbtn { border: 0; background: none; width: 22px; height: 22px; border-radius: 4px; font-size: 15px; }
.zbtn:hover { background: #e3e7ee; }
#zoomSel { border: 1px solid var(--line); border-radius: 4px; height: 22px; background: #fff; font-size: 12px; }

/* ---------- dialogs ---------- */
.dlg { border: 0; border-radius: 10px; padding: 18px 20px; box-shadow: 0 20px 60px rgba(10, 20, 45, .35); width: 420px; max-width: 95vw; }
.dlg::backdrop { background: rgba(20, 28, 45, .45); }
.dlg h2 { margin: 0 0 10px; font-size: 17px; }
.dlg h3 { margin: 14px 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: #4b5466; }
.dlg .prow { grid-template-columns: 100px 1fr; }
.dlg .grid2 .prow { grid-template-columns: 52px 1fr; }
.dlg-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.dlg-btns button { min-width: 84px; height: 30px; border: 1px solid var(--line); background: #fff; border-radius: 5px; }
.dlg-btns .primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.warn { background: #fff4e0; border: 1px solid #f3cf8a; color: #7a4b00; padding: 7px 10px; border-radius: 5px; font-size: 12.5px; }
.keys { border-collapse: collapse; width: 100%; }
.keys td { padding: 4px 6px; border-bottom: 1px solid var(--panel-2); vertical-align: top; }
kbd { font: 12px/1.4 Consolas, monospace; background: var(--panel-2); border: 1px solid var(--line); border-radius: 3px; padding: 0 5px; white-space: nowrap; }

#toast { position: fixed; left: 50%; bottom: 44px; transform: translate(-50%, 20px); background: #1f2430; color: #fff; padding: 8px 16px; border-radius: 6px; opacity: 0; pointer-events: none; transition: .2s; z-index: 2000; box-shadow: 0 6px 20px rgba(0, 0, 0, .25); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- stage 3 ---------- */
.sel-box.member { outline: 1px dashed rgba(43, 127, 255, .7); }
.sel-group.active { outline: 1.2px solid var(--sel); }
.crop-ghost { position: absolute; opacity: .4; pointer-events: auto; cursor: move; user-select: none; max-width: none; }
.crop-frame { position: absolute; outline: 1px solid #111; box-shadow: 0 0 0 1px rgba(255, 255, 255, .8); pointer-events: auto; cursor: move; }
.chandle { position: absolute; background: #111; border: 1px solid #fff; pointer-events: auto; z-index: 3; }
.ch-nw, .ch-ne, .ch-se, .ch-sw { width: 14px; height: 14px; background: none; border: 0; }
.ch-nw { left: -2px; top: -2px; border-left: 4px solid #111; border-top: 4px solid #111; cursor: nwse-resize; }
.ch-ne { right: -2px; top: -2px; border-right: 4px solid #111; border-top: 4px solid #111; cursor: nesw-resize; }
.ch-se { right: -2px; bottom: -2px; border-right: 4px solid #111; border-bottom: 4px solid #111; cursor: nwse-resize; }
.ch-sw { left: -2px; bottom: -2px; border-left: 4px solid #111; border-bottom: 4px solid #111; cursor: nesw-resize; }
.ch-n, .ch-s { left: 50%; width: 18px; height: 5px; transform: translateX(-50%); cursor: ns-resize; }
.ch-n { top: -3px; } .ch-s { bottom: -3px; }
.ch-e, .ch-w { top: 50%; width: 5px; height: 18px; transform: translateY(-50%); cursor: ew-resize; }
.ch-e { right: -3px; } .ch-w { left: -3px; }
.btn2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.pbtn.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.layer.indent { padding-left: 22px; }
.layer.group { font-weight: 600; }
.gicon { width: 14px; text-align: center; font-size: 12px; }
.layer.dragging { opacity: .4; }
.layer.drop-above { box-shadow: inset 0 2px 0 var(--accent); }
.layer.drop-below { box-shadow: inset 0 -2px 0 var(--accent); }
.dlg.wide { width: 760px; }
.dlg.wide .dlg-body { max-height: 70vh; overflow-y: auto; padding-right: 4px; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); gap: 10px; margin: 8px 0 6px; }
.tpl { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 10px 8px 9px; border: 1px solid var(--line); border-radius: 8px; background: #fff; text-align: center; }
.tpl:hover { border-color: var(--accent); background: var(--accent-weak); }
.tpl-prev { height: 120px; width: 100%; display: flex; align-items: center; justify-content: center; }
.tpl-svg { max-width: 120px; max-height: 116px; box-shadow: 0 1px 4px rgba(0, 0, 0, .22); }
.tpl-name { font-weight: 600; font-size: 12.5px; }
.tpl-sub { color: var(--muted); font-size: 11.5px; }
.tpl-del { position: absolute; top: 4px; right: 6px; color: var(--muted); font-size: 16px; line-height: 1; padding: 2px 5px; border-radius: 4px; }
.tpl-del:hover { background: #fde2e2; color: #c0282d; }
.tpl-del.sure { font-size: 11px; background: #e5484d; color: #fff; font-weight: 600; }
.guide.gv.fold::before { border-left: 1px dashed #e5484d; }

/* ---------- tables ---------- */
.obj-table { height: auto; }
.ttable { border-collapse: collapse; table-layout: fixed; }
.ttable td { overflow: hidden; overflow-wrap: break-word; }
.ccontent { outline: none; min-height: 1.1em; user-select: none; }
.ccontent p, .ccontent div { margin: 0; }
.ccontent ul, .ccontent ol { margin: 0; padding-left: 1.3em; }
.obj-table.editing .ccontent[contenteditable="true"] { user-select: text; cursor: text; }
.tbl-local { position: absolute; transform-origin: 50% 50%; }
.cell-sel { position: absolute; outline: 2px solid var(--accent); background: rgba(43, 108, 255, .12); }
.cell-sel.editing { background: none; outline-width: 1.5px; }
.col-rz { position: absolute; top: 0; bottom: 0; width: 7px; transform: translateX(-50%); cursor: col-resize; pointer-events: auto; z-index: 3; }
.row-rz { position: absolute; left: 0; right: 0; height: 7px; transform: translateY(-50%); cursor: row-resize; pointer-events: auto; z-index: 2; }
.col-rz:hover, .row-rz:hover { background: rgba(43, 108, 255, .35); }
.handle.move-grip { left: -14px; top: -14px; width: 18px; height: 18px; transform: none; border-radius: 4px; background: var(--sel); color: #fff; font-size: 12px; line-height: 15px; text-align: center; cursor: move; border-color: var(--sel); }
.btn3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 4px; width: 100%; }
.pbtn.sm { margin-top: 0; height: 26px; font-size: 12px; padding: 0 4px; }
.pbtn:disabled { opacity: .45; cursor: default; background: #fff; border-color: var(--line); }

/* ---------- printing ---------- */
.safe-box { position: absolute; border: 1px dashed rgba(229, 72, 77, .75); }
#printRoot { display: none; }
@media print {
  html, body { height: auto !important; overflow: visible !important; background: #fff !important; margin: 0 !important; }
  #app, #toast, .menu-pop, .font-pop, dialog { display: none !important; }
  #printRoot { display: block; }
  .print-page { position: relative; overflow: hidden; break-after: page; background: #fff; }
  .print-page.last { break-after: auto; }
  #printRoot, #printRoot * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.print-steps { margin: 8px 0 4px; padding-left: 20px; }
.print-steps li { margin: 3px 0; }
.dlg .radio { display: flex; align-items: center; gap: 6px; margin: 4px 0; }
.dlg .radio input[type=text] { width: 120px; }
.ok-note { background: #e8f6ee; border: 1px solid #a8dcbc; color: #1d5e37; padding: 7px 10px; border-radius: 5px; font-size: 12.5px; }

/* ---------- hover ---------- */
.hover-box { position: absolute; outline: 1px dotted rgba(43, 108, 255, .75); outline-offset: 1px; }
#workspace[data-tool="select"] .obj-text, #workspace[data-tool="select"] .obj-table td { cursor: text; }
#workspace[data-tool="select"] .obj-image, #workspace[data-tool="select"] .obj-rect,
#workspace[data-tool="select"] .obj-ellipse, #workspace[data-tool="select"] .obj-line { cursor: move; }

/* ---------- text wrap ---------- */
.tflow { display: block; }
.wrapf { pointer-events: none; }
.obj-text.wrapped { justify-content: flex-start !important; }
.wrap-seg { display: grid; grid-template-columns: repeat(4, auto); width: 100%; margin-bottom: 4px; }
.wrap-seg button { padding: 3px 4px; }
.wrap-btn { gap: 2px; padding: 0 4px 0 6px; }
.wrap-btn .caret { font-size: 10px; color: var(--muted); }
.mi-label { display: inline-flex; align-items: center; gap: 8px; }
.mi-label .ic { color: #4b5466; }
.dlg-btns button:disabled { opacity: .45; cursor: default; }

/* ---------- freeform shapes ---------- */
.poly-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; display: block; }
#workspace[data-tool="select"] .obj-poly { cursor: move; }

/* table cells without lines: faint dotted outlines on screen only (never printed or exported) */
#page.show-tgrid #objects .ttable.no-lines td { outline: calc(1px * var(--inv)) dotted rgba(43, 108, 255, .45); outline-offset: calc(-0.5px * var(--inv)); }

/* note for browsers without every feature */
.browser-note { position: fixed; left: 14px; bottom: 40px; z-index: 900; max-width: 380px; background: #fff; color: #222; border: 1px solid #c9d3e3; border-left: 4px solid #3b6fd4; border-radius: 8px; box-shadow: 0 6px 24px rgba(0,0,0,.18); padding: 12px 14px; font-size: 13px; line-height: 1.45; display: grid; gap: 8px; }
.browser-note .bn-title { font-weight: 700; }
.browser-note .bn-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.clip-layer { position: absolute; inset: 0; overflow: hidden; }
.obj-image .clip-layer img { width: 100%; height: 100%; }

/* zoom slider */
#zoomRange { width: 130px; accent-color: #3b6fd4; margin: 0 2px; cursor: pointer; }
.zoom-ico { color: #556; font-size: 15px; line-height: 1; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 4px; background: transparent; cursor: pointer; user-select: none; }
.zoom-ico:hover { background: rgba(0,0,0,.08); color: #222; }
.tbtn.txt.ts { text-shadow: 1.5px 1.5px 1px rgba(0,0,0,.45); font-weight: 600; }
.pbtn.ts-toggle.on { background: #e3ecfb; border-color: #3b6fd4; color: #1d4fb8; }
.tip-anchor { position: absolute; width: 0; height: 0; z-index: 5; }
.tip-anchor > .tip { left: 0; top: 0; }
#objects .obj-text.is-empty:not(.editing) .tflow::before { content: 'Empty text box'; position: absolute; left: 0; top: 0; color: #9aa3b5; font: italic 11px/1.4 "Segoe UI", sans-serif; pointer-events: none; white-space: nowrap; }
#objects .obj-text.is-empty:not(.editing) .tflow { position: relative; }
@media print { .obj-text.is-empty .tflow::before { content: none !important; } }
#workspace.edge-move, #workspace.edge-move * { cursor: move !important; }
/* bullets and numbers are drawn by us (not the browser's marker) so they can grow with the text and take its shadow */
.tcontent ul, .tcontent ol, .ccontent ul, .ccontent ol { list-style: none; }
.tcontent li, .ccontent li { margin-left: max(0px, calc(var(--mk, 0px) * 1.25 - 1.4em)); }
.tcontent li::before, .ccontent li::before { content: '•'; display: inline-block; width: 1.1em; margin-left: -1.1em; font-size: var(--mk, 1em); text-shadow: var(--mks, none); text-align: left; text-indent: 0; }
.tcontent li::before, .ccontent li::before { width: max(1.1em, 0px); }
.tcontent ol > li::before, .ccontent ol > li::before { content: counter(list-item) '.'; }
.tcontent ul ul > li::before, .ccontent ul ul > li::before { content: '◦'; }
.import-report { max-width: 520px; line-height: 1.5; }
.import-report .ir-head { font-weight: 600; margin: 12px 0 4px; }
.import-report .ir-notes { margin: 0 0 10px; padding-left: 20px; }
.import-report .ir-notes li { margin: 4px 0; }
.import-report .ir-ok { color: #2e7d32; }
.ts-item { display: flex; align-items: center; gap: 10px; }
.ts-sample { font: 700 15px "Segoe UI", system-ui, -apple-system, Arial, sans-serif; width: 26px; }
.ts-pop .ts-item { justify-content: flex-start; text-align: left; }
.ts-pop .ts-sample { flex: none; width: 26px; text-align: center; }
.tbtn.ts-btn { width: auto; padding: 0 5px 0 7px; display: inline-flex; align-items: center; gap: 2px; }
.tbtn.ts-btn .ts-caret { font-size: 9px; color: var(--muted); text-shadow: none; font-weight: 400; }
.trial-mark { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(calc(-1 * var(--ang))); white-space: nowrap; font: 700 40mm Arial, Helvetica, sans-serif; color: rgba(110, 125, 150, .18); pointer-events: none; z-index: 99999; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.print-page { position: relative; }
.trial-btn { margin-left: auto; margin-right: 8px; background: #f5b400; color: #222; border: 0; border-radius: 5px; padding: 4px 10px; font-weight: 600; cursor: pointer; font-size: 12px; }
.trial-btn:hover { background: #ffc61a; }
.licence-dlg textarea { width: 100%; min-height: 84px; font: 12px/1.4 Consolas, monospace; box-sizing: border-box; }
.licence-dlg .lic-err { color: #c62828; min-height: 1.4em; margin-top: 6px; }
.licence-dlg .lic-ok { color: #2e7d32; font-weight: 600; }
.licence-dlg p { line-height: 1.5; }
.licence-dlg { width: 500px; max-width: 80vw; }
.dlg-btns button { white-space: nowrap; }
