/* pgkiln builder: the SQL Workshop's Data Modeler (sprint 98, src/builder/data-modeler.ts, public/data-modeler.js).
   The diagram is an SVG with presentation attributes (light colours: an exported file); here the builder's theme
   overrides them. The canvas scrolls inside the page, so a wide diagram never widens the page. */
.dm-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 8px; }
.dm-name { margin: 0; font-size: 1.25rem; overflow-wrap: anywhere; }
.dm-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 8px; }
.dm-toolbar form { display: contents; }
.dm-toolbar .btn[disabled] { opacity: 0.5; }
.dm-status { min-width: 0; }
.dm-stage { position: relative; }
.dm-canvas { overflow: auto; max-width: 100%; height: 65vh; min-height: 18rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--canvas, var(--bg)); box-shadow: var(--shadow-xs, none); }
.dm-canvas:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dm-svg { display: block; }
/* the boxes and lines: no .dm-svg ancestor in the selectors, so the mini-map's <use> copy (a shadow tree) is themed too */
.dm-svg .dm-bg { fill: var(--canvas, var(--bg)); }
.dm-frame { fill: var(--block, var(--surface)); stroke: var(--border-strong, var(--border)); }
.dm-view .dm-frame { fill: var(--surface-2); }
path.dm-head { fill: var(--accent-soft); stroke: var(--border-strong, var(--border)); }
.dm-title { fill: var(--text); }
.dm-col { fill: var(--text); }
:is(.dm-type, .dm-kind, .dm-more) { fill: var(--muted); }
.dm-key { fill: var(--gold, #b45309); }
:is(.dm-line, .dm-end) { stroke: var(--muted); }
.dm-opt { fill: var(--canvas, var(--bg)); stroke: var(--muted); }
.dm-svg .dm-fk:hover .dm-line, .dm-svg .dm-fk:hover .dm-end { stroke: var(--accent); stroke-width: 2.5; }
.dm-svg .dm-link:hover .dm-title, .dm-svg .dm-link:focus .dm-title { fill: var(--accent); text-decoration: underline; }
.dm-live .dm-box { cursor: grab; touch-action: none; }
.dm-live .dm-box.dm-dragging { cursor: grabbing; }
.dm-svg .dm-box:focus { outline: none; }
.dm-svg .dm-box:focus-visible .dm-frame { stroke: var(--accent); stroke-width: 2.5; }
.dm-svg .dm-dragging .dm-frame { stroke: var(--accent); }
.dm-svg text { user-select: none; }
.dm-minimap { position: absolute; right: 12px; bottom: 12px; width: 200px; height: 140px; border: 1px solid var(--border-strong, var(--border)); border-radius: var(--radius);
  background: var(--canvas, var(--surface)); box-shadow: var(--shadow-md, 0 2px 8px rgb(0 0 0 / 20%)); cursor: pointer; touch-action: none; overflow: hidden; }
.dm-minimap-bg { fill: var(--canvas, var(--surface)); }
.dm-minimap-view { fill: var(--accent); fill-opacity: 0.15; stroke: var(--accent); stroke-width: 4; vector-effect: non-scaling-stroke; }
.dm-legend { margin: 6px 0 12px; }
.dm-search-row { display: flex; gap: 6px; flex-wrap: wrap; }
.dm-search-row input { flex: 1 1 12rem; min-width: 0; }
.dm-settings { margin-bottom: 16px; }
.dm-settings > summary { cursor: pointer; margin-bottom: 8px; }
.dm-settings form { margin-bottom: 8px; }
.dm-dict-actions { margin-bottom: 12px; }
.dm-dict-toc { columns: 3 14rem; }
.dm-dict-table { margin-top: 1.5rem; }
.dm-dict-table h2 { border-bottom: 1px solid var(--border); padding-bottom: 4px; overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .dm-btn-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .dm-canvas { height: 55vh; }
  .dm-minimap { width: 130px; height: 90px; }
}
@media print {
  .sw-tabs, .dm-toolbar, .dm-legend, #dm-objects, #dm-add, .dm-settings, .dm-minimap, .dm-dict-actions, .ide-alerts { display: none !important; }
  .dm-canvas { height: auto; overflow: visible; border: 0; }
  .dm-svg { max-width: 100%; height: auto; }
  .dm-dict-table { break-inside: avoid-page; }
}
/* sprint 108: the Mini-map toggle shows that it is on */
.dm-toolbar .btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
