:root {
  color-scheme: light;
  --bg: #eef1f4;
  --panel: #fbfcfd;
  --panel-strong: #ffffff;
  --ink: #17212b;
  --muted: #627080;
  --line: #cfd6de;
  --line-strong: #9aa6b2;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --amber: #b45309;
  --red: #b42318;
  --steel: #475569;
  --cyan: #0e7490;
  --shadow: 0 12px 34px rgba(31, 41, 51, 0.12);
  --radius: 8px;
  --control-height: 34px;
  --text-field-height: 105px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: 0.48;
}

.app-shell {
  height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.topbar {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 14px;
  background: linear-gradient(180deg, #f4f8fa 0%, #dce7ec 100%);
  border-bottom: 1px solid rgba(139, 150, 160, 0.45);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.95) inset, 0 10px 24px rgba(23, 33, 43, 0.1);
  min-height: 58px;
  min-width: 0;
}

.topbar::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(100deg, rgba(255, 255, 255, 0.72) 0%, rgba(255, 255, 255, 0.2) 46%, rgba(14, 116, 144, 0.1) 100%);
  opacity: 0.9;
}

.topbar::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 80% 0%, rgba(14, 116, 144, 0.15), rgba(14, 116, 144, 0) 34%),
    radial-gradient(circle at 8% 100%, rgba(15, 118, 110, 0.12), rgba(15, 118, 110, 0) 36%),
    linear-gradient(90deg, rgba(244, 249, 251, 0.64) 0%, rgba(255, 255, 255, 0.38) 44%, rgba(232, 239, 243, 0.62) 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.62) 0%, rgba(219, 229, 235, 0.66) 100%);
  mix-blend-mode: multiply;
}

.brand {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 210px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: block;
  border: 0;
  border-radius: 0;
  background: transparent;
  object-fit: contain;
}

.brand strong,
.brand span {
  display: block;
  white-space: nowrap;
}

.brand strong {
  font-size: 15px;
}

.brand div > span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 1px;
}

.toolbar {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 7px;
  flex: 1 1 auto;
  min-width: 0;
}

.toolbar-controls {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: nowrap;
  gap: 10px;
  width: 100%;
  min-width: 0;
}

.project-actions,
.toolbar-controls {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.mode-tools {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 10px;
}

.project-command-group {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.zoom-control {
  flex: 0 0 auto;
  margin-left: 0;
}

.sheet-tabs {
  flex: 0 0 auto;
  margin-left: auto;
}

.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #f7f9fb;
}

.tool-button,
.icon-text-button,
.primary-button,
.secondary-button,
.danger-button,
.small-icon-button {
  min-height: 34px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 7px;
}

.tool-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  padding: 0 12px;
}

.tool-button:last-child {
  border-right: 0;
}

.tool-button.is-active {
  background: var(--accent);
  color: #fff;
}

.tool-button.icon-only {
  width: 38px;
  padding: 0;
  font-size: 17px;
  font-weight: 800;
}

.tool-button.zoom-value {
  min-width: 62px;
  padding: 0 10px;
  color: var(--steel);
  font-weight: 800;
}

.zoom-control .tool-button.zoom-value:hover {
  background: #fff;
}

.icon-text-button,
.primary-button,
.secondary-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 12px;
}

.small-icon-button {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  padding: 0;
}

.primary-button {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.secondary-button:hover,
.icon-text-button:hover,
.small-icon-button:hover,
.tool-button:not(.is-active):hover {
  border-color: var(--line-strong);
  background: #f5f7f9;
}

.danger-button {
  border-color: #f1b6af;
  color: var(--red);
}

.field-inline {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.section-control {
  min-width: 158px;
  transition: opacity 120ms ease;
}

.section-control.is-hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.field-inline select,
.form-grid input,
.wide-label textarea,
.search-input {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  min-height: var(--control-height);
}

.field-inline select {
  min-width: 88px;
  padding: 0 8px;
}

.color-dropdown {
  position: relative;
  width: 82px;
}

.color-dropdown-button {
  width: 82px;
  height: var(--control-height);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  padding: 0;
}

.color-dropdown-button:disabled {
  opacity: 0.48;
}

.wire-color-swatch {
  width: 44px;
  height: 16px;
  display: block;
  border: 1px solid rgba(15, 23, 42, 0.28);
  border-radius: 3px;
  background: var(--swatch-color, #111827);
}

.wire-color-swatch.is-pe {
  background: repeating-linear-gradient(
    90deg,
    #facc15 0,
    #facc15 9px,
    #15803d 9px,
    #15803d 18px
  );
}

.wire-color-swatch.is-white {
  border-color: #111827;
  background: #f8fafc;
}

.color-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(2, 44px);
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.color-dropdown:not(.is-open) .color-dropdown-menu {
  display: none;
}

.color-dropdown-option {
  width: 44px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  padding: 0;
}

.color-dropdown-option:hover,
.color-dropdown-option.is-selected {
  border-color: var(--accent);
  background: #ecfdf5;
}

.project-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.project-name-field {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.project-name-input {
  flex: 1 1 170px;
  width: 190px;
  max-width: 220px;
  height: var(--control-height);
  min-height: var(--control-height);
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
}

#importElementBtn {
  width: 26px;
  height: 26px;
  min-height: 26px;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1;
}

.workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: 280px minmax(420px, 1fr) 360px;
  gap: 0;
}

.sidebar,
.inspector {
  min-height: 0;
  overflow: auto;
  background: #f6f8fa;
  border-right: 1px solid var(--line);
}

.inspector {
  border-right: 0;
  border-left: 1px solid var(--line);
}

.panel {
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.panel-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-title-row h2 {
  flex: 1;
}

h2 {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--steel);
  font-weight: 750;
}

.search-input {
  width: 100%;
  padding: 0 10px;
  margin-bottom: 12px;
}

#librarySearch {
  margin-top: 10px;
}

.library-tree {
  display: grid;
  gap: 8px;
}

.folder {
  display: grid;
  gap: 6px;
}

.folder-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 24px;
  padding: 2px 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.folder-title::-webkit-details-marker {
  display: none;
}

.folder-title::before {
  content: "";
  width: 0;
  height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 6px solid currentColor;
  transition: transform 0.16s ease;
}

.folder[open] > .folder-title::before {
  transform: rotate(90deg);
}

.folder-title span:first-child {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-items {
  display: grid;
  gap: 6px;
  margin-left: 2px;
  padding-left: 8px;
  border-left: 1px solid var(--line);
}

.library-item {
  width: 100%;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 42px;
  padding: 5px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  border-radius: var(--radius);
  text-align: left;
}

.library-item:hover,
.library-item.is-placing {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.12);
}

.library-item.is-disabled:hover {
  border-color: var(--line);
  box-shadow: none;
}

.library-thumb {
  width: 30px;
  height: 34px;
  display: grid;
  place-items: center;
  background: #f1f4f7;
  border: 1px solid #dce2e8;
  border-radius: 5px;
  overflow: hidden;
}

.library-thumb svg {
  max-width: 27px;
  max-height: 31px;
}

.library-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.library-meta {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.library-preview {
  position: fixed;
  z-index: 60;
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 14px;
  padding: 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 18px 44px rgba(31, 41, 55, 0.2);
  pointer-events: none;
}

.library-preview[hidden] {
  display: none;
}

.library-preview-art {
  min-height: 148px;
  display: grid;
  place-items: center;
  border: 1px solid #dce2e8;
  border-radius: 7px;
  background: #f6f8fa;
  overflow: hidden;
}

.library-preview-art svg {
  max-width: 106px;
  max-height: 136px;
}

.library-preview-body {
  min-width: 0;
  align-self: center;
}

.library-preview-title {
  margin-bottom: 8px;
  color: var(--ink);
  font-weight: 800;
  line-height: 1.25;
}

.library-preview-grid {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 5px 10px;
  margin: 0;
  font-size: 12px;
}

.library-preview-grid dt {
  color: var(--muted);
  font-weight: 700;
}

.library-preview-grid dd {
  min-width: 0;
  margin: 0;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.main-view {
  min-width: 0;
  min-height: 0;
  display: grid;
}

.canvas-shell {
  min-width: 0;
  min-height: 0;
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) 34px;
  background: #dfe4ea;
}

.canvas-shell.is-hidden,
.specification-sheet.is-hidden,
.labels-sheet.is-hidden {
  display: none;
}

#drawing {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  background: #eef2f6;
  cursor: grab;
}

.canvas-bg {
  cursor: grab;
}

#drawing.is-panning,
#drawing.is-panning .canvas-bg,
#drawing.is-panning .element,
#drawing.is-panning .element-body {
  cursor: grabbing;
}

#drawing.is-wiring {
  cursor: crosshair;
}

#drawing.is-wiring .canvas-bg,
#drawing.is-wiring .element-body {
  cursor: crosshair;
}

.statusbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 12px;
  min-width: 0;
  background: var(--panel-strong);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.statusbar span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.specification-sheet,
.labels-sheet {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  background: #f2f5f7;
  padding: 24px;
}

.specification-header,
.labels-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.specification-header h1,
.labels-header h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0;
}

.specification-header p,
.labels-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.specification-summary,
.labels-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(92px, 1fr));
  gap: 10px;
  min-width: 340px;
}

.specification-metric {
  border-left: 3px solid var(--accent);
  padding-left: 10px;
}

.specification-metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.specification-metric strong {
  display: block;
  margin-top: 2px;
  font-size: 18px;
}

.specification-content {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.labels-content {
  display: grid;
  gap: 20px;
  margin-top: 18px;
  align-content: start;
}

.specification-section h2 {
  margin-bottom: 8px;
}

.label-rail-section {
  display: grid;
  gap: 8px;
  justify-items: start;
}

.label-rail-title {
  margin: 0;
  color: var(--steel);
  font-size: 13px;
  font-weight: 800;
}

.panel-label-table-wrap {
  overflow: visible;
  max-width: none;
  background: #fff;
}

.panel-label-table {
  width: var(--label-table-width);
  border-collapse: collapse;
  table-layout: fixed;
  background: #fff;
  transform-origin: 0 0;
}

.panel-label-table td {
  position: relative;
  width: 17.5mm;
  height: var(--label-cell-height);
  padding: 0;
  border: 0.25mm solid #111827;
  text-align: center;
  vertical-align: middle;
  overflow: hidden;
}

.label-cell {
  position: absolute;
  inset: 0;
  color: #111827;
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.label-cell-item {
  position: absolute;
  inset: 0;
}

.label-cell-designation {
  position: absolute;
  top: 2mm;
  left: 1.5mm;
  right: 1.5mm;
  font-size: 16px;
  font-weight: 850;
  text-align: center;
}

.label-cell-consumer {
  position: absolute;
  top: 50%;
  left: 5%;
  right: 5%;
  transform: translateY(-50%);
  font-size: var(--label-consumer-font-size, 7px);
  font-weight: 700;
  text-align: center;
}

.specification-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  background: #fff;
}

.specification-table {
  width: max-content;
  min-width: max(100%, 760px);
  border-collapse: collapse;
  table-layout: auto;
}

.specification-table th,
.specification-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  line-height: 1.25;
  overflow-wrap: anywhere;
  word-break: normal;
}

.specification-table th {
  background: #e8edf2;
  color: var(--steel);
  font-size: 12px;
  font-weight: 800;
}

.specification-table tbody tr:last-child td {
  border-bottom: 0;
}

.specification-table .numeric {
  width: 1%;
  text-align: right;
}

.specification-table .nowrap {
  white-space: nowrap;
  overflow-wrap: normal;
}

.specification-table .spec-cell-index {
  min-width: 44px;
}

.specification-table .spec-cell-designation {
  min-width: 92px;
}

.specification-table .spec-cell-type {
  min-width: 132px;
}

.specification-table .spec-cell-name {
  min-width: 220px;
  max-width: 420px;
}

.specification-table .spec-cell-article {
  min-width: 130px;
  max-width: 280px;
}

.specification-table .spec-cell-size {
  min-width: 120px;
}

.specification-table .spec-cell-id {
  min-width: 180px;
  max-width: 300px;
}

.specification-table--wires .spec-cell-color {
  min-width: 180px;
}

.specification-table--wires .spec-cell-length {
  min-width: 150px;
}

.wire-color-spec {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.specification-empty {
  padding: 18px;
  border: 1px dashed var(--line-strong);
  color: var(--muted);
  background: #fff;
  font-weight: 700;
}

#statusZoom {
  margin-left: auto;
  color: var(--steel);
  font-weight: 800;
}

.element,
.element-body {
  cursor: default;
}

.element-frame {
  fill: none;
  stroke: transparent;
  pointer-events: none;
}

.element.is-selected .element-frame {
  stroke: var(--accent);
  stroke-width: 1.33;
  stroke-dasharray: 6 4;
}

.element-svg-fallback rect {
  fill: #fff7ed;
  stroke: #c2410c;
  stroke-width: 1;
}

.element-svg-fallback line {
  stroke: #c2410c;
  stroke-width: 0.8;
}

.element-designation-badge {
  pointer-events: none;
}

.element-designation-badge-bg {
  fill: #ffffff;
  stroke: #111827;
  stroke-width: 0.8;
}

.element-designation-label {
  fill: #17212b;
  font-size: 8px;
  font-weight: 800;
  pointer-events: none;
}

.conn-point {
  fill: #ffffff;
  stroke: var(--cyan);
  stroke-width: 1;
  cursor: default;
  transition: r 120ms ease, stroke-width 120ms ease, fill 120ms ease;
}

.conn-point-group {
  cursor: crosshair;
}

.conn-point-label {
  pointer-events: none;
  user-select: none;
}

.conn-point:hover {
  fill: #e6fffb;
  stroke-width: 1.5;
}

#drawing.is-wiring .conn-point {
  fill: #ecfeff;
  stroke: var(--accent);
  stroke-width: 0.75;
  cursor: crosshair;
}

#drawing.is-wiring .conn-point:hover {
  fill: #ffffff;
  stroke: var(--amber);
  stroke-width: 1;
}

.wire-preview {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 9 7;
  pointer-events: none;
}

.wire-preview-color {
  pointer-events: none;
  opacity: 0.72;
}

.wire-end-marker {
  fill: #fff;
  stroke: var(--accent);
  stroke-width: 1;
  pointer-events: none;
}

.snap-point {
  fill: var(--amber);
  stroke: #fff;
  stroke-width: 1.5;
  opacity: 0.75;
  pointer-events: none;
}

.panel-snap-point {
  fill: #94a3b8;
  opacity: 0.42;
}

.route-line {
  fill: none;
  stroke: #64748b;
  stroke-width: 1;
  stroke-dasharray: 4 7;
  opacity: 0.28;
  pointer-events: none;
}

.route-line-vertical {
  stroke: #64748b;
}

.snap-guide {
  stroke: var(--amber);
  stroke-width: 2;
  stroke-dasharray: 5 5;
  pointer-events: none;
}

.wire {
  fill: none;
  stroke: #263442;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  cursor: pointer;
}

.wire.hit {
  stroke: transparent;
  stroke-width: 14;
}

.wire-outline {
  pointer-events: none;
}

.wire-selection {
  fill: none;
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
  opacity: 0.9;
}

.wire-overlap {
  fill: none;
  stroke: #000000;
  stroke-linecap: butt;
  opacity: 1;
  pointer-events: none;
}

.wire-number-badge {
  cursor: pointer;
}

.wire-number-badge rect {
  fill: #facc15;
  stroke: #fff;
  stroke-width: 0.47;
}

.wire-number-badge text {
  fill: #17212b;
  font-size: 2.8px;
  font-weight: 800;
  dominant-baseline: middle;
  pointer-events: none;
}

.inspector-content {
  display: grid;
  gap: 10px;
}

.inline-editor-field {
  display: grid;
  gap: 4px;
}

.inline-editor-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.property-grid {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) minmax(120px, 1.2fr);
  gap: 6px 10px;
  align-items: center;
}

.property-grid dt {
  color: var(--muted);
}

.property-grid dd {
  margin: 0;
  font-weight: 700;
  min-width: 0;
  overflow-wrap: anywhere;
}

.pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--steel);
  font-size: 12px;
  font-weight: 700;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.form-grid label,
.wide-label {
  display: grid;
  gap: 4px;
}

.form-grid span,
.wide-label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.form-grid input {
  width: 100%;
  height: var(--control-height);
  padding: 0 8px;
}

.wide-label {
  margin-top: 9px;
}

.wide-label textarea {
  width: 100%;
  height: var(--text-field-height);
  min-height: var(--text-field-height);
  resize: vertical;
  padding: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
}

.file-property-editor {
  display: grid;
  gap: 3px;
}

.file-property-editor textarea {
  height: var(--text-field-height);
  min-height: var(--text-field-height);
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  tab-size: 2;
}

.file-property-actions {
  margin-top: 0;
}

.file-property-message {
  min-height: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
  font-weight: 700;
}

.file-property-message.is-error {
  color: var(--red);
}

.builder-preview {
  height: 170px;
  margin-top: 10px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f4f7fa;
  overflow: hidden;
}

.builder-preview svg {
  width: 100%;
  height: 100%;
}

.element-builder.is-hidden {
  display: none;
}

.properties-panel.is-hidden {
  display: none;
}

.button-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.button-row button {
  flex: 1;
}

select.inline-editor,
input.inline-editor {
  width: 100%;
  height: var(--control-height);
  min-height: var(--control-height);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 8px;
}

@media (max-width: 1180px) {
  .project-name-input {
    width: 160px;
  }
}

@media (max-width: 1040px) {
  .project-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .specification-header,
  .labels-header {
    display: grid;
  }

  .specification-summary,
  .labels-summary {
    min-width: 0;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 250px minmax(360px, 1fr) 320px;
  }

  .brand div > span {
    display: none;
  }
}

@media (max-width: 900px) {
  body {
    overflow: auto;
  }

  .app-shell {
    height: auto;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding: 8px 10px 10px;
  }

  .brand {
    min-width: 0;
  }

  .toolbar {
    align-items: flex-start;
    justify-content: flex-start;
    width: 100%;
  }

  .project-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    justify-items: stretch;
    align-items: center;
    row-gap: 7px;
    width: 100%;
    max-width: 100%;
    overflow: visible;
  }

  .toolbar-controls {
    flex-wrap: nowrap;
    justify-content: flex-start;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
  }

  .project-actions {
    align-items: center;
  }

  .project-name-field {
    justify-self: start;
  }

  .project-command-group {
    width: 100%;
    margin-left: 0;
    justify-content: flex-end;
  }

  .mode-tools {
    width: auto;
    flex-wrap: nowrap;
    justify-content: flex-start;
    row-gap: 0;
  }

  .section-control.is-hidden {
    display: none;
  }

  .project-actions .icon-text-button {
    flex: 0 0 auto;
  }

  .project-name-field,
  .project-command-group,
  .mode-tools,
  .section-control,
  .zoom-control,
  .sheet-tabs {
    flex: 0 0 auto;
  }

  .project-name-input {
    flex: 0 0 190px;
    width: 190px;
  }

  .workspace {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(520px, 1fr) auto;
  }

  .specification-sheet,
  .labels-sheet {
    padding: 16px;
  }

  .specification-summary,
  .labels-summary {
    grid-template-columns: 1fr;
  }

  .sidebar,
  .inspector {
    border: 0;
    max-height: 380px;
  }

  .canvas-shell {
    min-height: 520px;
  }
}
