.graphics-surface {
  --graphics-line: #e1e8f0;
  --graphics-muted: #566d84;
  --graphics-blue: #1769c3;
  --graphics-unit: 23px;
  --graphics-column: 170px;
  --graphics-column-label-height: 28px;
  --graphics-rack-header-height: 40px;
  --graphics-rack-footer-height: 2.21875rem;
  --graphics-cabinet-padding: 4px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
  min-height: 0;
}

.graphics-toolbar,
.graphics-summary,
.graphics-toolbar-actions,
.graphics-legend,
.graphics-zoom {
  display: flex;
  align-items: center;
}

.graphics-toolbar {
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .4rem 1rem;
  margin-bottom: .65rem;
}

.graphics-summary {
  flex-wrap: wrap;
  gap: .4rem 1rem;
  font-size: .875rem;
  color: var(--graphics-muted);
}

.graphics-toolbar-actions { gap: .55rem; flex-wrap: wrap; }

.graphics-issues summary { cursor: pointer; }
.graphics-issues ul { max-height: 9rem; overflow: auto; margin-block: .5rem 0; }

.graphics-usage-option {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  color: var(--graphics-muted);
  font-size: .875rem;
  white-space: nowrap;
  cursor: pointer;
}

.graphics-usage-option input { margin: 0; accent-color: var(--graphics-blue); }

.graphics-device-controls {
  display: flex;
  align-items: center;
  flex: 1 1 100%;
  flex-wrap: wrap;
  gap: .45rem .55rem;
}

.graphics-device-controls .dv-search { flex: 0 1 19rem; }

.graphics-label-option {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin-left: auto;
  white-space: nowrap;
}

.graphics-label-option + .graphics-label-option { margin-left: 0; }

.graphics-label-option,
.graphics-search-status { color: var(--graphics-muted); font-size: .875rem; }

.graphics-label-option select {
  min-height: 34px;
  padding: 0 .45rem;
  border: 1px solid #d6e2ef;
  border-radius: 7px;
  color: #264261;
  background: #fff;
  font: inherit;
}

.graphics-legend {
  gap: .25rem;
  color: #914b19;
}

.graphics-unwired {
  width: 1em;
  height: 1em;
  flex-shrink: 0;
}

.graphics-zoom {
  gap: 3px;
  padding: 3px;
  border: 1px solid #dce7f2;
  border-radius: 7px;
  background: #f6f9fd;
  white-space: nowrap;
}

.graphics-zoom button {
  display: grid;
  place-items: center;
  min-width: 30px;
  height: 28px;
  padding: 0 .25rem;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #45617e;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.graphics-zoom .graphics-zoom-value { min-width: 58px; font-size: .875rem; font-weight: 600; }
.graphics-zoom button:hover:not(:disabled) { background: #e4f0ff; color: var(--graphics-blue); }
.graphics-zoom button:disabled { opacity: .4; cursor: not-allowed; }

.graphics-viewport {
  flex: 1 1 0;
  min-height: 175px;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid #dbe5ee;
  border-radius: 9px;
  background: #fff;
  cursor: grab;
  box-shadow: 0 2px 7px #233b5606;
}

.graphics-viewport:focus-visible { outline: 2px solid #5797df; outline-offset: 2px; }
.graphics-viewport.panning, .graphics-viewport.panning * { cursor: grabbing; user-select: none; }

.graphics-sheet {
  width: max-content;
  min-width: 100%;
  min-height: 100%;
  padding: 10px 12px 18px;
  box-sizing: border-box;
}

.graphics-row h3 {
  display: flex;
  align-items: center;
  gap: .65rem;
  margin: .65rem 0;
  color: var(--graphics-muted);
  font-size: .875rem;
  white-space: nowrap;
}

.graphics-row h3::after { content: ''; flex: 1; height: 1px; background: #edf1f5; }
.graphics-row + .graphics-row { margin-top: 1.25rem; }

.graphics-floor-row,
.graphics-elevation-row {
  display: flex;
  gap: 12px;
  width: max-content;
}

.graphics-elevation-row { align-items: start; }

.graphics-floor-slot { position: relative; }

.graphics-floor-card,
.graphics-add,
.graphics-placeholder {
  box-sizing: border-box;
  display: block;
  width: 160px;
  height: 94px;
  padding: .75rem .85rem;
  border: 1px solid #dce8f2;
  border-radius: 8px;
  text-align: left;
}

.graphics-floor-card {
  background: #f7fbff;
  color: #3a536d;
  cursor: pointer;
}

.graphics-floor-rack { cursor: grab; }
.graphics-floor-card:hover { border-color: #8db9eb; background: #f2f8ff; }
.graphics-floor-rack strong { padding-right: 38px; }
.graphics-floor-card strong, .graphics-placeholder strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9375rem; }
.graphics-floor-card span, .graphics-placeholder span, .graphics-floor-card small { display: block; margin-top: .25rem; font-size: .8125rem; }
.graphics-floor-card small { color: #397865; white-space: nowrap; }

.graphics-edit {
  position: absolute;
  top: 8px;
  right: 7px;
  padding: .3rem .45rem;
  border: 0;
  border-radius: 5px;
  background: #fff;
  color: #1969b5;
  font-size: .8125rem;
  cursor: pointer;
}

.graphics-edit:hover { background: #eaf3ff; }
.graphics-empty { background: #fafbfd; border: 1px dashed #bdcbd8; color: #536b84; }
:is(.graphics-ups, .graphics-ac, .graphics-facility) { background: #fcfaf6; border: 1px dashed #ded0b6; color: #7c6949; }
.graphics-placeholder {
  align-self: stretch;
  width: calc(var(--graphics-column) + 2px);
  height: auto;
}

.graphics-elevation-row:not(:has(.graphics-rack)) .graphics-placeholder {
  min-height: calc(var(--room-rack-units) * var(--graphics-unit) + var(--room-rack-column-label)
    + var(--graphics-rack-header-height) + var(--graphics-rack-footer-height) + 2 * var(--graphics-cabinet-padding) + 2px);
}

.graphics-add {
  width: 135px;
  border: 1px dashed #9dbbdb;
  background: #f8fbff;
  color: var(--graphics-blue);
  font-size: .875rem;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
}

.graphics-add:hover { border-color: var(--graphics-blue); background: #eaf3ff; }

.graphics-aisle {
  margin: 14px 0 0;
  padding: .35rem .7rem;
  border-radius: 5px;
  background: #f5f8fb;
  color: var(--graphics-muted);
  font-size: .8125rem;
  letter-spacing: .1em;
  text-align: center;
}

.graphics-rack {
  border: 1px solid var(--graphics-line);
  border-radius: 7px;
  background: #f4f7fa;
}

.graphics-rack > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .4rem .7rem;
  height: var(--graphics-rack-header-height);
  padding: 6px 10px;
  border-bottom: 1px solid var(--graphics-line);
  border-radius: 7px 7px 0 0;
  background: #f6f8fb;
}

.graphics-rack > header strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9375rem; }
.graphics-rack > header span, .graphics-rack > footer { color: var(--graphics-muted); font-size: .8125rem; white-space: nowrap; }
.graphics-rack > footer {
  display: grid;
  place-items: center;
  height: var(--graphics-rack-footer-height);
  padding-inline: .2rem;
  text-align: center;
}
.graphics-rack.graphics-located { box-shadow: 0 0 0 2px #4a97eb; }

.graphics-cabinet-columns {
  display: flex;
  box-sizing: border-box;
  width: calc(var(--rack-columns) * (var(--graphics-column) + 1px) - 1px);
  height: calc(var(--rack-units) * var(--graphics-unit) + var(--column-label-height) + 2 * var(--graphics-cabinet-padding));
  padding: var(--graphics-cabinet-padding) 0;
}

.graphics-cabinet-column + .graphics-cabinet-column { border-left: 1px solid #d3dfea; }
.graphics-column-label { display: grid; place-items: center; height: var(--column-label-height); color: var(--graphics-muted); font-size: .8125rem; }

.graphics-rail-box {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 24px;
  width: var(--graphics-column);
}

.graphics-u-labels {
  display: grid;
  grid-template-rows: repeat(var(--rack-units), var(--graphics-unit));
  color: #586f86;
  font-size: .75rem;
  text-align: center;
}

.graphics-u-labels span { align-self: center; }

.graphics-rail {
  position: relative;
  height: calc(var(--rack-units) * var(--graphics-unit));
  border-inline: 1px solid #dae3ee;
  background: repeating-linear-gradient(to bottom, #fff 0, #fff calc(var(--graphics-unit) - 1px), #e9eff5 calc(var(--graphics-unit) - 1px), #e9eff5 var(--graphics-unit));
}

.graphics-device {
  position: absolute;
  top: calc(var(--device-row) * var(--graphics-unit) + 1px);
  right: 2px;
  left: 2px;
  height: calc(var(--device-height) * var(--graphics-unit) - 2px);
  overflow: hidden;
  padding: 0 .35rem;
  border: 1px solid var(--device-color);
  border-radius: 4px;
  background: color-mix(in srgb, var(--device-color) 13%, white);
  color: color-mix(in srgb, var(--device-color) 32%, #1c354e);
  text-align: left;
  font-size: 9pt;
  line-height: 1.15;
  cursor: grab;
}

.graphics-device-name,
.graphics-device small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: inherit;
}

.graphics-device-label {
  --graphics-label-lines: 1;
  display: block;
  min-width: 0;
  /* Leave room for the device border and the gap between adjacent devices. */
  font-size: min(var(--graphics-label-size, 9pt), calc((var(--device-height) * var(--graphics-unit) - 4px) / var(--graphics-label-lines)));
  line-height: 1;
}

.graphics-device-label:has(> small) { --graphics-label-lines: 2; }
.graphics-device:has(.graphics-unwired) { padding-right: 1.3rem; }
.graphics-device:has(.graphics-changed-marker) { padding-right: 1.4rem; }
.graphics-device:has(.graphics-unwired):has(.graphics-changed-marker) { padding-right: 2.25rem; }
.graphics-device .graphics-unwired, .graphics-changed-marker { position: absolute; top: 3px; right: 3px; color: #954c1c; }
.graphics-device .graphics-changed-marker:has(+ .graphics-unwired) { right: 18px; }
.graphics-device.selected { z-index: 2; outline: 2px solid #1c68ca; outline-offset: 1px; }
.graphics-device.highlighted { z-index: 2; box-shadow: 0 0 0 2px #2c9f85; }
.graphics-device.search-match:not(.highlighted) { z-index: 2; box-shadow: 0 0 0 2px #aa6a16; }
.graphics-device.search-muted:not(.selected):not(.highlighted):not(:hover):not(:focus-visible) { opacity: .35; }

.graphics-drop-rail { box-shadow: inset 0 0 0 2px #75abe2; }

.graphics-drop-preview {
  position: absolute;
  z-index: 3;
  right: 1px;
  left: 1px;
  box-sizing: border-box;
  border: 2px solid #26947c;
  border-radius: 3px;
  background: #45bfa244;
  pointer-events: none;
}

.graphics-drop-preview.invalid { border-color: #c64d46; background: #d44f4c44; }

.graphics-drop-label {
  position: fixed;
  z-index: 2147483000;
  max-width: min(28rem, calc(100vw - 12px));
  padding: .4rem .55rem;
  border: 1px solid #a8d7c9;
  border-radius: 5px;
  background: #f1fbf7;
  color: #205d50;
  font-size: .875rem;
  pointer-events: none;
}

.graphics-drop-label.invalid { border-color: #f0bab6; background: #fff4f3; color: #a2322c; }
.graphics-footnote { padding-top: .6rem; color: var(--graphics-muted); font-size: .8125rem; }
.graphics-muted { color: #566d84; }
.graphics-number-preview { max-height: 10rem; overflow: auto; overflow-wrap: anywhere; }
.graphics-error { color: #b33232; }

.graphics-slot-impact {
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  margin-top: 1rem;
  padding: .75rem;
  border: 1px solid #e7cba4;
  border-radius: 8px;
  background: #fff8ed;
  color: #755024;
}

[data-slot-impact][hidden], [data-rack-field][hidden], [data-slot-name][hidden] { display: none; }
.graphics-delete-slot { margin-top: 1rem; }
.graphics-delete-slot button { color: #a2322c; }
