/* Image Digitizer — styled to the chemprocesseng.com design system (DESIGN.md).
   All rules are scoped to .idg so the tool can sit inside any page.
   Load css/fonts.css first for Newsreader, Open Sans and IBM Plex Mono. */

.idg {
  /* colour tokens */
  --primary: #a6d7f0;
  --primary-hover: #8fcbe9;
  --secondary: #8f5a39;
  --ink: #000000;
  --ink-muted: #4d5459;
  --ink-subtle: #5f646a;
  --interactive: #12647e;
  --focus: #12647e;
  --canvas: #f5f7f8;
  --surface: #ffffff;
  --surface-sunken: #e6e9eb;
  --art-3: #e7f3f9;
  --border: #e5e7eb;
  --border-strong: #b1b5b9;
  --rule: #000000;
  --neutral-900: #292e33;
  --success: #006b48;
  --warning: #9e4200;
  --error: #b42318;
  /* type */
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "Open Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  /* shape + motion */
  --r-xs: 4px; --r-sm: 8px; --r-md: 20px; --r-lg: 100px;
  --float: 0 8px 24px rgba(0, 0, 0, .12);
  --fast: 200ms; --base: 400ms;
  --ease: cubic-bezier(.4, .14, .3, 1);
  --ease-enter: cubic-bezier(0, 0, .3, 1);
  --idg-height: 820px;

  position: relative;
  display: flex;
  flex-direction: column;
  height: var(--idg-height);
  min-height: 600px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font: 400 14px/1.55 var(--sans);
  overflow: hidden;
  overflow: clip;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
.idg *, .idg *::before, .idg *::after { box-sizing: border-box; }
.idg svg { width: 18px; height: 18px; flex: none; }
.idg [hidden] { display: none !important; }
.idg button { font: inherit; color: inherit; cursor: pointer; }
.idg button:disabled { opacity: .4; cursor: default; }
.idg :focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.idg b, .idg strong { font-weight: 600; }
.idg kbd { font: 12px var(--mono); border: 1px solid var(--border-strong); border-radius: var(--r-xs); padding: 0 4px; background: var(--surface); }

/* ---------------------------------------------------------------- toolbar */
.idg-top { display: flex; align-items: center; gap: 16px; padding: 10px 16px; border-bottom: 1px solid var(--border); flex: none; min-height: 60px; }
.idg-docname { margin-right: auto; min-width: 0; line-height: 1.3; }
.idg-docname b { display: block; font: 300 20px/1.25 var(--serif); letter-spacing: -.005em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.idg-docname small { display: block; font-size: 13px; color: var(--ink-subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.idg-top-actions { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; justify-content: flex-end; }
.idg-sep { width: 1px; height: 22px; background: var(--border); margin: 0 6px; }

/* ---------------------------------------------------------------- buttons */
.idg-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 12px; border-radius: var(--r-md); border: 1px solid transparent;
  background: transparent; color: var(--ink); font-weight: 400; white-space: nowrap;
  transition: background-color var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.idg-btn:hover:not(:disabled) { background: var(--surface-sunken); }
.idg-btn:active:not(:disabled) { transform: scale(.98); }
.idg-btn.idg-icon { width: 36px; padding: 0; }

/* primary: powder-blue pill, black semibold label, arrow in the extra right padding */
.idg-btn.idg-primary {
  position: relative; height: 44px; padding: 10px 48px 10px 24px; border-radius: var(--r-lg);
  background: var(--primary); border-color: var(--primary); font-size: 16px; font-weight: 600; line-height: 1.4;
}
.idg-btn.idg-primary::after {
  content: "→"; position: absolute; right: 22px; top: 50%; transform: translate(0, -52%);
  font-weight: 400; transition: transform var(--fast) var(--ease);
}
.idg-btn.idg-primary:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); }
.idg-btn.idg-primary:hover:not(:disabled)::after { transform: translate(3px, -52%); }

/* secondary: 1 px black border, sienna label, 20 px radius */
.idg-btn.idg-secondary { height: 44px; padding: 10px 24px; border: 1px solid var(--ink); color: var(--secondary); font-size: 16px; font-weight: 600; background: var(--surface); }
.idg-btn.idg-secondary:hover:not(:disabled) { background: var(--art-3); }
.idg-btn.idg-secondary.idg-sm { height: 34px; padding: 6px 14px; font-size: 13px; letter-spacing: .01em; }
.idg-btn.idg-secondary svg { width: 16px; height: 16px; }

/* text buttons and links: black, 1 px underline offset 3 px, thicker on hover */
.idg-textbtn, .idg-link {
  background: none; border: 0; padding: 4px 0; color: var(--ink); font-weight: 600; font-size: 14px;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
}
.idg-textbtn:hover, .idg-link:hover { text-decoration-thickness: 2px; }
.idg-icon-btn { display: inline-grid; place-items: center; width: 30px; height: 30px; border: 0; background: none; border-radius: var(--r-md); color: var(--ink-subtle); }
.idg-icon-btn:hover { background: var(--surface-sunken); color: var(--ink); }
.idg-icon-btn[data-op="delete"]:hover, .idg-icon-btn[data-sop="delete"]:hover, .idg-icon-btn[data-op$="del"]:hover { color: var(--error); }
.idg-icon-btn svg { width: 17px; height: 17px; }

/* ---------------------------------------------------------------- layout */
.idg-body { flex: 1; display: grid; grid-template-columns: 78px 1fr 380px; min-height: 0; }
.idg-tools { border-right: 1px solid var(--border); padding: 10px 7px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.idg-tool {
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 2px 7px;
  border: 0; border-radius: var(--r-sm); background: none; color: var(--ink-muted); font-size: 11px; line-height: 1.15;
  transition: background-color var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.idg-tool svg { width: 22px; height: 22px; stroke-width: 1.6; }
.idg-tool:hover { background: var(--surface-sunken); color: var(--ink); }
.idg-tool:active { transform: scale(.98); }
.idg-tool.idg-active { background: var(--primary); color: var(--ink); font-weight: 600; }
.idg-tool-sm { padding: 7px 2px; }
.idg-tool-sm svg { width: 20px; height: 20px; }
.idg-tools-sep { height: 1px; background: var(--border); margin: 6px 8px; flex: none; }

.idg-stage { position: relative; min-width: 0; min-height: 0; background: var(--surface-sunken); overflow: hidden; }
.idg-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }

/* floating helpers (the only elements with a shadow) */
.idg-topstack { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; width: max-content; max-width: min(680px, calc(100% - 360px)); z-index: 5; pointer-events: none; }
.idg-hint { background: var(--surface); color: var(--ink); border: 1px solid var(--border); padding: 8px 14px; border-radius: var(--r-sm); font-size: 13px; text-align: center; box-shadow: var(--float); }
.idg-hint .idg-hl { background: var(--c); color: #fff; padding: 1px 6px; border-radius: var(--r-xs); font-weight: 600; }
.idg-toast { background: var(--neutral-900); color: #fff; padding: 9px 16px; border-radius: var(--r-sm); font-size: 13px; box-shadow: var(--float); display: none; gap: 12px; align-items: center; max-width: 100%; }
.idg-toast.idg-show { display: flex; pointer-events: auto; animation: idg-enter var(--base) var(--ease-enter); }
.idg-toast .idg-link { color: #fff; padding: 0; }
@keyframes idg-enter { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

.idg-options { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 16px; max-width: calc(100% - 28px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 8px 16px; box-shadow: var(--float); z-index: 3; font-size: 13px; }
.idg-opt { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; color: var(--ink-muted); }
.idg-opt input[type=range] { width: 130px; accent-color: var(--interactive); }
.idg-opt output { min-width: 28px; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink); text-align: right; }
.idg-opt input[type=color] { width: 30px; height: 28px; padding: 0; border: 1px solid var(--border-strong); border-radius: var(--r-xs); background: none; }
.idg-opt .idg-input.idg-sm { color: var(--ink); }
.idg-options .idg-note { color: var(--ink-muted); white-space: normal; font-size: 13px; margin: 0; padding: 0; border: 0; }
.idg-loupe { position: absolute; top: 12px; left: 12px; width: 160px; height: 160px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: var(--float); pointer-events: none; z-index: 2; opacity: 0; transition: opacity var(--fast) var(--ease); background: var(--canvas); }
.idg-loupe.idg-on { opacity: 1; }

/* empty state */
.idg-empty { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; z-index: 4; background: var(--surface-sunken); }
.idg-has-image .idg-empty { display: none; }
.idg-drop { max-width: 520px; width: 100%; padding: 40px 44px 32px; background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--r-sm); }
.idg-marker { font: 400 15px/1.3 var(--serif); letter-spacing: .02em; color: var(--secondary); margin: 0 0 8px; }
.idg-drop h2 { margin: 0 0 10px; font: 400 30px/1.25 var(--serif); }
.idg-drop p { margin: 0 0 24px; color: var(--ink-muted); font-size: 16px; line-height: 1.65; }
.idg-drop-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.idg-drop-more { margin-top: 20px; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.idg-dropveil { position: absolute; inset: 10px; border: 2px dashed var(--interactive); border-radius: var(--r-sm); background: rgba(166, 215, 240, .25); display: none; place-items: center; font: 300 30px var(--serif); z-index: 6; pointer-events: none; }
.idg-dragging .idg-dropveil { display: grid; }

/* ---------------------------------------------------------------- side panel */
.idg-panel { border-left: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.idg-steps { list-style: none; display: flex; margin: 0; padding: 14px 20px 10px; gap: 6px; }
.idg-steps li { flex: 1; display: flex; align-items: baseline; gap: 6px; font-size: 13px; color: var(--ink-subtle); cursor: pointer; white-space: nowrap; }
.idg-steps li i { font: 400 15px/1.3 var(--serif); font-style: normal; letter-spacing: .02em; color: var(--ink-subtle); font-variant-numeric: tabular-nums; }
.idg-steps li.idg-done, .idg-steps li.idg-done i { color: var(--success); }
.idg-steps li:hover span { text-decoration: underline; text-underline-offset: 3px; }
.idg-tabs { display: flex; border-bottom: 1px solid var(--border); padding: 0 12px; gap: 4px; overflow-x: auto; flex: none; }
.idg-tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 8px 9px; color: var(--ink-subtle); white-space: nowrap; font-size: 14px; margin-bottom: -1px; }
.idg-tabs button:hover { color: var(--ink); }
.idg-tabs button.idg-active { color: var(--ink); border-bottom-color: var(--ink); font-weight: 600; }
.idg-tabs em { font-style: normal; font-weight: 400; color: var(--ink-subtle); font-variant-numeric: tabular-nums; margin-left: 2px; }
.idg-tabs em:empty { display: none; }
.idg-panes { flex: 1; overflow-y: auto; min-height: 0; }
.idg-pane { padding: 18px 20px 28px; }
.idg-pane > .idg-btn.idg-primary { margin: 2px 0 18px; }
.idg-help { color: var(--ink-muted); margin: 0 0 14px; font-size: 14px; }
.idg-note { color: var(--ink-muted); font-size: 13px; margin: 14px 0 0; padding-left: 12px; border-left: 2px solid var(--secondary); }
.idg-muted { color: var(--ink-subtle); font-size: 13px; }
.idg-subhead { font: 600 13px/1.4 var(--sans); letter-spacing: .01em; color: var(--ink-subtle); margin: 26px 0 10px; padding-top: 10px; border-top: 1px solid var(--rule); }
.idg-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; font-size: 13px; color: var(--ink); font-weight: 600; }
.idg-input {
  height: 44px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); padding: 10px 12px;
  font: 400 15px/1.4 var(--sans); color: var(--ink); background: var(--surface); min-width: 0; width: 100%;
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.idg-input.idg-sm { height: 34px; font-size: 13px; width: auto; padding: 4px 8px; }
.idg-input:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 2px rgba(18, 100, 126, .25); }
.idg-check { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 8px 0; cursor: pointer; }
.idg-check input { width: 17px; height: 17px; accent-color: var(--interactive); margin: 0; }
.idg-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; align-items: start; }

/* calibration */
.idg-caltable { display: flex; flex-direction: column; margin-bottom: 14px; border-top: 1px solid var(--rule); }
.idg-calrow { display: grid; grid-template-columns: 38px 1fr auto auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
.idg-calrow[data-calrow^="P"] { grid-template-columns: 38px 1fr auto; }
.idg-calrow.idg-next { background: var(--art-3); box-shadow: -8px 0 0 var(--art-3), 8px 0 0 var(--art-3); }
.idg-calrow.idg-flash { animation: idg-tint 1.5s var(--ease); }
.idg-chip { display: inline-grid; place-items: center; height: 26px; border-radius: var(--r-xs); background: var(--c); color: #fff; font-weight: 600; font-size: 13px; }
.idg-calval { height: 40px; }
.idg-calpx { font-size: 12px; color: var(--ink-subtle); white-space: nowrap; font-variant-numeric: tabular-nums; }
.idg-calpx.idg-set { color: var(--ink-muted); }
.idg-calstatus { display: flex; gap: 8px; align-items: flex-start; padding: 2px 0 2px 12px; border-left: 2px solid var(--border-strong); font-size: 14px; margin: 4px 0 14px; color: var(--ink-muted); }
.idg-calstatus.idg-ok { border-left-color: var(--success); color: var(--ink); }
.idg-calstatus.idg-ok svg { color: var(--success); margin-top: 2px; }
.idg-calstatus.idg-ok small { color: var(--ink-muted); }
.idg-calstatus.idg-warn { border-left-color: var(--warning); color: var(--warning); }
.idg-tips { margin-top: 14px; font-size: 14px; color: var(--ink-muted); }
.idg-tips summary { cursor: pointer; color: var(--ink); font-weight: 600; list-style: none; display: inline-flex; align-items: center; gap: 8px; }
.idg-tips summary::-webkit-details-marker { display: none; }
.idg-tips summary::before { content: "›"; font-size: 20px; line-height: 1; transition: transform var(--base) var(--ease); }
.idg-tips[open] summary::before { transform: rotate(90deg); }
.idg-tips ul { padding-left: 18px; margin: 10px 0 0; }
.idg-tips li { margin-bottom: 6px; }

/* areas: a ruled list, not cards */
.idg-quick { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.idg-list { display: flex; flex-direction: column; }
.idg-list[data-list="areas"] { border-top: 1px solid var(--rule); }
.idg-item { display: grid; grid-template-columns: 24px 1fr auto auto; gap: 10px; align-items: center; padding: 12px 6px 12px 4px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background-color var(--fast) var(--ease); }
.idg-item:hover { background: var(--canvas); }
.idg-item.idg-sel { background: var(--art-3); }
.idg-item.idg-hidden { opacity: .5; }
.idg-swatch { width: 22px; height: 22px; padding: 0; border: 0; border-radius: var(--r-xs); background: none; cursor: pointer; }
.idg-swatch::-webkit-color-swatch-wrapper { padding: 0; }
.idg-swatch::-webkit-color-swatch { border: 0; border-radius: var(--r-xs); }
.idg-swatch::-moz-color-swatch { border: 0; border-radius: var(--r-xs); }
.idg-item-main { min-width: 0; }
.idg-name { width: 100%; border: 1px solid transparent; border-radius: var(--r-xs); padding: 1px 4px; margin-left: -5px; font: 600 14px/1.4 var(--sans); background: transparent; color: inherit; }
.idg-name:hover { border-color: var(--border-strong); }
.idg-name:focus { border-color: var(--focus); background: var(--surface); outline: none; }
.idg-item-main small { display: block; color: var(--ink-subtle); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.idg-item-val { text-align: right; line-height: 1.15; font-variant-numeric: tabular-nums; }
.idg-item-val b { font: 300 24px/1.1 var(--serif); letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.idg-item-val span { font-size: 12px; color: var(--ink-muted); margin-left: 4px; }
.idg-item-val small { display: block; font-size: 12px; color: var(--ink-subtle); margin-top: 2px; }
.idg-item-ops { display: flex; flex-direction: column; }
.idg-emptylist { color: var(--ink-muted); padding: 20px 0 6px; font-size: 14px; }
.idg-emptylist svg { display: none; }
.idg-emptylist p { margin: 0 0 4px; font: 400 19px/1.35 var(--serif); color: var(--ink); }

/* ratios: result tiles */
.idg-list[data-list="ratios"] { gap: 12px; }
.idg-ratio { border: 1px solid var(--border); border-radius: var(--r-sm); padding: 16px; background: var(--surface); }
.idg-ratio-head { display: flex; align-items: center; justify-content: space-between; font-size: 13px; color: var(--ink-subtle); }
.idg-ratio-head i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin: 0 5px 0 0; }
.idg-ratio-head em { font-style: normal; margin: 0 6px; }
.idg-ratio-head span { color: var(--ink); font-weight: 600; }
.idg-ratio-val { font: 300 30px/1.1 var(--serif); letter-spacing: -.01em; margin: 6px 0 10px; font-variant-numeric: tabular-nums; }
.idg-ratio-val small { font: 400 14px var(--sans); color: var(--ink-muted); margin-left: 8px; letter-spacing: 0; }
.idg-mini { width: 100%; font-size: 13px; border-collapse: collapse; border-top: 1px solid var(--border); }
.idg-mini td { padding: 5px 0; color: var(--ink-subtle); border-bottom: 1px solid var(--border); }
.idg-mini td + td { text-align: right; color: var(--ink); font-variant-numeric: tabular-nums; }
.idg-warnline { margin-top: 10px; font-size: 13px; color: var(--warning); padding-left: 10px; border-left: 2px solid var(--warning); }
.idg-warnline::before { content: "Note: "; font-weight: 600; }

/* points */
.idg-series { display: flex; flex-direction: column; margin-bottom: 14px; border-top: 1px solid var(--rule); }
.idg-serie { display: grid; grid-template-columns: 18px 24px 1fr auto auto auto; align-items: center; gap: 8px; padding: 8px 2px; border-bottom: 1px solid var(--border); }
.idg-serie.idg-sel { background: var(--art-3); }
.idg-serie input[type=radio] { accent-color: var(--interactive); margin: 0; }
.idg-serie small { color: var(--ink-subtle); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.idg-tablewrap { margin-top: 18px; }
.idg-table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.idg-table th { font: 600 13px/1.4 var(--sans); letter-spacing: .01em; color: var(--ink-subtle); text-align: right; padding: 6px 8px; border-bottom: 1px solid var(--rule); background: var(--surface); position: sticky; top: 0; }
.idg-table td { padding: 5px 8px; border-bottom: 1px solid var(--border); text-align: right; }
.idg-table th:first-child, .idg-table td:first-child { text-align: left; color: var(--ink-subtle); width: 36px; }
.idg-table td:last-child, .idg-table th:last-child { width: 36px; padding: 0 2px; }
.idg-table tr.idg-sel td { background: var(--art-3); }
.idg-table tbody tr { cursor: pointer; }
.idg-table tbody tr:hover td { background: var(--canvas); }
.idg-emptycell { color: var(--ink-muted); padding: 14px 0 !important; text-align: left !important; border: 0 !important; width: auto !important; }

/* export: one pill, then a ruled list of formats */
.idg-exports { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.idg-exports li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.idg-exports b { display: block; font-size: 14px; }
.idg-exports small { display: block; color: var(--ink-subtle); font-size: 13px; }

/* value changed: brief powder-blue tint, fading over ~1.5 s */
.idg-changed, .idg-changed td { animation: idg-tint 1.5s var(--ease); }
@keyframes idg-tint { from { background-color: var(--primary); } to { background-color: transparent; } }

/* ---------------------------------------------------------------- status bar */
.idg-status { display: flex; gap: 20px; align-items: center; padding: 7px 16px; font-size: 13px; color: var(--ink-subtle); border-top: 1px solid var(--border); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; flex: none; }
.idg-stcal { color: var(--warning); }
.idg-stcal.idg-ok { color: var(--success); }
.idg-stimg { margin-left: auto; }

/* ---------------------------------------------------------------- dialog */
.idg-modal { position: absolute; inset: 0; background: rgba(41, 46, 51, .4); display: flex; align-items: center; justify-content: center; z-index: 30; padding: 20px; }
.idg-dialog { background: var(--surface); border-radius: var(--r-sm); box-shadow: var(--float); max-width: 680px; width: 100%; max-height: 100%; display: flex; flex-direction: column; animation: idg-enter var(--base) var(--ease-enter); }
.idg-dialog-body { padding: 32px 36px 8px; overflow-y: auto; font-size: 15px; line-height: 1.65; }
.idg-dialog-body h2 { margin: 0 0 14px; font: 300 36px/1.15 var(--serif); letter-spacing: -.005em; }
.idg-dialog-body h3 { margin: 26px 0 8px; font: 600 19px/1.35 var(--sans); padding-top: 12px; border-top: 1px solid var(--rule); }
.idg-dialog-body p { margin: 0 0 12px; }
.idg-dialog-btns { display: flex; justify-content: flex-end; gap: 12px; padding: 16px 36px 26px; flex-wrap: wrap; }
.idg-helpsteps { padding-left: 22px; margin: 0; }
.idg-helpsteps li { margin-bottom: 8px; }
.idg-helpsteps li::marker { font-family: var(--serif); color: var(--secondary); }
.idg-helpsteps ul { padding-left: 18px; margin: 4px 0; }
.idg-keys { border-collapse: collapse; font-size: 14px; width: 100%; }
.idg-keys td { padding: 6px 8px 6px 0; border-bottom: 1px solid var(--border); vertical-align: top; }
.idg-keys td:first-child { font-weight: 600; white-space: nowrap; width: 120px; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1180px) {
  .idg-body { grid-template-columns: 74px 1fr 340px; }
  .idg-top-actions .idg-btn:not(.idg-secondary) span { display: none; }
  .idg-top-actions .idg-btn:not(.idg-secondary) { width: 36px; padding: 0; }
}
@media (max-width: 860px) {
  .idg { height: auto; min-height: 0; overflow: visible; }
  .idg-body { display: flex; flex-direction: column; }
  .idg-tools { flex-direction: row; border-right: 0; border-bottom: 1px solid var(--border); overflow-x: auto; padding: 6px; }
  .idg-tool { min-width: 64px; font-size: 10px; }
  .idg-tools-sep { width: 1px; height: auto; margin: 6px 3px; }
  .idg-stage { height: 62vh; min-height: 340px; }
  .idg-panel { border-left: 0; border-top: 1px solid var(--border); }
  .idg-panes { overflow: visible; }
  .idg-top { padding: 8px 10px; gap: 8px; }
  .idg-sep { display: none; }
  .idg-top-actions { gap: 0; flex-wrap: nowrap; }
  .idg-top-actions .idg-btn.idg-secondary span { display: none; }
  .idg-top-actions .idg-btn.idg-secondary { width: 36px; height: 36px; padding: 0; }
  .idg-topstack { max-width: calc(100% - 16px); top: 8px; }
  .idg-hint { font-size: 12px; }
  .idg-loupe { width: 120px; height: 120px; top: auto; bottom: 78px; }
  .idg-status [data-st="px"], .idg-status .idg-stimg { display: none; }
  .idg-options { left: 8px; right: 8px; bottom: 8px; transform: none; max-width: none; flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; padding: 6px 10px; gap: 12px; }
  .idg-opt input[type=range] { width: 90px; }
  .idg-drop { padding: 28px 22px 24px; }
}
@media (max-width: 520px) {
  .idg-docname small { display: none; }
  .idg-grid2 { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------- reduced motion: crossfade or instant, keep colour feedback */
@media (prefers-reduced-motion: reduce) {
  .idg *, .idg *::before, .idg *::after { transition-duration: 120ms !important; }
  .idg-toast.idg-show, .idg-dialog { animation: idg-fade 120ms linear; }
  .idg-btn:active, .idg-tool:active { transform: none !important; }
  .idg-btn.idg-primary:hover::after { transform: translate(0, -52%) !important; }
}
@keyframes idg-fade { from { opacity: 0; } to { opacity: 1; } }

@media print { .idg { height: auto; border: 0; } }
