:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  color: #202640;
  background: #f8f9fc;
  --ink: #202640;
  --muted: #59627b;
  --primary: #303b67;
  --accent: #e8eaf3;
  --line: #dfe3ee;
  --paper: #fff;
  --amber: #dda43b;
  --amber-container: #f5e5c5;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .4; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, #graph:focus-visible {
  outline: 2px solid #303b67; outline-offset: 2px;
}
[hidden] { display: none !important; }
h1, h2, p { margin: 0; }
svg.lucide { display: inline-block; width: 1.15rem; height: 1.15rem; flex: 0 0 1.15rem; stroke-width: 1.75; }
.workspace {
  display: grid;
  grid-template-columns: 14.6rem minmax(24rem, 1fr) 17.5rem;
  grid-template-rows: 4.6rem minmax(0, 1fr);
  height: 100dvh;
  min-height: 610px;
}
.masthead {
  grid-column: 1 / -1;
  display: grid; grid-template-columns: 14.6rem minmax(0, 1fr) max-content;
  align-items: center; gap: 1.15rem; padding-right: 1.35rem;
  background: var(--paper); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .7rem; padding: 0 1.25rem; }
.brand-mark { display: block; width: 2.45rem; height: 2.45rem; flex: 0 0 2.45rem; object-fit: contain; }
.brand-name { color: var(--primary); font-size: 1.22rem; font-weight: 730; letter-spacing: -.045em; white-space: nowrap; }
.masthead-project { min-width: 0; display: grid; gap: .05rem; }
.masthead-project span, .diagram-header label { color: var(--muted); font-size: .8rem; }
.masthead-project strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .93rem; }
.file-actions, .toolbar, .tool-group, .zoom { display: flex; align-items: center; gap: .4rem; }
.file-actions { gap: .65rem; }
.button, .icon-button {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 2.45rem; border-radius: .62rem; border: 1px solid transparent;
  background: transparent; color: var(--ink); white-space: nowrap;
}
.button { padding: .32rem .75rem; font-weight: 650; font-size: .9rem; }
.icon-button { width: 2.35rem; min-height: 2.25rem; }
.button:hover:not(:disabled), .icon-button:hover:not(:disabled) { background: #e8eaf3; }
.button.primary { color: white; background: var(--primary); }
.button.primary:hover { background: #263661; }
.file-actions #open { border-color: var(--line); }
.left-pane, .right-pane { display: flex; flex-direction: column; min-height: 0; background: var(--paper); }
.left-pane { border-right: 1px solid var(--line); overflow-y: auto; }
.right-pane { border-left: 1px solid var(--line); }
.left-top { padding: 1.4rem 1.05rem 1rem; }
.left-top h1 { font-size: 1.95rem; letter-spacing: -.06em; margin: 0 0 .85rem .15rem; }
.new-button { width: 100%; background: var(--accent); color: var(--primary); }
.side-section { border-top: 1px solid var(--line); padding: .95rem .85rem; }
.side-section h2 { margin: 0 0 .55rem .35rem; color: var(--muted); font-size: .83rem; letter-spacing: .012em; }
#diagram-list, #group-list { display: grid; gap: .15rem; max-height: 11rem; overflow: auto; }
#diagram-list button, #group-list button, .shape-list button {
  display: flex; align-items: center; gap: .66rem; width: 100%; text-align: left;
  border: 0; color: var(--ink); background: transparent; border-radius: .58rem;
  padding: .47rem .5rem; min-height: 2.2rem; font-size: .86rem;
}
#diagram-list button span, #group-list button span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#diagram-list button[aria-current="true"], #group-list button[aria-current="true"] { font-weight: 690; background: #e8eaf3; color: #303b67; }
#diagram-list button:hover, #group-list button:hover, .shape-list button:hover { background: #f8f9fc; }
.shape-list { display: grid; gap: .12rem; }
.shape-list svg { color: #59627b; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: .35rem; margin-bottom: .3rem; }
.section-heading h2 { margin: 0 0 0 .35rem; }
.section-heading .icon-button { width: 1.9rem; min-height: 1.9rem; }
#group-list .group-swatch { width: .65rem; height: .65rem; flex: 0 0 .65rem; border-radius: .2rem; }
.demo-button { margin: auto .85rem .95rem; align-self: flex-start; color: var(--muted); }
.main-pane { display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; min-width: 0; }
.diagram-header { padding: .85rem 1.15rem .8rem; background: #f8f9fc; }
.diagram-header label { display: block; }
.diagram-header input {
  margin-left: -.36rem; padding: .08rem .34rem; border: 1px solid transparent; background: transparent;
  border-radius: .4rem; width: min(100%, 38rem); font-size: clamp(1.25rem, 2vw, 1.75rem);
  font-weight: 730; letter-spacing: -.045em;
}
.diagram-header input:hover, .diagram-header input:focus { border-color: var(--line); background: white; }
.toolbar { min-height: 3.12rem; padding: .27rem .7rem; background: #fff; border-block: 1px solid var(--line); gap: .55rem; }
.toolbar .tool-group { border-right: 1px solid var(--line); padding-right: .5rem; gap: .12rem; }
.toolbar #connect[aria-pressed="true"] { background: #e8eaf3; color: #303b67; }
.toolbar #grid[aria-pressed="true"] { background: var(--amber-container); color: var(--ink); }
.arrange-menu { position: relative; }
.arrange-menu summary { cursor: pointer; list-style: none; }
.arrange-menu summary::-webkit-details-marker { display: none; }
.arrange-menu[open] summary { background: var(--accent); color: var(--primary); }
.arrange-options {
  position: absolute; z-index: 10; min-width: 14.5rem; top: calc(100% + .35rem); left: 0;
  display: grid; padding: .35rem; background: var(--paper); border: 1px solid var(--line);
  box-shadow: 0 8px 24px #303b6724; border-radius: .65rem;
}
.arrange-options button {
  min-height: 2rem; text-align: left; border: 0; background: transparent; border-radius: .32rem;
  font-size: .86rem; padding: .37rem .58rem;
}
.arrange-options button:not(:disabled):hover { background: var(--accent); }
.export-button { margin-left: auto; color: var(--primary); }
.canvas-shell { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: #f8f9fc; }
#graph {
  position: absolute; inset: 0; overflow: auto; outline-offset: -2px;
  background-image: radial-gradient(circle, #c6ccdf 1px, transparent 1.1px);
  background-position: var(--grid-x, 10px) var(--grid-y, 10px);
  background-size: var(--grid-step, 20px) var(--grid-step, 20px);
  overscroll-behavior: contain;
}
#graph.connect-mode, #graph.bend-mode { cursor: crosshair; }
#graph.grid-off { background-image: none; }
#graph svg { display: block; }
.canvas-empty {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: .7rem;
  pointer-events: none; color: var(--muted);
}
.canvas-empty span { display: grid; place-items: center; padding: .64rem; border-radius: .8rem; background: white; box-shadow: 0 1px 6px #3b4a7020; }
.canvas-empty strong { color: var(--ink); }
.canvas-empty button { pointer-events: auto; background: white; border-color: var(--line); }
.zoom {
  position: absolute; right: .9rem; bottom: .9rem; padding: .2rem .3rem; color: var(--muted);
  border: 1px solid var(--line); border-radius: .8rem; background: white; box-shadow: 0 3px 12px #3b4a7010;
}
.zoom output { min-width: 3.25rem; text-align: center; font-size: .86rem; font-variant-numeric: tabular-nums; }
.mini-divider { border-left: 1px solid var(--line); height: 1.3rem; }
.status {
  min-height: 2.45rem; padding: .42rem .9rem; display: flex; gap: .5rem; align-items: center;
  justify-content: space-between; background: white; border-top: 1px solid var(--line);
  color: var(--muted); font-size: .8rem;
}
.status #counts { text-align: right; white-space: nowrap; }
.status #status[data-error="true"] { color: #a31526; }
.inspector-heading {
  padding: 1.15rem 1rem .9rem; display: flex; align-items: center; gap: .52rem;
  border-bottom: 1px solid var(--line); color: var(--ink);
}
.inspector-heading h2 { font-size: .98rem; }
.inspector-body { flex: 1; min-height: 0; padding: 1rem .9rem; overflow: auto; }
.inspector-body .hint { font-size: .9rem; color: var(--muted); line-height: 1.6; }
.inspector-body h3 { margin: 0 0 .72rem; font-size: 1rem; }
.inspector-body .field { display: grid; margin-bottom: .68rem; gap: .28rem; }
.inspector-body label, .swatch-label { font-size: .84rem; font-weight: 650; }
.inspector-body input, .inspector-body select, .inspector-body textarea {
  width: 100%; background: white; border: 1px solid var(--line); border-radius: .55rem;
  padding: .45rem .55rem; font-size: .88rem;
}
.inspector-body textarea { resize: vertical; min-height: 3.2rem; }
.swatches { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: .25rem; margin: .4rem 0 1rem; }
.swatches button { aspect-ratio: 1; border: 1px solid; border-radius: .32rem; }
.swatches button[aria-pressed="true"] { outline: 2px solid #4c5c96; outline-offset: 1px; }
.evidence { border-top: 1px solid var(--line); padding-top: .8rem; }
.evidence .evidence-details { margin-top: .35rem; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.evidence button { margin-top: .36rem; border-color: var(--line); width: 100%; justify-content: flex-start; }
.bend-panel { border-top: 1px solid var(--line); padding-top: .85rem; }
.bend-panel .button { width: 100%; border-color: var(--line); font-size: .83rem; }
.bend-list { display: grid; gap: .4rem; padding-left: 1.35rem; margin: .75rem 0; }
.bend-row { padding-left: .12rem; }
.bend-row input { width: calc((100% - 2.7rem) / 2); margin-right: .25rem; padding: .35rem; }
.bend-row .icon-button { width: 1.8rem; min-height: 1.8rem; }
dialog {
  width: min(58rem, 92vw); max-height: 88vh; border: 1px solid var(--line);
  border-radius: .9rem; padding: 0; color: var(--ink); box-shadow: 0 15px 65px #27365550;
}
dialog::backdrop { background: #20264080; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .6rem 1rem; border-bottom: 1px solid var(--line); }
#attachment-content { display: grid; place-items: center; gap: .75rem; padding: 1rem; }
#attachment-content img { display: block; max-width: 100%; max-height: 67vh; object-fit: contain; }
@media (max-width: 1150px) {
  .workspace { grid-template-columns: 11.6rem minmax(24rem, 1fr) 15.5rem; }
  .masthead { grid-template-columns: 11.6rem minmax(0, 1fr) max-content; }
}
@media (max-width: 900px) {
  .workspace { grid-template-columns: 10rem minmax(19rem, 1fr) 12.7rem; }
  .toolbar { flex-wrap: wrap; }
  .masthead { grid-template-columns: 9rem minmax(0, 1fr) max-content; }
  .brand { gap: .4rem; padding-left: .65rem; }
  .brand-name { font-size: 1rem; }
}
@media (max-width: 650px) {
  .workspace {
    height: auto; min-height: 100dvh;
    grid-template-columns: minmax(0, 1fr); grid-template-rows: auto;
  }
  .masthead { grid-template-columns: auto 1fr; padding: .65rem; gap: .45rem; }
  .brand { padding: 0; }
  .masthead-project { display: none; }
  .file-actions { justify-content: flex-end; }
  .left-pane { border-right: 0; }
  .left-top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .55rem 1rem; }
  .left-top h1 { margin: 0; font-size: 1.5rem; }
  .new-button { width: auto; }
  .side-section { padding: .5rem .85rem; }
  .side-section h2 { margin-bottom: .25rem; }
  #diagram-list { max-height: 5.4rem; }
  .shape-list { display: flex; overflow: auto; }
  .shape-list button { flex: 0 0 auto; width: auto; white-space: nowrap; }
  .demo-button { display: none; }
  .main-pane { min-height: 30rem; }
  .toolbar { gap: .3rem; padding-inline: .35rem; }
  .arrange-options { left: auto; right: 0; }
  .toolbar .tool-group { padding-right: .22rem; }
  .right-pane { border-left: 0; border-top: 1px solid var(--line); }
}

.main-pane { grid-template-rows: auto auto auto minmax(0, 1fr) auto; }
.page-bar {
  display: flex; justify-content: space-between; align-items: center; gap: .45rem;
  background: #f8f9fc; padding: 0 .75rem .35rem; min-width: 0;
}
#page-list { display: flex; gap: .25rem; overflow: auto; min-width: 0; padding: .2rem; }
#page-list button {
  max-width: 14rem; flex: 0 0 auto; text-overflow: ellipsis; overflow: hidden; white-space: nowrap;
  border: 1px solid transparent; background: transparent; border-radius: .48rem;
  padding: .34rem .65rem; font-size: .84rem; color: var(--muted);
}
#page-list button[aria-current="page"] {
  color: var(--primary); background: var(--paper); border-color: var(--line); font-weight: 700;
}
#page-list button:hover { background: var(--accent); }
.page-actions, .settings-actions { display: flex; align-items: center; gap: .2rem; }
.toolbar { flex-wrap: wrap; }
.toolbar .export-group { margin-left: auto; border-right: 0; padding-right: 0; color: var(--primary); }
.toolbar #print { background: var(--accent); color: var(--primary); }
#layer-list { display: grid; gap: .2rem; max-height: 10.5rem; overflow: auto; }
.layer-row { display: grid; grid-template-columns: minmax(0, 1fr) repeat(3, 1.5rem); align-items: center; }
.layer-row .layer-select {
  border: 0; text-align: left; background: transparent; padding: .36rem .42rem;
  border-radius: .43rem; font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.layer-row .layer-select[aria-pressed="true"] { background: var(--accent); color: var(--primary); font-weight: 700; }
.layer-row .icon-button { width: 1.47rem; min-height: 1.65rem; color: var(--muted); }
.layer-row .icon-button svg { width: .93rem; height: .93rem; flex-basis: .93rem; }
.side-hint { padding: .35rem; color: var(--muted); font-size: .77rem; }
.inspector-action { width: 100%; border-color: var(--line); margin-bottom: .8rem; }

.settings-dialog { width: min(26rem, 92vw); }
.settings-body { display: grid; gap: .45rem; padding: 1rem; }
.settings-body label, .print-controls label { font-weight: 650; font-size: .85rem; }
.settings-body input, .print-controls select {
  width: 100%; background: white; border: 1px solid var(--line); border-radius: .55rem; padding: .45rem .55rem;
}
.settings-actions { margin-top: .5rem; }
.settings-actions .primary { margin-left: auto; }

.print-layout { display: grid; grid-template-columns: minmax(10.5rem, 14rem) minmax(0, 1fr); min-height: 30rem; }
.print-controls { display: flex; flex-direction: column; gap: .85rem; padding: 1.1rem; }
.print-controls label { display: grid; gap: .28rem; }
#print-notice { color: var(--muted); font-size: .85rem; min-height: 2rem; }
.print-stage {
  display: flex; flex-direction: column; justify-content: center; gap: .55rem;
  padding: 1rem; background: #eef0f6; min-width: 0; overflow: hidden;
}
#print-preview { display: grid; justify-items: center; }
.print-sheet { position: relative; width: 100%; background: white; box-shadow: 0 3px 15px #303b6726; overflow: hidden; }
.print-sheet-title {
  position: absolute; left: 5%; right: 5%; top: 4%; color: var(--ink); font-size: clamp(.65rem, 1.2vw, .92rem);
  font-weight: 700; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.print-sheet-content { position: absolute; overflow: hidden; }
.print-sheet-content svg { position: absolute; display: block; max-width: none; }
.print-sheet-number { position: absolute; right: 5%; bottom: 3%; color: var(--muted); font-size: .72rem; }
.print-pager { display: flex; justify-content: center; align-items: center; gap: .65rem; color: var(--muted); font-size: .85rem; }
.print-pager .icon-button { background: white; }
.vector-stage, .pdf-render-svg {
  position: fixed; left: -10000px; top: -10000px; pointer-events: none; width: 700px; height: 500px; overflow: hidden;
}
@media (max-width: 650px) {
  #layer-list { max-height: 5rem; }
  .layer-row { grid-template-columns: minmax(0, 1fr) repeat(3, 1.8rem); }
  .print-layout { grid-template-columns: 1fr; }
  .print-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .print-stage { grid-row: 2; }
}

.brand-wordmark { display: grid; gap: .02rem; align-items: start; }
#app-version { font-size: .69rem; color: var(--muted); line-height: 1; font-variant-numeric: tabular-nums; }

.quick-menu .arrange-options { min-width: 15rem; }
.quick-menu summary:focus-visible, .minimap svg:focus-visible {
  outline: 2px solid var(--primary); outline-offset: 2px;
}
.settings-body select {
  width: 100%; background: white; border: 1px solid var(--line); border-radius: .55rem; padding: .45rem .55rem;
}
.minimap {
  position: absolute; right: .9rem; bottom: 4.3rem; width: min(12.5rem, calc(100% - 1.8rem));
  border: 1px solid var(--line); border-radius: .8rem; background: white;
  box-shadow: 0 3px 12px #3b4a7020; padding: .5rem .5rem .4rem;
}
.minimap p { padding: .1rem .25rem .36rem; color: var(--muted); font-weight: 650; font-size: .78rem; }
.minimap svg {
  display: block; width: 100%; background: #f6f7fb; border-radius: .35rem; touch-action: none;
  cursor: crosshair; user-select: none;
}
.minimap text { font-size: 10px; fill: var(--muted); }
#minimap-toggle[aria-expanded="true"] { background: var(--accent); color: var(--primary); }

.port-fields { padding-block: .55rem; border-top: 1px solid var(--line); }
.port-fields .field { margin-bottom: .45rem; }
.port-fields .button { width: 100%; border-color: var(--line); font-size: .8rem; }

#sketch-library { width: min(35rem, 92vw); }
.library-body { display: grid; gap: .65rem; padding: .85rem 1rem; }
.library-toolbar, .library-save { display: flex; flex-wrap: wrap; gap: .25rem; }
.library-toolbar button[aria-pressed="true"] { background: var(--accent); color: var(--primary); }
.library-toolbar #import-library { margin-left: auto; }
.library-save { border-top: 1px solid var(--line); padding-top: .55rem; }
.library-save .button { border-color: var(--line); }
#library-items { display: grid; max-height: min(21rem, 43vh); overflow: auto; }
.library-item {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto;
  gap: .4rem; padding: .3rem .25rem; align-items: center; border-top: 1px solid var(--line);
}
.library-item-label { min-width: 0; overflow-wrap: anywhere; font-size: .89rem; font-weight: 650; }
.library-item-label small { display: block; color: var(--muted); font-size: .76rem; font-weight: 400; }
#library-name-form { padding: .55rem 0; }
#library-notice { color: var(--muted); font-size: .84rem; }
#library-notice[data-error="true"] { color: #a31526; }
@media (max-width: 650px) {
  .quick-menu .arrange-options { left: auto; right: 0; }
}

.palette-hint { margin: -.13rem .35rem .46rem; color: var(--muted); font-size: .75rem; }
.shape-list button { cursor: grab; user-select: none; touch-action: pan-y; }
@media (max-width: 650px) { .shape-list button { touch-action: pan-x; } }
.shape-list button:disabled { cursor: default; }
.placing-shape, .placing-shape * { cursor: grabbing !important; user-select: none; }
.palette-ghost {
  position: absolute; inset: 0 auto auto 0; display: grid; place-items: center;
  pointer-events: none; opacity: .82; z-index: 1;
}
.palette-ghost svg { width: 100%; height: 100%; }
.palette-ghost * { pointer-events: none !important; }
.palette-ghost span { position: absolute; color: var(--primary); text-align: center; line-height: 1.15; }
.canvas-shell .zoom, .canvas-shell .minimap { z-index: 2; }

.inspector-heading { color: var(--muted); }
.inspector-heading h2 { font-weight: 600; color: var(--ink); }
.inspector-body { padding: 0 .85rem 1rem; scrollbar-width: thin; scrollbar-color: #c5cada transparent; }
.inspector-body > .hint, .inspector-body > h3 { margin-top: .85rem; }
.inspector-body h3 { font-weight: 600; }
.inspector-body label, .swatch-label { font-weight: 500; color: var(--muted); }
.inspector-body :is(input, select, textarea) { color: var(--ink); font-weight: 400; }
.inspector-body :is(input, select, textarea):hover { border-color: #b6bfd5; }
.property-header {
  position: sticky; top: 0; z-index: 1; display: grid; gap: .55rem;
  margin-inline: -.85rem; padding: .78rem .85rem .7rem;
  background: var(--paper); border-bottom: 1px solid var(--line);
}
.property-type { display: flex; gap: .55rem; align-items: center; }
.property-type h3 { margin: 0; font-size: .96rem; font-weight: 600; }
.property-icon { display: grid; place-items: center; width: 1.85rem; height: 1.85rem; border-radius: .5rem;
  color: var(--primary); background: var(--accent); }
.property-header .field { margin: 0; }
.property-header .field input { padding: .5rem .6rem; }
.property-section { border-bottom: 1px solid var(--line); }
.property-section summary {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem; min-height: 2.5rem;
  color: var(--primary); font-size: .88rem; font-weight: 550; cursor: pointer; list-style: none;
}
.property-section summary::after {
  content: ''; width: .42rem; height: .42rem; margin-right: .25rem;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
}
.property-section[open] summary::after { transform: rotate(225deg); }
.property-section summary::-webkit-details-marker { display: none; }
.property-section summary:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.property-fields { padding: .2rem 0 .72rem; }
.property-fields .field:last-child { margin-bottom: 0; }
.property-fields .hint { font-size: .82rem; }
.property-fields .swatches { margin-bottom: .82rem; }
.property-fields .evidence { border-top: 0; padding-top: 0; }
.property-fields .inspector-action { margin-bottom: .5rem; }
.property-image {
  display: block; width: 100%; height: 7rem; object-fit: contain;
  background: #f6f7fb; border: 1px solid var(--line); border-radius: .5rem; margin-bottom: .55rem;
}
.property-check { display: flex; align-items: center; gap: .4rem; }
.property-check input { width: auto; accent-color: var(--primary); }
.property-header .evidence-shortcut { margin: 0; min-height: 2rem; color: var(--primary); }

.workspace {
  --workspace-right-px: 262.5;
  --workspace-canvas-px: 360;
  grid-template-columns: var(--sidebar-width, 14.6rem) minmax(0, 1fr) calc(var(--workspace-right-px) * 1px);
}
.left-pane { grid-column: 1; grid-row: 2; min-width: 0; overflow-x: hidden; }
.sidebar-heading { display: flex; align-items: center; justify-content: space-between; gap: .3rem; margin-bottom: .75rem; }
.sidebar-heading h1 { margin: 0 0 0 .15rem; }
#sidebar-toggle { flex: 0 0 2.25rem; color: var(--muted); }
#sidebar-divider {
  grid-column: 1; grid-row: 2; justify-self: end; z-index: 3;
  width: 8px; transform: translateX(50%); cursor: ew-resize; touch-action: none;
}
#sidebar-divider:hover, #sidebar-divider:focus-visible, .sidebar-resizing #sidebar-divider {
  background: linear-gradient(90deg, transparent 3px, #707eaf 3px 5px, transparent 5px);
  outline: none;
}
.sidebar-resizing, .sidebar-resizing * { cursor: ew-resize !important; user-select: none; }

#diagram-list, #group-list, #layer-list { grid-template-columns: minmax(0, 1fr); overflow-x: hidden; }
#diagram-list button, #group-list button { min-width: 0; min-height: 2.1rem; }
#diagram-list button span, #group-list button span:last-child {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  min-width: 0; overflow-wrap: anywhere; white-space: normal; line-height: 1.27;
}
.section-heading h2 { min-width: 0; }
.section-heading .icon-button { flex: 0 0 1.9rem; }
.shape-list button span { min-width: 0; overflow-wrap: anywhere; line-height: 1.26; }
.diagram-header { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.diagram-name { flex: 1; min-width: 0; }
.diagram-name input:not(:focus) { text-overflow: ellipsis; }
.diagram-header .icon-button, .file-actions .icon-button { flex-shrink: 0; }
.danger-icon { color: #98505a; }
.danger-icon:hover:not(:disabled) { background: #faebed; color: #8e2739; }

.workspace.sidebar-compact {
  grid-template-columns: 3.55rem minmax(0, 1fr) calc(var(--workspace-right-px) * 1px);
}
.sidebar-compact #sidebar-divider,
.sidebar-compact .sidebar-heading h1,
.sidebar-compact .sidebar-list,
.sidebar-compact .palette h2, .sidebar-compact .palette-hint,
.sidebar-compact .shape-list button span,
.sidebar-compact .new-button span, .sidebar-compact .demo-button span { display: none; }
.sidebar-compact .left-top { padding: .5rem .4rem; }
.sidebar-compact .sidebar-heading { margin-bottom: .3rem; justify-content: center; }
.sidebar-compact .new-button { min-height: 2.2rem; padding: .25rem; }
.sidebar-compact .palette { padding: .45rem .4rem; }
.sidebar-compact .shape-list button { justify-content: center; padding: .4rem; }
.sidebar-compact .demo-button { margin: auto auto .6rem; padding: .35rem; }
.deletion-body { gap: .65rem; }
#remove-name { font-weight: 600; overflow-wrap: anywhere; }
#remove-explanation, #remove-notice { color: var(--muted); font-size: .86rem; line-height: 1.5; }
.deletion-actions { display: flex; flex-wrap: wrap; column-gap: .4rem; row-gap: .2rem; margin-top: .25rem; }
.danger-button { color: #8e2739; background: #faebed; }
.danger-button:hover:not(:disabled) { color: #781d2d; background: #f5dce1; }

@media (max-width: 1150px) {
  .workspace { --workspace-right-px: 232.5; grid-template-columns: var(--sidebar-width, 11.6rem) minmax(0, 1fr) calc(var(--workspace-right-px) * 1px); }
}
@media (max-width: 900px) {
  .workspace { --workspace-right-px: 190.5; --workspace-canvas-px: 285; grid-template-columns: var(--sidebar-width, 11.2rem) minmax(0, 1fr) calc(var(--workspace-right-px) * 1px); }
}
@media (max-width: 650px) {
  .workspace, .workspace.sidebar-compact { grid-template-columns: minmax(0, 1fr); }
  #sidebar-divider { display: none; }
  .sidebar-heading { margin-bottom: 0; }
  .sidebar-heading h1 { margin: 0; }
  .sidebar-compact .left-top { justify-content: flex-start; padding: .35rem .65rem; gap: .45rem; }
  .sidebar-compact .sidebar-heading { margin: 0; }
  .sidebar-compact .new-button { width: 2.35rem; }
  .sidebar-compact .palette, .sidebar-compact .demo-button { display: none; }
}
@media (max-width: 430px) {
  .file-actions :is(#open, #save) { width: 2.35rem; padding: .3rem; }
  .file-actions :is(#open, #save) span { display: none; }
  .file-actions { gap: .2rem; }
}

.workspace.home-mode { grid-template-columns: minmax(0, 1fr); }
.workspace:not(.home-mode) .home-screen,
.workspace.home-mode :is(.left-pane, .main-pane, .right-pane, #sidebar-divider, .file-actions) { display: none; }
.home-screen {
  grid-column: 1 / -1; min-width: 0; background: #f5f6fa; overflow: auto;
  border-top: 1px solid #fff;
}
.home-shell { width: min(100%, 66rem); margin: 0 auto; padding: clamp(1rem, 5vw, 3.9rem) clamp(1rem, 4.5vw, 3rem); }
.home-start { margin-bottom: 1.6rem; }
.home-start h1 {
  color: var(--primary); font-size: clamp(1.85rem, 4vw, 2.65rem); font-weight: 730; letter-spacing: -.05em;
  margin: 0 0 .9rem; outline-offset: .25rem;
}
.home-actions, .home-module { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.home-actions .button, .home-module .button { padding-inline: .9rem; }
.home-secondary { background: white; border-color: var(--line); }
.home-hint, .home-status { color: var(--muted); font-size: .85rem; line-height: 1.5; margin-top: .55rem; }
.home-status[data-error="true"] { color: #8e2739; }
.home-project, .home-drafts {
  margin-top: 1rem; background: var(--paper); border: 1px solid var(--line);
  border-radius: .9rem; padding: clamp(.95rem, 2.8vw, 1.45rem);
}
.home-project-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .6rem; }
.home-project-head > div { min-width: 0; }
.home-project-head p { color: var(--muted); font-size: .83rem; margin-bottom: .25rem; }
.home-project h2, .home-drafts h2 { color: var(--primary); font-weight: 650; margin: 0; }
.home-project h2 { font-size: clamp(1.25rem, 3vw, 1.65rem); overflow-wrap: anywhere; }
.home-metadata, .home-counts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 8rem), 1fr)); margin: .85rem 0;
  gap: .55rem;
}
.home-metadata:empty { display: none; }
.home-metadata > div { min-width: 0; padding: .3rem .05rem; }
.home-metadata dd, .home-counts dd { margin: 0; overflow-wrap: anywhere; }
.home-metadata dt, .home-counts dt { color: var(--muted); font-size: .8rem; }
.home-counts > div { min-width: 0; padding: .65rem .75rem; background: #f5f6fb; border-radius: .53rem; }
.home-counts dd { font-size: 1.32rem; font-weight: 650; color: var(--primary); }
.home-missing { padding: .6rem .7rem; background: #fbf3df; color: #674b16; border-radius: .45rem; font-size: .85rem; }
.home-module { margin-top: .85rem; }
.home-drafts h2 { font-size: 1.05rem; }
#draft-list { list-style: none; margin: .5rem 0 0; padding: 0; }
.draft-item {
  border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; justify-content: space-between;
  align-items: center; gap: .4rem; padding: .55rem 0;
}
.draft-item > div:first-child { flex: 1 1 10rem; min-width: 0; overflow-wrap: anywhere; }
.draft-item strong { font-weight: 600; }
.draft-item time { display: block; color: var(--muted); font-size: .78rem; }
.draft-item .button { min-height: 2rem; }
.status-details { display: flex; flex-wrap: wrap; justify-content: flex-end; column-gap: .85rem; }
#draft-status[data-error="true"] { color: #a31526; }
@media (max-width: 650px) { .workspace.home-mode { min-height: 100dvh; grid-template-rows: auto 1fr; } }
@media (max-width: 430px) { #go-home { width: 2.35rem; padding: .3rem; } #go-home span { display: none; } }

.workspace.field-mode { grid-template-columns: minmax(0, 1fr); }
.workspace:not(.field-mode) .field-screen,
.workspace.field-mode :is(.left-pane, .main-pane, .right-pane, #sidebar-divider, #go-field) { display: none; }

.field-screen {
  grid-column: 1 / -1; min-width: 0; min-height: 0; overflow: auto; background: #f5f6fa;
}
.field-shell {
  width: min(100%, 78rem); margin: 0 auto; padding: clamp(.9rem, 3.5vw, 2.1rem) clamp(.8rem, 3.5vw, 2rem) .9rem;
}
.field-heading {
  display: flex; justify-content: space-between; align-items: center; gap: .5rem 1rem; flex-wrap: wrap;
  padding-bottom: .85rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem;
}
.field-heading h1 { color: var(--primary); font-size: clamp(1.5rem, 3vw, 2.25rem); letter-spacing: -.045em; }
.field-navigation { display: flex; align-items: center; gap: .3rem; }
.field-navigation .button { background: white; border-color: var(--line); }
.field-navigation .button[aria-pressed="true"] { color: white; background: var(--primary); border-color: var(--primary); }
.field-badge { border-radius: .35rem; padding: .1rem .33rem; background: #7584ae29; font-variant-numeric: tabular-nums; }

.field-evidence-view { display: grid; grid-template-columns: minmax(14rem, 19rem) minmax(0, 1fr); gap: .85rem; align-items: start; }
.field-list-pane, .field-detail, .field-report {
  min-width: 0; border: 1px solid var(--line); border-radius: .85rem; background: var(--paper);
}
.field-list-pane { padding: .75rem; }
.field-filters { display: grid; gap: .4rem; }
.field-filters label { font-size: .82rem; color: var(--muted); }
.field-filters :is(input, select) {
  width: 100%; min-width: 0; border: 1px solid #d3d9e9; border-radius: .52rem;
  background: white; padding: .46rem .52rem; color: var(--ink); font: inherit; font-size: .85rem;
}
.field-selects { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .45rem; }
.field-selects label { display: grid; min-width: 0; gap: .23rem; }
.field-result-count { color: var(--muted); font-size: .78rem; margin: .6rem 0 .3rem; }
#field-evidence-list { display: flex; flex-direction: column; gap: .15rem; max-height: min(57vh, 30rem); overflow: auto; }
.field-evidence-button {
  display: grid; gap: .16rem; padding: .56rem .58rem; text-align: left; color: var(--ink);
  border: 1px solid transparent; border-radius: .46rem; background: transparent; font: inherit;
  overflow-wrap: anywhere;
}
.field-evidence-button strong { font-size: .88rem; font-weight: 600; }
.field-evidence-button span { font-size: .77rem; color: var(--muted); }
.field-evidence-button:hover, .field-visit-button:hover { background: #f5f6fa; }
.field-evidence-button[aria-current="true"], .field-visit-button[aria-current="true"] { background: var(--accent); color: var(--primary); }
.field-visit-button { margin-top: .35rem; width: 100%; justify-content: flex-start; text-align: left; white-space: normal; }
.field-detail, .field-report { padding: clamp(.8rem, 2.5vw, 1.35rem); }
.field-detail-header {
  display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: .55rem 1rem;
}
.field-detail h2, .field-report h2 {
  font-size: clamp(1.14rem, 2.5vw, 1.55rem); color: var(--primary); font-weight: 650; overflow-wrap: anywhere;
}
.field-code { color: var(--muted); font-size: .8rem; margin-bottom: .22rem; }
.field-toggle { display: flex; align-items: center; gap: .37rem; font-size: .82rem; color: var(--muted); }
.field-toggle input { accent-color: var(--primary); margin: 0; width: 1rem; height: 1rem; flex-shrink: 0; }
.field-detail-header .field-toggle {
  min-height: 2rem; padding: .25rem .5rem; border: 1px solid var(--line); border-radius: .47rem;
}
.field-meta { display: flex; flex-wrap: wrap; gap: .45rem 2rem; margin: .7rem 0 0; }
.field-meta dt { color: var(--muted); font-size: .78rem; }
.field-meta dd { margin: .12rem 0 0; color: var(--ink); font-size: .87rem; overflow-wrap: anywhere; }
.field-detail-section { margin-top: .85rem; border-top: 1px solid var(--line); padding-top: .75rem; }
.field-detail-section h3, .field-report h3 { color: var(--primary); font-size: .94rem; font-weight: 650; margin: 0; }
.field-notes { margin-top: .35rem; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; font-size: .91rem; }
.field-muted, #field-report-help { color: var(--muted); line-height: 1.45; font-size: .86rem; overflow-wrap: anywhere; }
.field-attachment-list, .field-sketch-links { list-style: none; margin: .27rem 0 0; padding: 0; }
.field-attachment-row {
  display: grid; grid-template-columns: minmax(0, 1fr) max-content; align-items: center; gap: .35rem;
  min-height: 2.5rem; border-bottom: 1px solid #edf0f6;
}
.field-preview-button, .field-sketch-links button {
  max-width: 100%; min-height: 2.2rem; justify-content: flex-start; text-align: left;
  padding: .25rem .38rem; white-space: normal; overflow-wrap: anywhere;
}
.field-attachment-row .field-toggle { padding: .25rem .35rem; }
.field-sketch-links button small { display: block; font-weight: 400; color: var(--muted); }

#field-report-help { margin: .4rem 0 .8rem; }
#field-report-list, .field-report-attachments { margin: 0; padding-inline-start: 1.45rem; }
#field-report-list:empty { display: none; }
.field-report-entry { border-top: 1px solid var(--line); padding: .45rem .15rem .48rem; }
.field-report-entry::marker, .field-report-attachments li::marker { color: var(--muted); font-size: .82rem; }
.field-report-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .35rem;
  min-height: 2.25rem; overflow-wrap: anywhere;
}
.field-report-row h3 { overflow-wrap: anywhere; }
.field-order-controls { display: flex; gap: .12rem; }
.field-order-controls .icon-button { width: 1.9rem; min-height: 1.85rem; }
.field-report-attachments { margin-top: .2rem; }
.field-feedback {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: .4rem; margin-top: .55rem;
  color: var(--muted); font-size: .78rem;
}
.field-feedback [data-error="true"] { color: #a31526; }
.attachment-pdf { width: 100%; height: min(63vh, 44rem); border: 1px solid var(--line); border-radius: .45rem; }
@media (max-width: 650px) {
  .workspace.field-mode { min-height: 100dvh; grid-template-rows: auto 1fr; }
  .field-evidence-view { grid-template-columns: minmax(0, 1fr); }
  #field-evidence-list { max-height: 13rem; }
  .field-shell { padding-inline: .7rem; }
}
@media (max-width: 430px) {
  #go-field { width: 2.35rem; padding: .3rem; }
  #go-field span { display: none; }
}

.field-report-heading, .report-header, .report-panel-heading {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .55rem .85rem;
}
.workspace.report-mode { grid-template-columns: minmax(0, 1fr); }
.workspace:not(.report-mode) .report-screen,
.workspace.report-mode :is(.left-pane, .main-pane, .right-pane, #sidebar-divider, #go-report) { display: none; }
.report-screen {
  grid-column: 1 / -1; min-width: 0; min-height: 0; overflow: auto; background: #f5f6fa;
}
.report-shell {
  width: min(100%, 83rem); margin: 0 auto; padding: clamp(.9rem, 3vw, 2rem) clamp(.8rem, 3vw, 2rem) 1rem;
}
.report-header { padding-bottom: .8rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; }
.report-header h1 { color: var(--primary); font-size: clamp(1.5rem, 3vw, 2.25rem); letter-spacing: -.045em; }
.report-workspace {
  display: grid; grid-template-columns: minmax(16rem, 24rem) minmax(0, 1fr); gap: 1rem; align-items: start;
}
.report-form { display: grid; gap: .8rem; min-width: 0; }
.report-panel, .report-preview {
  min-width: 0; border: 1px solid var(--line); border-radius: .85rem; background: var(--paper); padding: .95rem;
}
.report-panel > summary, .report-panel-heading h2 {
  color: var(--primary); font-size: 1.03rem; font-weight: 650; overflow-wrap: anywhere;
}
.report-panel summary { cursor: pointer; }
.report-cover-fields, .report-section-fields { display: grid; gap: .55rem; margin-top: .65rem; }
.report-edit-field {
  min-width: 0; display: grid; gap: .25rem; color: var(--muted); font-size: .84rem; font-weight: 500;
}
.report-edit-field :is(input, textarea) {
  width: 100%; min-width: 0; border: 1px solid #d3d9e9; border-radius: .5rem; padding: .5rem .55rem;
  color: var(--ink); font: inherit; font-size: .93rem; font-weight: 400; background: white;
}
.report-edit-field textarea { resize: vertical; min-height: 4.5rem; line-height: 1.45; }
#report-sections { list-style: none; margin: .55rem 0 .4rem; padding: 0; }
.report-section {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .3rem;
  border-top: 1px solid var(--line); padding: .45rem 0; align-items: start;
}
.report-section > details > summary { padding-block: .34rem; color: var(--primary); font-size: .9rem; }
.report-section summary { overflow-wrap: anywhere; }
.report-section-actions { display: flex; gap: .1rem; }
.report-section-actions .icon-button { width: 1.8rem; min-height: 1.9rem; }
.report-evidence-edit { border-radius: .4rem; background: #f5f6fa; padding: .45rem .5rem; min-width: 0; }
.report-evidence-edit > summary { font-size: .82rem; }
.report-evidence-edit > label { margin-top: .48rem; }
#report-selection-hint, .report-preview-message {
  margin: .5rem 0 0; color: var(--muted); font-size: .82rem; line-height: 1.45; overflow-wrap: anywhere;
}
.report-preview-message[data-error="true"] { color: #a31526; }
.report-preview-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.report-paper-wrap {
  display: grid; place-items: center; min-height: 6rem; margin-top: .75rem; padding: clamp(.35rem, 2vw, 1rem);
  border: 1px solid var(--line); border-radius: .55rem; background: #eff2f8;
}
#report-paper {
  display: block; width: min(100%, 32rem); height: auto; background: white;
  box-shadow: 0 3px 12px #202b3e21;
}
.report-pagination {
  display: flex; justify-content: center; align-items: center; gap: .5rem; margin-top: .6rem;
  color: var(--muted); font-size: .82rem; font-variant-numeric: tabular-nums;
}
@media (max-width: 700px) {
  .workspace.report-mode { min-height: 100dvh; grid-template-rows: auto 1fr; }
  .report-workspace { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 430px) {
  #go-report { width: 2.35rem; padding: .3rem; }
  #go-report span { display: none; }
}
.report-edit-field select {
  width: 100%; min-width: 0; border: 1px solid #d3d9e9; border-radius: .5rem;
  padding: .5rem .55rem; color: var(--ink); font: inherit; background: white;
}
.report-scan-settings { display: grid; gap: .3rem; margin-top: .55rem; }
.report-scan-settings .field-toggle { align-items: flex-start; overflow-wrap: anywhere; }
#report-paper.landscape { width: min(100%, 46rem); }
.report-template-tools, .report-logo-tools { display: grid; gap: .55rem; margin-top: .75rem; }
.report-template-tools .report-preview-message:empty, .report-logo-tools .report-preview-message:empty { display: none; }
#report-logo-image {
  display: block; width: auto; max-width: 100%; height: auto; max-height: 4.5rem;
  border: 1px solid var(--line); border-radius: .4rem; padding: .3rem; object-fit: contain;
}
.field-action-items { display: grid; gap: .3rem; padding: 0; margin: .6rem 0 0; list-style: none; }
.field-action-items li { min-width: 0; padding: .35rem .1rem; border-top: 1px solid var(--line); }
.field-action-items p { margin: .2rem 0 0; }
.field-action-edit {
  max-width: 100%; justify-content: flex-start; text-align: left; white-space: normal;
  overflow-wrap: anywhere; min-height: 2rem; padding: .22rem .35rem;
}
.field-action-state { display: inline-block; border-radius: .35rem; padding: .22rem .4rem; background: #edf0f6; font-size: .78rem; }
.field-action-state[data-state="open"] { color: #745019; background: #fbf0d5; }
.field-action-state[data-state="progress"] { color: #2e477c; background: #e8eefc; }
.field-action-state[data-state="closed"] { color: #2e6249; background: #e7f3ea; }
#field-actions-list { overflow-x: auto; margin-top: .7rem; }
.field-actions-table { width: 100%; min-width: 37rem; border-collapse: collapse; table-layout: fixed; text-align: left; }
.field-actions-table :is(th, td) { padding: .5rem; border-bottom: 1px solid var(--line); font-size: .86rem; overflow-wrap: anywhere; vertical-align: top; }
.field-actions-table th { background: #f5f6fa; color: var(--primary); font-weight: 650; }
.field-actions-table th:nth-child(1) { width: 25%; }
.field-actions-table th:nth-child(2) { width: 34%; }
.field-actions-table th:nth-child(3) { width: 17%; }
.action-dialog { width: min(35rem, calc(100vw - 1.2rem)); padding: 1.1rem; }
.action-dialog h2 { font-weight: 650; font-size: 1.2rem; color: var(--primary); }
.action-form { display: grid; gap: .8rem; margin-top: .8rem; }
.action-fields { display: grid; gap: .6rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.action-form-buttons { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .4rem; }
#action-remove { margin-right: auto; color: #941e2c; }
.field-navigation { flex-wrap: wrap; }
@media (max-width: 455px) { .action-fields { grid-template-columns: minmax(0, 1fr); } }

.field-actions-controls { display: flex; flex-wrap: wrap; gap: .45rem; align-items: end; }
.action-followup-content { display: grid; gap: .65rem; margin-top: .55rem; }
.action-dialog { max-height: calc(100dvh - 1.5rem); overflow: auto; }
#action-followup summary { cursor: pointer; color: var(--primary); }
#action-closure-choice { max-width: min(25rem, 70vw); }
#action-closures li { display: flex; gap: .5rem; justify-content: space-between; align-items: center; }
#action-closures li span, .action-history-note { overflow-wrap: anywhere; }
.action-history-note { margin: .2rem 0; font-size: .9rem; white-space: pre-wrap; }
.field-actions-table th:nth-child(1) { width: 22%; }
.field-actions-table th:nth-child(2) { width: 27%; }
.field-actions-table th:nth-child(3) { width: 15%; }

.action-closure-links { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .22rem; }
.action-closure-links .button { color: #245588; }

.web-demo :is(#open, #home-open, #save, #home-new, #home-remove, #remove-project, #new, #demo, #home-save) { display: none; }
.web-demo .web-demo-return { text-decoration: none; border-color: var(--line); }
.workspace.web-demo.home-mode .file-actions { display: flex; }
.web-demo.home-mode #go-home { display: none; }
.web-demo .home-hint { max-width: 43rem; }
@media (max-width: 620px) {
  .web-demo .masthead { row-gap: .4rem; }
  .web-demo .file-actions { flex-wrap: wrap; justify-content: end; }
  .web-demo .web-demo-return { font-size: .78rem; }
}
