:root {
  --brand: #1c4a37;
  --brand-2: #143426;
  --accent: #e8b517;
  --ink: #15201a;
  --muted: #5d6a62;
  --line: #d4dbd3;
  --panel: #ffffff;
  --panel-2: #f3f6f2;
  --stage: #5f6763;
  --sel: #1a73e8;
  --danger: #c62828;
  --radius: 7px;
  font-family: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 14px;
  color: var(--ink);
}
@font-face { font-family: "IBM Plex Sans"; src: url("/assets/fonts/ibmplexsans-var.woff2") format("woff2"); font-weight: 400 600; font-display: swap; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--panel-2); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

#app {
  display: grid;
  height: 100vh;
  grid-template-rows: 48px minmax(0, 1fr) 30px;
  grid-template-columns: 58px auto minmax(0, 1fr) 290px;
  grid-template-areas: "bar bar bar bar" "tools pages stage side" "status status status status";
}

/* top bar */
.bar { grid-area: bar; display: flex; align-items: center; gap: 10px; padding: 0 10px; background: var(--brand); color: #fff; border-bottom: 3px solid var(--accent); min-width: 0; }
.brand { display: flex; align-items: center; gap: 7px; color: #fff; text-decoration: none; font-weight: 600; font-size: 15px; flex: none; }
.brand svg { width: 26px; height: 26px; }
.brand b { color: var(--accent); font-weight: 700; }
.doc { display: flex; align-items: center; gap: 6px; min-width: 0; font-weight: 500; opacity: .95; }
#docName { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 28vw; }
.dirty { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.grow { flex: 1 1 auto; }
.group { display: flex; align-items: center; gap: 3px; padding-left: 8px; border-left: 1px solid rgba(255,255,255,.18); }
.bar button { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18); color: #fff; border-radius: 6px; height: 30px; padding: 0 10px; cursor: pointer; white-space: nowrap; }
.bar button:hover:not(:disabled) { background: rgba(255,255,255,.2); }
.bar button:disabled { opacity: .45; cursor: default; }
.bar button.primary { background: var(--accent); color: var(--ink); border-color: var(--accent); font-weight: 600; }
.bar button.icon { width: 30px; padding: 0; display: grid; place-items: center; }
.bar svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.zoomval { min-width: 58px; font-variant-numeric: tabular-nums; }
.pager input { width: 42px; height: 30px; text-align: center; border-radius: 6px; border: 1px solid rgba(255,255,255,.25); background: rgba(0,0,0,.15); color: #fff; }
.pager .of { font-size: 13px; opacity: .85; margin: 0 4px; white-space: nowrap; }

/* tools */
.tools { grid-area: tools; background: var(--panel); border-right: 1px solid var(--line); overflow-y: auto; padding: 6px 4px; display: flex; flex-direction: column; gap: 2px; }
.tools .sep { height: 1px; background: var(--line); margin: 5px 4px; flex: none; }
.tools .cap { font-size: 9.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); text-align: center; margin: 2px 0 1px; }
.tool { position: relative; display: grid; place-items: center; gap: 1px; width: 50px; min-height: 44px; padding: 4px 0 3px; border: 1px solid transparent; border-radius: 6px; background: none; cursor: pointer; color: var(--ink); flex: none; }
.tool svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tool span { font-size: 9.5px; line-height: 1.1; color: var(--muted); }
.tool:hover { background: var(--panel-2); }
.tool.on { background: #e4efe8; border-color: #9cc1ab; color: var(--brand); }
.tool.on span { color: var(--brand); font-weight: 600; }
.tool kbd { position: absolute; top: 2px; right: 3px; font: 600 8.5px/1 system-ui, sans-serif; color: #9aa59e; }

/* pages */
.pages { grid-area: pages; width: 178px; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.pages-head { padding: 8px 10px; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border-bottom: 1px solid var(--line); }
.pages-list { overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.thumb { display: block; width: 100%; padding: 5px; border: 2px solid transparent; border-radius: 6px; background: var(--panel-2); cursor: pointer; text-align: left; }
.thumb.on { border-color: var(--brand); background: #e4efe8; }
.thumb canvas { display: block; width: 100%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); min-height: 60px; }
.thumb .tl { display: flex; justify-content: space-between; align-items: center; font-size: 12px; margin-top: 4px; gap: 4px; }
.thumb .tl em { font-style: normal; font-size: 10.5px; color: var(--muted); }
.thumb .cnt { background: var(--accent); color: var(--ink); border-radius: 9px; padding: 0 6px; font-size: 10.5px; font-weight: 600; }

/* stage */
.stage { grid-area: stage; position: relative; overflow: hidden; background: var(--stage); touch-action: none; cursor: default; outline: none; }
.stage.draw { cursor: crosshair; }
.stage.pan, .stage.space { cursor: grab; }
.stage.panning { cursor: grabbing; }
.stage.over-mk { cursor: move; }
#base { position: absolute; left: 0; top: 0; transform-origin: 0 0; background: #fff; box-shadow: 0 2px 12px rgba(0,0,0,.35); image-rendering: auto; }
#detail { position: absolute; left: 0; top: 0; transform-origin: 0 0; pointer-events: none; }
#ink { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
#ink .draft { pointer-events: none; }
#editor { position: absolute; z-index: 5; margin: 0; border: 1.5px solid var(--sel); outline: none; background: rgba(255,255,255,.92); resize: none; overflow: hidden; line-height: 1.2; font-family: Helvetica, Arial, sans-serif; white-space: pre-wrap; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.drop { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; }
#app:not(.is-empty) .drop { display: none; }
.stage.dragover .drop, .stage.dragover { outline: 3px dashed var(--accent); outline-offset: -10px; }
#app.is-empty .stage.dragover .drop-card { background: #fffbea; }
.drop-card { max-width: 480px; background: var(--panel); border-radius: 12px; padding: 30px 30px 24px; text-align: center; box-shadow: 0 6px 30px rgba(0,0,0,.3); }
.drop-card h1 { font-size: 21px; margin: 6px 0 10px; }
.drop-card p { color: var(--muted); line-height: 1.5; margin: 0 0 10px; }
.drop-icon { width: 46px; height: 46px; fill: none; stroke: var(--brand); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.small { font-size: 12.5px; }
.linkish { background: none; border: 0; padding: 0; color: var(--brand); text-decoration: underline; cursor: pointer; font-weight: 600; }
.busy { position: absolute; left: 50%; top: 18px; transform: translateX(-50%); z-index: 10; display: flex; align-items: center; gap: 10px; background: rgba(21,32,26,.92); color: #fff; padding: 9px 16px; border-radius: 22px; font-size: 13.5px; box-shadow: 0 2px 10px rgba(0,0,0,.3); }
.spinner { width: 16px; height: 16px; border: 2.5px solid rgba(255,255,255,.3); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.banner { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 9; background: #fff; color: var(--ink); border-radius: 10px; padding: 10px 12px 10px 16px; display: flex; align-items: center; gap: 10px; box-shadow: 0 4px 18px rgba(0,0,0,.35); max-width: calc(100% - 32px); font-size: 13.5px; }
.banner button { border: 1px solid var(--line); background: var(--panel-2); border-radius: 6px; padding: 5px 10px; cursor: pointer; white-space: nowrap; }
.banner button.primary { background: var(--brand); color: #fff; border-color: var(--brand); }

/* side panel */
.side { grid-area: side; background: var(--panel); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.tabs { display: flex; border-bottom: 1px solid var(--line); flex: none; }
.tab { flex: 1; border: 0; background: none; padding: 10px 8px 9px; cursor: pointer; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; }
.tab.on { color: var(--brand); border-bottom-color: var(--brand); }
.pill { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--panel-2); font-size: 11px; color: var(--muted); }
.panel { overflow-y: auto; padding: 12px; flex: 1; min-height: 0; }
.panel h3 { margin: 0 0 2px; font-size: 15px; }
.panel .sub { color: var(--muted); font-size: 12.5px; margin-bottom: 10px; }
.field { margin: 0 0 11px; }
.field > label, .field > .lab { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.field input[type=text], .field textarea, .field select { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; background: #fff; }
.field textarea { min-height: 64px; resize: vertical; }
.field input[type=range] { width: 100%; accent-color: var(--brand); }
.inline { display: flex; gap: 8px; align-items: center; }
.inline > * { flex: 1; }
.check { display: flex; align-items: center; gap: 7px; font-size: 13px; cursor: pointer; }
.check input { accent-color: var(--brand); width: 15px; height: 15px; }
.swatches { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.sw { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; }
.sw.on { box-shadow: 0 0 0 2px var(--sel); }
.swatches input[type=color] { width: 26px; height: 26px; border: 0; padding: 0; background: none; cursor: pointer; }
.measure-big { background: var(--panel-2); border-radius: 8px; padding: 10px 12px; margin: 0 0 12px; }
.measure-big .v { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.measure-big .k { font-size: 12px; color: var(--muted); }
.measure-big .w { font-size: 12.5px; color: var(--danger); margin-top: 3px; }
.meta { font-size: 11.5px; color: var(--muted); margin-top: 6px; }
.btn { border: 1px solid var(--line); background: var(--panel-2); border-radius: 6px; padding: 6px 10px; cursor: pointer; }
.btn:hover { background: #e8ede6; }
.btn.danger { color: var(--danger); }
.btn-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.empty-note { color: var(--muted); font-size: 13px; line-height: 1.5; }

.list-head { display: flex; gap: 8px; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.list-head > button { border: 1px solid var(--line); background: var(--panel-2); border-radius: 6px; padding: 5px 9px; cursor: pointer; font-size: 12.5px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 5px 9px; cursor: pointer; font-size: 12.5px; }
.seg button.on { background: var(--brand); color: #fff; }
#totals table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-bottom: 12px; }
#totals th, #totals td { padding: 5px 4px; border-bottom: 1px solid var(--line); text-align: left; }
#totals td.n, #totals th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
#totals caption { text-align: left; font-weight: 600; font-size: 12px; color: var(--muted); padding-bottom: 4px; }
.rows { display: flex; flex-direction: column; gap: 4px; }
.row-mk { display: grid; grid-template-columns: 12px 1fr auto; gap: 8px; align-items: start; padding: 7px 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; cursor: pointer; text-align: left; width: 100%; }
.row-mk:hover { border-color: #9cc1ab; }
.row-mk.on { border-color: var(--sel); background: #eef4fe; }
.row-mk .dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 4px; }
.row-mk .t { font-size: 13px; font-weight: 600; }
.row-mk .c { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 170px; }
.row-mk .v { font-size: 12.5px; font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.row-mk .pg { font-size: 11px; color: var(--muted); font-weight: 400; }

/* status bar */
.status { grid-area: status; display: flex; align-items: center; gap: 12px; padding: 0 10px; background: var(--panel); border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); min-width: 0; }
.scale-btn { border: 1px solid var(--line); background: var(--panel-2); border-radius: 5px; padding: 2px 9px; cursor: pointer; font-size: 12.5px; white-space: nowrap; }
.scale-btn.unset { background: #fff4d1; border-color: var(--accent); color: #6b4e00; font-weight: 600; }
.scale-btn:disabled { opacity: .6; cursor: default; }
.hint { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.readout { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink); white-space: nowrap; }

/* dialogs */
dialog { border: 0; border-radius: 12px; padding: 0; box-shadow: 0 12px 40px rgba(0,0,0,.35); max-width: calc(100vw - 32px); }
dialog::backdrop { background: rgba(10,20,15,.45); }
.dlg { padding: 20px 22px 16px; width: 420px; max-width: 100%; display: flex; flex-direction: column; gap: 12px; }
.dlg.wide { width: 640px; }
.dlg h2 { margin: 0; font-size: 18px; }
.dlg label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.dlg label.check { flex-direction: row; font-weight: 400; color: var(--ink); font-size: 13.5px; }
.dlg input[type=text], .dlg select { border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; font-size: 14px; color: var(--ink); font-weight: 400; background: #fff; }
.dlg .row { display: flex; gap: 10px; }
.dlg .row .grow { flex: 1; }
.dlg fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px 10px; margin: 0; display: flex; gap: 14px; flex-wrap: wrap; }
.dlg legend { font-size: 12px; font-weight: 600; color: var(--muted); padding: 0 4px; }
.dlg fieldset label { flex-direction: row; align-items: center; gap: 6px; font-weight: 400; color: var(--ink); font-size: 13.5px; }
.dlg .muted { color: var(--muted); margin: 0; font-size: 13.5px; line-height: 1.45; }
.dlg .err { color: var(--danger); margin: 0; font-size: 13px; }
.dlg-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }
.dlg-actions button { border: 1px solid var(--line); background: var(--panel-2); border-radius: 7px; padding: 7px 14px; cursor: pointer; }
.dlg-actions button.primary { background: var(--brand); color: #fff; border-color: var(--brand); font-weight: 600; }
.dlg-actions .left { margin-right: auto; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips:empty { display: none; }
.chip { border: 1px solid var(--brand); color: var(--brand); background: #fff; border-radius: 16px; padding: 4px 12px; cursor: pointer; font-weight: 600; }
.chip.on { background: var(--brand); color: #fff; }
.help-cols { display: grid; grid-template-columns: 1fr 1.3fr; gap: 20px; }
.help-cols h3 { font-size: 13px; margin: 8px 0 6px; color: var(--brand); }
.help-cols dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; font-size: 13px; }
.help-cols dt { font-weight: 600; white-space: nowrap; }
.help-cols dd { margin: 0; color: var(--muted); }

.toast { position: fixed; left: 50%; bottom: 44px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 9px 16px; border-radius: 8px; font-size: 13.5px; z-index: 50; box-shadow: 0 4px 16px rgba(0,0,0,.3); max-width: calc(100vw - 32px); }
.toast.err { background: var(--danger); }

#ink .editing text { visibility: hidden; }
.bar button.on { background: rgba(255,255,255,.28); border-color: rgba(255,255,255,.45); }
.lab-v { font-weight: 400; color: var(--muted); margin-left: 4px; }
#app.is-empty #base, #app.is-empty #detail, #app.is-empty #ink { display: none; }
.list-head { flex-wrap: wrap; }
.seg button, .list-head > button { white-space: nowrap; }

/* toolbar: two columns, never scrolls; fitTools() hides labels or adds a column if the window is short */
#app { grid-template-columns: auto auto minmax(0, 1fr) 290px; }
.tools { display: grid; grid-template-columns: repeat(2, 48px); grid-auto-rows: min-content; align-content: start; gap: 2px; padding: 6px 5px; overflow: hidden; }
.tools .sep, .tools .cap { grid-column: 1 / -1; }
.tool { width: 48px; min-height: 46px; }
.tool.locked { box-shadow: inset 0 0 0 2px var(--accent); }
.tool.locked::after { content: ""; position: absolute; left: 4px; top: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.tools.c1 .tool span, .tools.c1 .cap { display: none; }
.tools.c1 .tool { min-height: 34px; }
.tools.c1 .sep { margin: 3px 4px; }
.tools.c2 { grid-template-columns: repeat(3, 40px); }
.tools.c2 .tool { width: 40px; min-height: 32px; }
.tools.c2 .tool kbd { display: none; }

/* drawing bar */
.drawbar { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 8; display: flex; align-items: center; gap: 8px; background: rgba(21,32,26,.94); color: #fff; padding: 6px 6px 6px 14px; border-radius: 22px; font-size: 13.5px; box-shadow: 0 3px 12px rgba(0,0,0,.3); white-space: nowrap; max-width: calc(100% - 20px); }
.drawbar button { border: 1px solid rgba(255,255,255,.3); background: rgba(255,255,255,.12); color: #fff; border-radius: 16px; padding: 4px 12px; cursor: pointer; font-size: 13px; }
.drawbar button:hover { background: rgba(255,255,255,.22); }
.drawbar button.primary { background: var(--accent); border-color: var(--accent); color: var(--ink); font-weight: 600; }

/* top bar: shrink rather than cut off */
.bar { overflow-x: auto; scrollbar-width: none; }
.bar::-webkit-scrollbar { display: none; }
.group, .brand { flex: none; }
@media (max-width: 1400px) { .brand span { display: none; } #docName { max-width: 20vw; } }
@media (max-width: 1250px) { #btnSaveAs, #zoomWidth { display: none; } .bar { gap: 6px; } .group { padding-left: 6px; } }
@media (max-width: 1100px) { #app { grid-template-columns: auto auto minmax(0, 1fr) 250px; } .pages { width: 150px; } }
@media (max-width: 760px) {
  #app { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "bar bar" "tools stage" "status status"; }
  .side, .pages { display: none; }
}

/* send to calculator */
.send-menu { position: fixed; z-index: 60; width: 270px; max-height: 70vh; overflow-y: auto; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 28px rgba(0,0,0,.25); padding: 6px; }
.send-menu .sm-head { font-size: 12.5px; color: var(--muted); padding: 6px 8px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.send-menu .sm-head b { color: var(--ink); }
.send-menu a { display: block; padding: 7px 8px; border-radius: 6px; color: var(--ink); text-decoration: none; font-size: 13.5px; }
.send-menu a:hover { background: #e4efe8; color: var(--brand); }
.send-menu a::after { content: " \2197"; color: var(--muted); font-size: 12px; }
.send-menu .sm-foot { font-size: 11.5px; color: var(--muted); padding: 8px 8px 4px; border-top: 1px solid var(--line); margin-top: 4px; }
.send-btn { background: var(--brand); color: #fff; border-color: var(--brand); font-weight: 600; }
.send-btn:hover { background: var(--brand-2); }
.mini { border: 1px solid var(--brand); color: var(--brand); background: #fff; border-radius: 5px; padding: 1px 7px; font-size: 11.5px; cursor: pointer; font-weight: 600; }
.mini:hover { background: var(--brand); color: #fff; }

/* sample, tips, phone note, Costd */
.drop-actions { margin: 4px 0 14px !important; }
.btn-sample { background: var(--accent); color: var(--ink); border: 0; border-radius: 8px; padding: 9px 18px; font-weight: 600; cursor: pointer; font-size: 14px; }
.btn-sample:hover { filter: brightness(1.05); }
.phone-note { background: #fff4d1; color: #6b4e00 !important; border-radius: 6px; padding: 8px 10px; }
.drop-card a { color: var(--brand); }
.tips { position: absolute; right: 14px; top: 14px; z-index: 9; width: 300px; background: #fff; border-radius: 10px; padding: 12px 14px; box-shadow: 0 6px 24px rgba(0,0,0,.3); font-size: 13px; line-height: 1.45; border-top: 4px solid var(--accent); }
.tips ol { margin: 8px 0 10px; padding-left: 18px; }
.tips li { margin-bottom: 6px; }
.tips button { background: var(--brand); color: #fff; border: 0; border-radius: 6px; padding: 6px 14px; cursor: pointer; font-weight: 600; }
.costd-note { margin-top: 14px; padding: 10px 12px; border-left: 3px solid #ff7a1a; background: var(--panel-2); border-radius: 0 6px 6px 0; font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.costd-note a { color: var(--ink); font-weight: 700; }
.dlg .muted a { color: var(--brand); }
.tips { width: 270px; padding-right: 30px; }
.tips-x { position: absolute; right: 6px; top: 4px; border: 0; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); padding: 2px 6px; }
.tips-x:hover { color: var(--ink); }
.tips button.tips-x { background: none; color: var(--muted); font-weight: 400; padding: 2px 6px; border-radius: 4px; }
.tips button.tips-x:hover { background: var(--panel-2); color: var(--ink); }

/* audit fixes, 16 Oct 2026 */
:root { --field: #87928b; }
.field input[type=text], .field textarea, .field select, .dlg input[type=text], .dlg select, .btn, .seg, .list-head > button,
.scale-btn, .banner button, .dlg-actions button, .dlg fieldset { border-color: var(--field); }
.sw { width: 24px; height: 24px; box-shadow: 0 0 0 1px var(--field); }
.mini { min-height: 24px; padding: 2px 8px; }
.tool kbd { color: var(--muted); }
:focus-visible { outline: 2px solid var(--sel); outline-offset: 2px; }
.bar :focus-visible, .drawbar :focus-visible { outline-color: #fff; }
.tool span { white-space: nowrap; }
.tool.m:not(.on) svg { color: var(--brand); }
.tool.m:not(.on) span { color: var(--brand); }
.drawbar .lab-chip { background: var(--accent); color: var(--ink); font-weight: 600; border-radius: 12px; padding: 2px 10px; margin-left: -8px; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
dialog form.dlg { max-height: calc(100vh - 40px); overflow-y: auto; }
dialog .dlg-actions { position: sticky; bottom: -16px; background: var(--panel); padding: 8px 0 16px; margin-bottom: -16px; }
.dlg .warn { margin: 0; padding: 8px 10px; border-radius: 6px; background: #fff4d1; color: #6b4e00; font-size: 13.5px; line-height: 1.45; border-left: 3px solid var(--accent); }
.btn-row .danger { margin-left: auto; }
.btn-row.convert { margin: -2px 0 12px; }
@media (max-width: 1250px) { #zoomPage { display: none; } }

/* snapping and magnifier, 17 Oct 2026 */
.tog { border: 1px solid var(--field); background: var(--panel-2); color: var(--muted); border-radius: 5px; padding: 2px 9px 2px 22px; cursor: pointer; font-size: 12.5px; white-space: nowrap; position: relative; }
.tog::before { content: ""; position: absolute; left: 8px; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; border: 1.5px solid var(--muted); box-sizing: border-box; }
.tog[aria-pressed=true] { color: var(--brand); border-color: #9cc1ab; background: #e4efe8; font-weight: 600; }
.tog[aria-pressed=true]::before { background: var(--brand); border-color: var(--brand); }
.tog.none[aria-pressed=true] { color: var(--muted); font-weight: 400; background: var(--panel-2); border-color: var(--field); }
.tog.none[aria-pressed=true]::before { background: none; border-color: var(--muted); }
.loupe { position: absolute; left: 0; top: 0; z-index: 6; pointer-events: none; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.35), 0 6px 18px rgba(0,0,0,.35); }
