:root {
  color-scheme: light;
  --viewer-bg: #f4f7f5;
  --viewer-surface: #ffffff;
  --viewer-text: #111815;
  --viewer-muted: #5b6b63;
  --viewer-line: #c5d1ca;
  --viewer-accent: var(--inplug-accent, #9ed42e);
  --viewer-accent-ink: #111815;
  --viewer-danger: #8f1d1d;
  --viewer-danger-bg: rgba(220, 38, 38, 0.1);
}

* { box-sizing: border-box; }

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--viewer-bg);
  color: var(--viewer-text);
  font-family: var(--inplug-font, "Source Sans 3", "Segoe UI", sans-serif);
  font-size: var(--inplug-text-body, 1.0625rem);
}

button,
input { font: inherit; color: inherit; }

.viewer-app {
  height: 100%;
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.viewer-bar {
  display: flex;
  align-items: center;
  gap: var(--inplug-space-4, 16px);
  min-height: 60px;
  padding: var(--inplug-space-3, 12px) var(--inplug-space-5, 24px);
  border-bottom: 1px solid var(--viewer-line);
  background: var(--viewer-surface);
}

.viewer-brand {
  margin: 0;
  min-width: 0;
  font-size: inherit;
  line-height: 0;
}

.viewer-brand-link {
  display: inline-block;
  color: inherit;
}

.viewer-logo {
  display: block;
  width: auto;
  max-width: 100%;
  height: var(--viewer-logo-height, 36px);
}

.viewer-actions {
  display: flex;
  margin-inline-start: auto;
  align-items: center;
  gap: var(--inplug-space-2, 8px);
}

.viewer-button {
  min-height: 42px;
  padding: 0 var(--inplug-space-4, 16px);
  border: 1px solid var(--viewer-line);
  border-radius: var(--inplug-radius-sm, 10px);
  background: transparent;
  cursor: pointer;
}

.viewer-button:focus-visible,
.viewer-brand-link:focus-visible {
  outline: 3px solid var(--viewer-accent);
  outline-offset: 2px;
}

.viewer-button--primary {
  border-color: transparent;
  background: var(--viewer-accent);
  color: var(--viewer-accent-ink);
  font-weight: 600;
}

.viewer-button:disabled {
  opacity: 0.55;
  cursor: default;
}

.viewer-app[aria-busy="true"] .viewer-button:disabled {
  cursor: progress;
}

.viewer-button.is-active {
  border-color: var(--viewer-accent);
  box-shadow: inset 0 0 0 1px var(--viewer-accent);
}

.viewer-button--small {
  min-height: 34px;
  padding: 0 var(--inplug-space-3, 12px);
  font-size: 0.9rem;
}

.viewer-tab {
  margin-bottom: -1px;
  padding: 6px var(--inplug-space-4, 16px);
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: transparent;
  color: var(--viewer-muted);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.viewer-tab:hover {
  color: var(--viewer-text);
}

.viewer-tab[aria-selected="true"] {
  border-color: var(--viewer-line);
  background: var(--viewer-surface);
  color: var(--viewer-text);
  box-shadow: inset 0 3px 0 var(--viewer-accent);
}

.viewer-tab:focus-visible,
.viewer-close:focus-visible {
  outline: 3px solid var(--viewer-accent);
  outline-offset: -3px;
}

.viewer-close {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  margin: 2px 0 2px auto;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--viewer-muted);
  cursor: pointer;
}

.viewer-close svg {
  width: 18px;
  height: 18px;
  transition: transform 0.15s ease;
}

.viewer-close:hover {
  color: var(--viewer-text);
}

.viewer-statusbar {
  display: flex;
  align-items: center;
  min-height: 28px;
  padding: 0 var(--inplug-space-4, 16px);
  border-top: 1px solid var(--viewer-line);
  background: var(--viewer-surface);
}

.viewer-tool {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--inplug-radius-sm, 10px);
  background: transparent;
  color: var(--viewer-text);
  cursor: pointer;
}

.viewer-tool svg {
  width: 20px;
  height: 20px;
}

.viewer-tool-label {
  font-size: 0.78rem;
  line-height: 1.1;
  white-space: nowrap;
}

.viewer-tool:hover:not(:disabled) {
  border-color: var(--viewer-line);
  background: color-mix(in srgb, var(--viewer-text) 6%, transparent);
}

.viewer-tool:disabled {
  color: var(--viewer-muted);
  opacity: 0.45;
  cursor: default;
}

.viewer-tool.is-active {
  border-color: var(--viewer-accent);
  box-shadow: inset 0 0 0 1px var(--viewer-accent);
}

.viewer-tool:focus-visible {
  outline: 3px solid var(--viewer-accent);
  outline-offset: 1px;
}

.viewer-status {
  flex: 1;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--viewer-muted);
  font-size: 0.85rem;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-banner {
  margin: 0;
  padding: var(--inplug-space-3, 12px) var(--inplug-space-5, 24px);
  background: var(--viewer-danger-bg);
  color: var(--viewer-danger);
}

.viewer-body {
  flex: 1;
  min-height: 0;
  display: flex;
}

.viewer-stage {
  --viewer-cube-size: 136px;
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 0;
}

.viewer-cube {
  position: absolute;
  top: var(--inplug-space-2, 8px);
  right: var(--inplug-space-2, 8px);
  z-index: 4;
  display: grid;
  justify-items: center;
  gap: var(--inplug-space-1, 4px);
  min-width: var(--viewer-cube-size);
}

.viewer-cube[hidden] {
  display: none;
}

.viewer-cube-hit {
  width: var(--viewer-cube-size);
  height: var(--viewer-cube-size);
  touch-action: none;
}

.viewer-cube-turns {
  display: flex;
  gap: var(--inplug-space-2, 8px);
}

.viewer-cube-turn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--viewer-line);
  border-radius: var(--inplug-radius-sm, 10px);
  background: var(--viewer-surface);
  color: var(--viewer-text);
  cursor: pointer;
}

.viewer-cube-turn svg {
  width: 18px;
  height: 18px;
}

.viewer-cube-turn:hover {
  border-color: var(--viewer-accent);
}

.viewer-cube-turn:focus-visible {
  outline: 3px solid var(--viewer-accent);
  outline-offset: 2px;
}

.viewer-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.viewer-drop {
  position: absolute;
  inset: var(--inplug-space-4, 16px);
  display: grid;
  place-items: center;
  border: 1px dashed var(--viewer-accent);
  border-radius: var(--inplug-radius-md, 16px);
  background: color-mix(in srgb, var(--viewer-bg) 55%, transparent);
  color: var(--viewer-text);
  pointer-events: none;
}

.viewer-drop[hidden] {
  display: none;
}

.viewer-panel,
.viewer-tree-panel {
  overflow: auto;
  padding: var(--inplug-space-5, 24px);
  background: var(--viewer-surface);
}

.viewer-panel {
  flex: none;
  width: var(--viewer-props-width, min(400px, 100%));
  border-left: 1px solid var(--viewer-line);
}

.viewer-tree-panel {
  flex: none;
  width: var(--viewer-tree-width, min(300px, 100%));
  padding-inline: var(--inplug-space-3, 12px);
  border-right: 1px solid var(--viewer-line);
}

.viewer-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--inplug-space-2, 8px);
  margin: 0 var(--inplug-space-2, 8px) var(--inplug-space-3, 12px);
}

.viewer-panel-head h2 {
  margin: 0;
  font-family: var(--inplug-font-display, "Onest", sans-serif);
  font-size: var(--inplug-text-title, 1.35rem);
}

.viewer-cloud {
  display: grid;
  gap: var(--inplug-space-2, 8px);
  margin: 0 var(--inplug-space-2, 8px) var(--inplug-space-3, 12px);
  padding-bottom: var(--inplug-space-3, 12px);
  border-bottom: 1px solid var(--viewer-line);
}

.viewer-cloud-name {
  margin: 0;
  font-family: var(--inplug-font-display, "Onest", sans-serif);
  font-size: var(--inplug-text-title, 1.35rem);
  overflow-wrap: anywhere;
}

.viewer-cloud-members {
  display: grid;
  gap: var(--inplug-space-1, 4px);
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--viewer-muted);
  font-size: var(--inplug-text-meta, 0.875rem);
}

.viewer-tree ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.tree-row {
  display: flex;
  align-items: center;
  gap: var(--inplug-space-1, 4px);
  padding-inline-start: calc(var(--depth, 0) * var(--inplug-space-4, 16px));
  border-radius: var(--inplug-radius-sm, 10px);
}

.tree-row:hover {
  background: color-mix(in srgb, var(--viewer-text) 6%, transparent);
}

.tree-row.is-selected {
  background: color-mix(in srgb, var(--viewer-accent) 24%, transparent);
}

.tree-toggle,
.tree-remove {
  flex: none;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: var(--inplug-radius-sm, 10px);
  background: transparent;
  color: var(--viewer-muted);
  cursor: pointer;
}

.tree-toggle[disabled] {
  visibility: hidden;
}

.tree-toggle::before,
.viewer-sets-chevron {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
}

.tree-toggle[aria-expanded="true"]::before,
.viewer-sets-toggle[aria-expanded="true"] .viewer-sets-chevron {
  transform: rotate(45deg);
}

.tree-label {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: var(--inplug-space-2, 8px);
  min-height: 32px;
  padding: 0 var(--inplug-space-1, 4px);
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

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

.tree-count {
  flex: none;
  color: var(--viewer-muted);
  font-size: 0.85rem;
}

.tree-remove svg {
  width: 16px;
  height: 16px;
}

.tree-remove:hover {
  color: var(--viewer-danger);
}

.tree-row[data-kind="model"] .tree-label-text,
.tree-row[data-kind="project"] .tree-label-text {
  font-weight: 700;
}

.tree-row[data-visibility="hidden"] .tree-label {
  opacity: 0.45;
}

.tree-toggle:focus-visible,
.tree-remove:focus-visible,
.tree-label:focus-visible,
.viewer-check input:focus-visible,
.viewer-range:focus-visible {
  outline: 3px solid var(--viewer-accent);
  outline-offset: 1px;
}

.viewer-section {
  position: absolute;
  top: calc(var(--viewer-cube-size) + 36px + var(--inplug-space-2, 8px) * 2 + var(--inplug-space-1, 4px));
  right: var(--inplug-space-4, 16px);
  z-index: 4;
  width: min(320px, calc(100% - 2 * var(--inplug-space-4, 16px)));
  padding: var(--inplug-space-4, 16px);
  border: 1px solid var(--viewer-line);
  border-radius: var(--inplug-radius-md, 16px);
  background: var(--viewer-surface);
  box-shadow: var(--inplug-elev-1, 0 8px 24px rgba(0, 0, 0, 0.18));
}

.viewer-section[hidden] {
  display: none;
}

.viewer-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--inplug-space-3, 12px);
  margin-bottom: var(--inplug-space-3, 12px);
}

.viewer-section-head h2 {
  margin: 0;
  font-family: var(--inplug-font-display, "Onest", sans-serif);
  font-size: 1.1rem;
}

.viewer-section-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: var(--inplug-space-2, 8px) var(--inplug-space-3, 12px);
  padding: var(--inplug-space-3, 12px) 0;
  border-top: 1px solid var(--viewer-line);
}

.viewer-check {
  display: flex;
  align-items: center;
  gap: var(--inplug-space-2, 8px);
  cursor: pointer;
}

.viewer-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--viewer-accent);
}

.viewer-range {
  grid-column: 1 / -1;
  width: 100%;
  accent-color: var(--viewer-accent);
}

.viewer-range:disabled {
  opacity: 0.45;
}

.viewer-panel h2 {
  margin: 0 0 var(--inplug-space-3, 12px);
  font-family: var(--inplug-font-display, "Onest", sans-serif);
  font-size: var(--inplug-text-title, 1.35rem);
}

.viewer-empty {
  margin: 0;
  color: var(--viewer-muted);
}

.viewer-type {
  margin: 0 0 var(--inplug-space-3, 12px);
  font-weight: 700;
}

.viewer-panel h3 {
  margin: var(--inplug-space-5, 24px) 0 var(--inplug-space-2, 8px);
  font-size: 1rem;
}

.viewer-panel dl {
  display: grid;
  grid-template-columns: minmax(7rem, 0.8fr) 1.2fr;
  gap: var(--inplug-space-2, 8px) var(--inplug-space-3, 12px);
  margin: 0;
}

.viewer-panel dt {
  color: var(--viewer-muted);
  overflow-wrap: anywhere;
}

.viewer-panel dd {
  margin: 0;
  overflow-wrap: break-word;
}

.rv-head {
  margin-bottom: var(--inplug-space-3, 12px);
}

.rv-head p {
  margin: 0;
}

.rv-head .viewer-type {
  margin-bottom: var(--inplug-space-1, 4px);
  color: var(--viewer-muted);
  font-weight: 400;
}

.rv-family {
  font-weight: 700;
}

.rv-type-name {
  overflow-wrap: anywhere;
}

.rv-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--inplug-space-2, 8px);
  margin-bottom: var(--inplug-space-3, 12px);
}

.rv-tabs {
  display: flex;
  gap: var(--inplug-space-1, 4px);
}

.rv-tab {
  min-height: 36px;
  padding: 0 var(--inplug-space-3, 12px);
  border: 1px solid var(--viewer-line);
  border-radius: var(--inplug-radius-sm, 10px);
  background: transparent;
  color: var(--viewer-text);
  font: inherit;
  cursor: pointer;
}

.rv-tab[aria-pressed="true"] {
  border-color: var(--viewer-accent);
  box-shadow: inset 0 0 0 1px var(--viewer-accent);
  color: var(--viewer-text);
}

.rv-tab:focus-visible,
.rv-group-toggle:focus-visible {
  outline: 3px solid var(--viewer-accent);
  outline-offset: 2px;
}

.rv-group {
  border: 1px solid var(--viewer-line);
  border-top: 0;
}

.rv-bar + .rv-group {
  border-top: 1px solid var(--viewer-line);
}

.viewer-panel h3.rv-group-title {
  margin: 0;
  font-size: 1rem;
}

.rv-group-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 36px;
  padding: 0 var(--inplug-space-3, 12px);
  border: 0;
  background: color-mix(in srgb, var(--viewer-text) 10%, var(--viewer-surface));
  color: var(--viewer-text);
  font: inherit;
  font-weight: 700;
  text-align: start;
  cursor: pointer;
}

.rv-chevron {
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-135deg) translate(-2px, -2px);
}

.rv-group-toggle[aria-expanded="false"] .rv-chevron {
  transform: rotate(45deg) translate(-2px, -2px);
}

.rv-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.rv-table[hidden] {
  display: none;
}

.rv-table th,
.rv-table td {
  padding: var(--inplug-space-1, 4px) var(--inplug-space-3, 12px);
  border-top: 1px dotted var(--viewer-line);
  text-align: start;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.rv-table th {
  width: 50%;
  border-right: 1px dotted var(--viewer-line);
  font-weight: 400;
}

.rv-table tr:first-child th,
.rv-table tr:first-child td {
  border-top: 0;
}

.rv-readonly th,
.rv-readonly td {
  color: var(--viewer-muted);
}

.rv-table input[type="checkbox"] {
  margin: 0;
  accent-color: var(--viewer-accent);
}

.viewer-splitter {
  position: relative;
  flex: none;
  width: 8px;
  margin-inline: -4px;
  z-index: 2;
  cursor: col-resize;
  touch-action: none;
}

.viewer-splitter::after {
  content: "";
  position: absolute;
  inset-block: 0;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  background: transparent;
}

.viewer-splitter:hover::after,
.viewer-splitter.is-dragging::after,
.viewer-splitter:focus-visible::after {
  background: var(--viewer-accent);
}

.viewer-splitter:focus-visible {
  outline: none;
}

.viewer-marquee {
  position: absolute;
  z-index: 3;
  border: 1px solid var(--viewer-accent);
  background: color-mix(in srgb, var(--viewer-accent) 14%, transparent);
  pointer-events: none;
}

.viewer-marquee[hidden] {
  display: none;
}

.viewer-marquee.is-crossing {
  border-style: dashed;
}

.viewer-file {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

@media (max-width: 800px) {
  .viewer-tab {
    padding-inline: var(--inplug-space-3, 12px);
  }


  .viewer-bar {
    flex-wrap: wrap;
    height: auto;
  }

  .viewer-body {
    flex-direction: column;
    overflow: auto;
  }

  .viewer-stage {
    flex: none;
    order: 1;
    height: 52vh;
    min-height: 52vh;
  }

  .viewer-stage {
    --viewer-cube-size: 104px;
    display: flex;
    flex-direction: column;
  }

  .viewer-cube {
    top: auto;
    bottom: var(--inplug-space-2, 8px);
  }

  .viewer-stage canvas {
    flex: 1 1 0;
    min-height: 0;
    height: auto;
  }

  .viewer-stage:has(.viewer-section:not([hidden])) {
    height: 82vh;
    min-height: 82vh;
  }

  .viewer-section {
    position: relative;
    order: -1;
    width: auto;
    padding: var(--inplug-space-3, 12px) var(--inplug-space-4, 16px);
    border-width: 0 0 1px;
    border-radius: 0;
    box-shadow: none;
  }

  .viewer-section-row {
    padding: var(--inplug-space-2, 8px) 0;
  }

  .viewer-splitter {
    width: auto;
    height: 12px;
    margin: -6px 0;
    cursor: row-resize;
  }

  .viewer-splitter::after {
    inset-block: auto;
    inset-inline: 0;
    top: 50%;
    left: 0;
    width: auto;
    height: 2px;
    transform: translateY(-50%);
  }

  .viewer-splitter[data-splitter="tree"] {
    order: 2;
  }

  .viewer-tree-panel {
    order: 3;
  }

  .viewer-splitter[data-splitter="props"] {
    order: 4;
  }

  .viewer-panel {
    order: 5;
  }

  .viewer-tree-panel,
  .viewer-panel {
    flex: none;
    width: 100%;
    max-height: none;
    height: var(--viewer-panel-height, 42vh);
    border-left: 0;
    border-right: 0;
    border-top: 1px solid var(--viewer-line);
  }

  .viewer-tree-panel {
    --viewer-panel-height: var(--viewer-tree-height, 42vh);
  }

  .viewer-panel {
    --viewer-panel-height: var(--viewer-props-height, 42vh);
  }
}

@media (min-width: 801px) and (max-width: 1100px) {
  .viewer-tree-panel {
    width: var(--viewer-tree-width, 240px);
  }

  .viewer-panel {
    width: var(--viewer-props-width, 280px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .viewer-button {
    transition: none;
  }
}


.viewer-measure {
  position: absolute;
  inset: 0;
  z-index: 2;
  overflow: hidden;
  pointer-events: none;
}

.viewer-measure-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.viewer-measure-svg line,
.viewer-measure-svg polyline,
.viewer-measure-svg polygon,
.viewer-measure-svg path {
  fill: none;
  stroke: var(--viewer-text);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.viewer-measure-svg .viewer-measure-fill {
  fill: color-mix(in srgb, var(--viewer-accent) 28%, transparent);
}

.viewer-measure-svg circle {
  fill: var(--viewer-accent);
  stroke: var(--viewer-text);
  stroke-width: 2;
}

.viewer-measure-svg .is-preview {
  stroke-dasharray: 5 4;
}

.viewer-measure-svg circle.is-preview {
  stroke-dasharray: none;
  fill: var(--viewer-surface);
}

.viewer-measure-label {
  position: absolute;
  padding: 1px var(--inplug-space-2, 8px);
  border: 1px solid var(--viewer-line);
  border-radius: var(--inplug-radius-sm, 10px);
  background: var(--viewer-surface);
  color: var(--viewer-text);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  transform: translate(-50%, -50%);
}

.viewer-measure-label.is-preview {
  border-style: dashed;
}

.viewer-snap {
  position: absolute;
  z-index: 3;
  width: 14px;
  height: 14px;
  border: 2px solid var(--viewer-text);
  background: var(--viewer-accent);
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.viewer-snap[hidden] {
  display: none;
}

.viewer-snap.is-edge {
  transform: translate(-50%, -50%) rotate(45deg);
}

.viewer-snap.is-face {
  width: 8px;
  height: 8px;
  border-radius: var(--inplug-radius-pill, 999px);
  background: var(--viewer-surface);
}

.viewer-stage.is-measuring canvas,
.viewer-stage.is-remarking canvas,
.viewer-stage.is-flying canvas {
  cursor: crosshair;
}

.viewer-measure-panel {
  position: absolute;
  top: var(--inplug-space-2, 8px);
  left: var(--inplug-space-2, 8px);
  z-index: 3;
  display: flex;
  flex-direction: column;
  width: min(280px, calc(100% - var(--viewer-cube-size) - 3 * var(--inplug-space-2, 8px)));
  max-height: calc(100% - 2 * var(--inplug-space-2, 8px));
  border: 1px solid var(--viewer-line);
  border-radius: var(--inplug-radius-md, 16px);
  background: var(--viewer-surface);
  box-shadow: var(--inplug-elev-1, 0 8px 24px rgba(0, 0, 0, 0.18));
}

.viewer-measure-panel[hidden] {
  display: none;
}

.viewer-measure-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--inplug-space-2, 8px);
  padding: var(--inplug-space-2, 8px) var(--inplug-space-3, 12px);
  border-bottom: 1px solid var(--viewer-line);
}

.viewer-measure-panel-head h2 {
  margin: 0;
  font-size: 1rem;
}

.viewer-measure-list {
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.viewer-measure-item {
  padding: var(--inplug-space-2, 8px) var(--inplug-space-3, 12px);
  border-bottom: 1px solid var(--viewer-line);
}

.viewer-measure-item:last-child {
  border-bottom: 0;
}

.viewer-measure-head {
  display: flex;
  align-items: center;
  gap: var(--inplug-space-2, 8px);
}

.viewer-measure-head span {
  flex: 1;
  min-width: 0;
  color: var(--viewer-muted);
}

.viewer-measure-head strong {
  font-variant-numeric: tabular-nums;
}

.viewer-measure-remove {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--inplug-radius-sm, 10px);
  background: transparent;
  color: var(--viewer-muted);
  cursor: pointer;
}

.viewer-measure-remove svg {
  width: 16px;
  height: 16px;
}

.viewer-measure-remove:hover {
  border-color: var(--viewer-line);
  color: var(--viewer-text);
}

.viewer-measure-remove:focus-visible {
  outline: 3px solid var(--viewer-accent);
  outline-offset: 1px;
}

.viewer-measure-item dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0 var(--inplug-space-3, 12px);
  margin: var(--inplug-space-1, 4px) 0 0;
  font-size: 0.85rem;
}

.viewer-measure-item dt {
  color: var(--viewer-muted);
}

.viewer-measure-item dd {
  margin: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 800px) {
  .viewer-measure-panel {
    top: auto;
    bottom: var(--inplug-space-2, 8px);
    max-height: 40%;
  }

  .viewer-measure-item dl {
    display: none;
  }
}

.viewer-section {
  max-height: calc(100% - var(--viewer-cube-size) - 36px - var(--inplug-space-2, 8px) * 3 - var(--inplug-space-1, 4px) - var(--inplug-space-4, 16px));
  overflow-y: auto;
}

.viewer-section-actions {
  display: flex;
  flex-wrap: wrap;
  grid-column: 1 / -1;
  gap: var(--inplug-space-2, 8px);
}

.viewer-remark-layer {
  position: absolute;
  inset: 0;
  z-index: 3;
  overflow: hidden;
  pointer-events: none;
}

.viewer-remark-pin {
  position: absolute;
  width: 16px;
  height: 16px;
  padding: 0;
  border: 2px solid var(--viewer-text);
  border-radius: var(--inplug-radius-pill, 999px);
  background: var(--viewer-accent);
  pointer-events: auto;
  cursor: pointer;
  transform: translate(-50%, -100%);
}

.viewer-remark-pin::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 2px;
  height: 6px;
  background: var(--viewer-text);
  transform: translateX(-50%);
}

.viewer-remark-pin.is-progress {
  background: color-mix(in srgb, var(--viewer-accent) 40%, var(--viewer-text));
}

.viewer-remark-pin.is-fixed {
  background: var(--viewer-surface);
}

.viewer-remark-pin.is-closed {
  background: var(--viewer-line);
}

.viewer-remark-pin.is-selected,
.viewer-remark-pin:focus-visible {
  outline: 3px solid var(--viewer-accent);
  outline-offset: 1px;
}

.viewer-remark-form,
.viewer-remark-detail {
  display: flex;
  flex-direction: column;
  gap: var(--inplug-space-2, 8px);
  margin-bottom: var(--inplug-space-3, 12px);
}

.viewer-remark-form[hidden],
.viewer-remark-detail[hidden],
.viewer-remark-filters[hidden],
.viewer-remark-field[hidden],
.viewer-remark-meta[hidden],
.viewer-input[hidden],
.viewer-remark-create[hidden],
.viewer-remark-browse[hidden],
.viewer-remark-list[hidden] {
  display: none;
}

#remarksPanel .viewer-section-head {
  margin-bottom: var(--inplug-space-2, 8px);
}

@media (min-width: 801px) {
  #remarksPanel {
    width: min(480px, calc(100% - 2 * var(--inplug-space-4, 16px)));
  }
}

.viewer-remark-modes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--inplug-space-2, 8px);
  margin-bottom: var(--inplug-space-3, 12px);
}

.viewer-remark-modes .viewer-button {
  width: 100%;
}

.viewer-remark-filter-disclosure {
  margin-bottom: var(--inplug-space-2, 8px);
}

.viewer-remark-filter-disclosure summary {
  cursor: pointer;
  color: var(--viewer-muted);
}

.viewer-remark-filter-disclosure[open] summary {
  margin-bottom: var(--inplug-space-2, 8px);
}

.viewer-remark-number {
  flex: none;
  min-width: 2.25rem;
  color: var(--viewer-muted);
  font-variant-numeric: tabular-nums;
}

.viewer-remark-window-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--inplug-space-2, 8px);
}

.viewer-remark-field {
  display: flex;
  flex-direction: column;
  gap: var(--inplug-space-1, 4px);
  color: var(--viewer-muted);
  font-size: 0.85rem;
}

textarea.viewer-input {
  min-height: 4.5rem;
  padding: var(--inplug-space-2, 8px) var(--inplug-space-3, 12px);
  resize: vertical;
}

.viewer-remark-text {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.viewer-remark-meta {
  margin: 0;
  color: var(--viewer-muted);
  font-size: 0.85rem;
}

.viewer-remark-comments {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--inplug-space-2, 8px);
}

.viewer-remark-comment {
  padding-top: var(--inplug-space-2, 8px);
  border-top: 1px solid var(--viewer-line);
}

.viewer-remark-dot {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: var(--inplug-radius-pill, 999px);
  background: var(--viewer-accent);
}

.viewer-remark-dot.is-progress {
  background: color-mix(in srgb, var(--viewer-accent) 40%, var(--viewer-text));
}

.viewer-remark-dot.is-fixed {
  background: var(--viewer-surface);
  box-shadow: inset 0 0 0 2px var(--viewer-text);
}

.viewer-remark-dot.is-closed {
  background: var(--viewer-line);
}

.viewer-remark-grid,
.viewer-remark-filters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--inplug-space-2, 8px);
}

.viewer-remark-filters .viewer-check {
  grid-column: 1 / -1;
}

.viewer-remark-line {
  margin: 0;
  color: var(--viewer-muted);
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-set-apply:has(.viewer-remark-line) {
  flex-direction: column;
  align-items: stretch;
  padding-top: var(--inplug-space-1, 4px);
  padding-bottom: var(--inplug-space-1, 4px);
}

.viewer-remark-apply-row {
  display: flex;
  align-items: center;
  gap: var(--inplug-space-2, 8px);
  min-width: 0;
}

.viewer-remark-line.is-overdue,
.viewer-set.is-critical .viewer-remark-priority {
  color: var(--viewer-danger);
}

.viewer-remark-views {
  display: flex;
  gap: var(--inplug-space-2, 8px);
  overflow-x: auto;
}

.viewer-remark-shot {
  position: relative;
  flex: none;
}

.viewer-remark-shot-open {
  display: block;
  padding: 0;
  border: 1px solid var(--viewer-line);
  border-radius: var(--inplug-radius-sm, 10px);
  background: var(--viewer-bg);
  cursor: pointer;
}

.viewer-remark-shot.is-active .viewer-remark-shot-open {
  outline: 3px solid var(--viewer-accent);
  outline-offset: 1px;
}

.viewer-remark-shot-open img,
.viewer-remark-shot-fallback {
  display: block;
  width: 4.5rem;
  height: 3rem;
  object-fit: cover;
  border-radius: inherit;
}

.viewer-remark-shot-fallback {
  background: var(--viewer-bg);
}

.viewer-remark-shot-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: var(--inplug-radius-pill, 999px);
  background: var(--viewer-surface);
  color: var(--viewer-text);
  cursor: pointer;
}

.viewer-remark-shot-remove svg {
  width: 12px;
  height: 12px;
}

.viewer-remark-comment-jump {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.viewer-remark-comment-jump:focus-visible,
.viewer-remark-shot-open:focus-visible,
.viewer-remark-shot-remove:focus-visible {
  outline: 3px solid var(--viewer-accent);
  outline-offset: 1px;
}

.viewer-views-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--inplug-space-1, 4px);
}

.viewer-view-apply {
  justify-content: flex-start;
  padding: var(--inplug-space-1, 4px) var(--inplug-space-2, 8px);
}

.viewer-view-thumb {
  flex: none;
  width: 4rem;
  height: 2.5rem;
  object-fit: cover;
  border-radius: var(--inplug-radius-sm, 10px);
  background: var(--viewer-bg);
}

.viewer-section-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.viewer-section-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.viewer-section-svg line {
  stroke: var(--viewer-text);
  stroke-width: 1.5;
  stroke-dasharray: 6 4;
}

.viewer-section-handle {
  position: absolute;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 2px solid var(--viewer-text);
  border-radius: var(--inplug-radius-pill, 999px);
  background: var(--viewer-accent);
  color: var(--viewer-accent-ink);
  cursor: grab;
  pointer-events: auto;
  touch-action: none;
  transform: translate(-50%, -50%);
}

.viewer-section-handle[hidden] {
  display: none;
}

.viewer-section-handle:active {
  cursor: grabbing;
}

.viewer-section-handle:focus-visible {
  outline: 3px solid var(--viewer-text);
  outline-offset: 2px;
}

.viewer-section-handle svg {
  width: 16px;
  height: 16px;
}

@media (max-width: 800px) {
  .viewer-section {
    max-height: 40vh;
  }
}

.viewer-load {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 4;
  display: grid;
  gap: var(--inplug-space-2, 8px);
  width: min(360px, calc(100% - 2 * var(--inplug-space-4, 16px)));
  padding: var(--inplug-space-4, 16px);
  transform: translate(-50%, -50%);
  border: 1px solid var(--viewer-line);
  border-radius: var(--inplug-radius-md, 16px);
  background: var(--viewer-surface);
  box-shadow: var(--inplug-elev-1, 0 8px 24px rgba(0, 0, 0, 0.18));
}

.viewer-load[hidden] {
  display: none;
}

.viewer-load.is-docked {
  top: auto;
  /* Above the toolbar (16px from the bottom, its height measured by toolbar.js). */
  bottom: calc(var(--viewer-toolbar-space, 56px) + 28px);
  transform: translateX(-50%);
}

.viewer-load-head,
.viewer-load-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--inplug-space-3, 12px);
  min-width: 0;
}

.viewer-load-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-load-count,
.viewer-load-percent {
  flex: none;
  color: var(--viewer-muted);
  font-variant-numeric: tabular-nums;
}

.viewer-load-step {
  margin: 0;
  color: var(--viewer-muted);
}

.viewer-load-bar {
  width: 100%;
  height: var(--inplug-space-2, 8px);
  appearance: none;
  border: 0;
  border-radius: var(--inplug-radius-pill, 999px);
  background: var(--viewer-line);
  overflow: hidden;
}

.viewer-load-bar::-webkit-progress-bar {
  background: var(--viewer-line);
}

.viewer-load-bar::-webkit-progress-value {
  background: var(--viewer-accent);
}

.viewer-load-bar::-moz-progress-bar {
  background: var(--viewer-accent);
}

@media (prefers-reduced-motion: no-preference) {
  .viewer-load-bar::-webkit-progress-value {
    transition: width 120ms linear;
  }
}

.viewer-tree-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.viewer-tree-panel > .viewer-tree {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.viewer-input {
  width: 100%;
  min-height: 38px;
  padding: 0 var(--inplug-space-3, 12px);
  border: 1px solid var(--viewer-line);
  border-radius: var(--inplug-radius-sm, 10px);
  background: var(--viewer-surface);
  color: var(--viewer-text);
}

.viewer-input:focus-visible {
  outline: 3px solid var(--viewer-accent);
  outline-offset: 1px;
}

.viewer-input:disabled {
  opacity: 0.55;
}

.viewer-search {
  display: grid;
  gap: var(--inplug-space-2, 8px);
  margin: 0 var(--inplug-space-2, 8px) var(--inplug-space-3, 12px);
}

.viewer-search-result {
  display: grid;
  gap: var(--inplug-space-2, 8px);
}

.viewer-search-result[hidden] {
  display: none;
}

.viewer-search-count {
  color: var(--viewer-muted);
  font-size: 0.9rem;
}

.viewer-search-actions,
.viewer-sets-foot,
.viewer-set-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--inplug-space-2, 8px);
}

.viewer-sets {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: var(--inplug-space-2, 8px);
  margin: var(--inplug-space-3, 12px) var(--inplug-space-2, 8px) 0;
  padding-top: var(--inplug-space-3, 12px);
  border-top: 1px solid var(--viewer-line);
}

.viewer-sets.is-open {
  max-height: 45%;
  overflow-y: auto;
}

.viewer-sets-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--inplug-space-2, 8px);
}

.viewer-sets-toggle {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: var(--inplug-space-2, 8px);
  min-height: 32px;
  padding: 0;
  border: 0;
  border-radius: var(--inplug-radius-sm, 10px);
  background: transparent;
  color: var(--viewer-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.viewer-sets-toggle:hover {
  background: color-mix(in srgb, var(--viewer-text) 6%, transparent);
}

.viewer-sets-toggle:focus-visible {
  outline: 3px solid var(--viewer-accent);
  outline-offset: 1px;
}

.viewer-sets-chevron {
  flex: none;
  display: block;
  color: var(--viewer-muted);
}

#setsTitle {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--inplug-font-display, "Onest", sans-serif);
  font-size: var(--inplug-text-body, 1.0625rem);
}

.viewer-sets-body {
  display: flex;
  flex-direction: column;
  gap: var(--inplug-space-2, 8px);
}

.viewer-sets-body[hidden] {
  display: none;
}

.viewer-set-form {
  display: grid;
  gap: var(--inplug-space-2, 8px);
}

.viewer-set-form[hidden] {
  display: none;
}

.viewer-set-hint {
  margin: 0;
  color: var(--viewer-muted);
  font-size: 0.9rem;
}

.viewer-set-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.viewer-set {
  display: flex;
  align-items: center;
  gap: var(--inplug-space-1, 4px);
}

.viewer-set-apply {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--inplug-space-2, 8px);
  min-height: 34px;
  padding: 0 var(--inplug-space-2, 8px);
  border: 1px solid transparent;
  border-radius: var(--inplug-radius-sm, 10px);
  background: transparent;
  color: var(--viewer-text);
  text-align: left;
  cursor: pointer;
}

.viewer-set.is-selected .viewer-set-apply {
  background: color-mix(in srgb, var(--viewer-accent) 24%, transparent);
}

.viewer-set-actions[hidden] {
  display: none;
}

.viewer-set-apply:hover,
.viewer-set-icon:hover {
  border-color: var(--viewer-line);
  background: color-mix(in srgb, var(--viewer-text) 6%, transparent);
}

.viewer-set-apply:focus-visible,
.viewer-set-icon:focus-visible {
  outline: 3px solid var(--viewer-accent);
  outline-offset: 1px;
}

.viewer-set-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-set-meta {
  flex: none;
  color: var(--viewer-muted);
  font-size: 0.85rem;
}

.viewer-set-icon {
  flex: none;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--inplug-radius-sm, 10px);
  background: transparent;
  color: var(--viewer-muted);
  cursor: pointer;
}

.viewer-set-icon svg {
  width: 16px;
  height: 16px;
}

.viewer-menu {
  position: fixed;
  z-index: 10;
  display: grid;
  min-width: 220px;
  max-width: calc(100vw - 2 * var(--inplug-space-2, 8px));
  padding: var(--inplug-space-1, 4px);
  border: 1px solid var(--viewer-line);
  border-radius: var(--inplug-radius-md, 16px);
  background: var(--viewer-surface);
  box-shadow: var(--inplug-elev-1, 0 8px 24px rgba(0, 0, 0, 0.18));
}

.viewer-menu[hidden] {
  display: none;
}

.viewer-menu--scroll {
  grid-template-columns: minmax(0, 1fr);
  max-height: 70vh;
  overflow: auto;
}

.viewer-menu--scroll .viewer-menu-item {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-menu .viewer-empty {
  padding: var(--inplug-space-2, 8px) var(--inplug-space-3, 12px);
}

.viewer-menu-item[aria-checked="true"] {
  box-shadow: inset 0 0 0 1px var(--viewer-accent);
}

.viewer-menu-item {
  min-height: 38px;
  padding: 0 var(--inplug-space-3, 12px);
  border: 0;
  border-radius: var(--inplug-radius-sm, 10px);
  background: transparent;
  color: var(--viewer-text);
  text-align: left;
  cursor: pointer;
}

.viewer-menu-item:hover {
  background: color-mix(in srgb, var(--viewer-text) 6%, transparent);
}

.viewer-menu-item:focus-visible {
  outline: 3px solid var(--viewer-accent);
  outline-offset: -3px;
}

@media (max-width: 800px) {
  .viewer-tree-panel {
    display: block;
    overflow: auto;
  }

  .viewer-tree-panel > .viewer-tree {
    overflow: visible;
  }

  .viewer-sets,
  .viewer-sets.is-open {
    max-height: none;
    overflow-y: visible;
  }
}

.viewer-search-actions .viewer-button--small {
  flex: 1;
  padding-inline: var(--inplug-space-2, 8px);
}

.viewer-search-toggle {
  justify-self: start;
}

.viewer-prop-panel {
  display: grid;
  gap: var(--inplug-space-2, 8px);
  justify-items: start;
}

.viewer-prop-panel[hidden],
.viewer-index[hidden] {
  display: none;
}

.viewer-prop-rows {
  display: grid;
  gap: var(--inplug-space-2, 8px);
  width: 100%;
}

.viewer-prop-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: var(--inplug-space-1, 4px);
  align-items: center;
}

.viewer-prop-row .viewer-prop-key {
  grid-column: 1 / -1;
}

.viewer-prop-row select.viewer-input {
  width: auto;
  padding-inline: var(--inplug-space-2, 8px);
}

.viewer-index {
  display: grid;
  gap: var(--inplug-space-2, 8px);
}

/* Fly-over recorder for the website video (?flyover) */
.viewer-flyover {
  position: absolute;
  top: var(--inplug-space-2, 8px);
  left: var(--inplug-space-2, 8px);
  z-index: 6;
  display: grid;
  gap: 10px;
  width: 260px;
  padding: 14px;
  border: 1px solid var(--viewer-line);
  border-radius: 14px;
  background: var(--viewer-surface);
  color: var(--viewer-text);
  box-shadow: 0 12px 30px rgba(17, 24, 21, 0.14);
}

.viewer-flyover.is-running {
  opacity: 0.35;
  pointer-events: none;
}

.viewer-flyover-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.viewer-flyover-field {
  display: grid;
  gap: 4px;
  font-size: 13px;
  color: var(--viewer-muted);
}

.viewer-flyover-field select {
  min-height: 34px;
  border: 1px solid var(--viewer-line);
  border-radius: 8px;
  background: var(--viewer-surface);
  color: var(--viewer-text);
  font: inherit;
  font-size: 14px;
}

.viewer-flyover-actions {
  display: flex;
  gap: 8px;
}

.viewer-flyover-button {
  flex: 1;
  min-height: 38px;
  border: 1px solid var(--viewer-line);
  border-radius: 10px;
  background: var(--viewer-surface);
  color: var(--viewer-text);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.viewer-flyover-button.is-primary {
  border-color: transparent;
  background: var(--viewer-accent);
  color: var(--viewer-accent-ink);
}

.viewer-flyover-status {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--viewer-muted);
}

.viewer-stage.is-flyover > :not(canvas):not(.viewer-flyover) {
  visibility: hidden;
}

/* «Проекты»: the dialog that leads into shared cloud projects. */
.viewer-cloud-dialog {
  width: min(480px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: var(--inplug-space-4, 16px);
  border: 1px solid var(--viewer-line);
  border-radius: var(--inplug-radius-md, 14px);
  background: var(--viewer-surface);
  color: var(--viewer-text);
  box-shadow: 0 24px 64px rgba(17, 24, 21, 0.24);
}

.viewer-cloud-dialog::backdrop {
  background: rgba(17, 24, 21, 0.4);
}

.viewer-cloud-dialog[open] {
  display: grid;
  gap: var(--inplug-space-3, 12px);
}

.viewer-cloud-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--inplug-space-2, 8px);
}

.viewer-cloud-dialog-head h2 {
  margin: 0;
  font-family: var(--inplug-font-display, "Onest", sans-serif);
  font-size: 1.2rem;
}

.viewer-cloud-dialog-note,
.viewer-cloud-dialog-message {
  margin: 0;
  color: var(--viewer-muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.viewer-cloud-dialog-message[data-tone="error"] {
  padding: var(--inplug-space-2, 8px) var(--inplug-space-3, 12px);
  border-radius: var(--inplug-radius-sm, 10px);
  background: var(--viewer-danger-bg);
  color: var(--viewer-danger);
}

.viewer-cloud-projects {
  display: grid;
  gap: var(--inplug-space-1, 4px);
  max-height: 40vh;
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}

.viewer-cloud-projects > li {
  display: flex;
  align-items: stretch;
  gap: var(--inplug-space-2, 8px);
}

.viewer-cloud-project-delete {
  flex: none;
}

.viewer-cloud-project-delete:hover,
.viewer-cloud-project-delete:focus-visible {
  border-color: var(--viewer-danger);
  color: var(--viewer-danger);
}

.viewer-cloud-project {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--inplug-space-3, 12px);
  padding: var(--inplug-space-2, 8px) var(--inplug-space-3, 12px);
  border: 1px solid var(--viewer-line);
  border-radius: var(--inplug-radius-sm, 10px);
  color: inherit;
  text-decoration: none;
}

.viewer-cloud-project:hover,
.viewer-cloud-project:focus-visible {
  border-color: var(--viewer-text);
}

.viewer-cloud-project[aria-current="page"] {
  background: var(--viewer-bg);
}

.viewer-cloud-project-name {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.viewer-cloud-project-role {
  flex: none;
  color: var(--viewer-muted);
  font-size: 0.85rem;
}

.viewer-cloud-form {
  display: grid;
  gap: var(--inplug-space-2, 8px);
  padding-top: var(--inplug-space-3, 12px);
  border-top: 1px solid var(--viewer-line);
}

.viewer-cloud-field {
  display: grid;
  gap: var(--inplug-space-1, 4px);
  font-weight: 600;
}

.viewer-cloud-carry {
  display: flex;
  align-items: center;
  gap: var(--inplug-space-2, 8px);
  font-size: 0.92rem;
}

.viewer-cloud-carry[hidden] {
  display: none;
}

.viewer-cloud-progress {
  display: grid;
  gap: var(--inplug-space-1, 4px);
}

.viewer-cloud-progress[hidden] {
  display: none;
}

/* ?timing: where opening the models spends its time. */
.viewer-timing {
  position: fixed;
  left: 16px;
  bottom: 56px;
  z-index: 50;
  max-width: min(960px, calc(100vw - 32px));
  max-height: 60vh;
  overflow: auto;
  padding: var(--inplug-space-3, 12px);
  border: 1px solid var(--viewer-line);
  border-radius: var(--inplug-radius-md, 14px);
  background: var(--viewer-surface);
  box-shadow: 0 16px 40px rgba(17, 24, 21, 0.18);
  font-size: 0.85rem;
}

.viewer-timing-head {
  display: flex;
  align-items: center;
  gap: var(--inplug-space-2, 8px);
  margin-bottom: var(--inplug-space-2, 8px);
}

.viewer-timing-head strong {
  margin-inline-end: auto;
}

.viewer-timing p {
  margin: 0 0 var(--inplug-space-2, 8px);
  color: var(--viewer-muted);
}

.viewer-timing table {
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.viewer-timing th,
.viewer-timing td {
  padding: 2px 10px 2px 0;
  text-align: left;
  white-space: nowrap;
  vertical-align: top;
}

.viewer-timing tr:first-child th {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.viewer-timing td {
  text-align: right;
}

/* «Коллизии»: a window docked under the model, as Clash Detective in Navisworks. Tests on the
   left, the selected test's «Выбор» and «Результаты» on the right. */
.viewer-clash-dock {
  position: relative;
  flex: none;
  display: flex;
  flex-direction: column;
  height: 40vh;
  min-height: 180px;
  border-top: 1px solid var(--viewer-line);
  background: var(--viewer-surface);
  font-size: 0.9rem;
}

.viewer-clash-dock[hidden] {
  display: none;
}

.viewer-clash-resize {
  position: absolute;
  inset: -4px 0 auto;
  height: 8px;
  cursor: ns-resize;
  z-index: 2;
}

.viewer-clash-resize:hover,
.viewer-clash-resize:focus-visible {
  outline: none;
  background: color-mix(in srgb, var(--viewer-accent) 55%, transparent);
}

.viewer-clash-head {
  display: flex;
  align-items: center;
  gap: var(--inplug-space-3, 12px);
  min-height: 36px;
  padding: 0 var(--inplug-space-2, 8px) 0 var(--inplug-space-4, 16px);
  border-bottom: 1px solid var(--viewer-line);
  background: var(--viewer-bg);
}

.viewer-clash-head h2 {
  margin: 0;
  font-size: 0.95rem;
}

.viewer-clash-summary {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--viewer-muted);
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-clash-head .viewer-close {
  margin-inline-start: auto;
}

.viewer-clash-progress {
  display: flex;
  align-items: center;
  gap: var(--inplug-space-2, 8px);
  padding: 4px var(--inplug-space-4, 16px);
  border-bottom: 1px solid var(--viewer-line);
}

.viewer-clash-progress[hidden] {
  display: none;
}

.viewer-clash-progress progress {
  flex: 1;
}

.viewer-clash-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(320px, 42%) minmax(0, 1fr);
}

.viewer-clash-tests-pane,
.viewer-clash-detail-pane {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.viewer-clash-tests-pane {
  border-inline-end: 1px solid var(--viewer-line);
}

.viewer-clash-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.viewer-clash-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--inplug-space-1, 4px);
  padding: 6px var(--inplug-space-2, 8px);
  border-top: 1px solid var(--viewer-line);
}

.viewer-clash-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.viewer-clash-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 4px 8px;
  border-bottom: 1px solid var(--viewer-line);
  background: var(--viewer-surface);
  color: var(--viewer-muted);
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}

.viewer-clash-table td {
  max-width: 260px;
  padding: 3px 8px;
  border-bottom: 1px solid color-mix(in srgb, var(--viewer-line) 55%, transparent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-clash-table th.viewer-clash-num,
.viewer-clash-table td.viewer-clash-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.viewer-clash-table tbody tr[tabindex] {
  cursor: pointer;
}

.viewer-clash-table tbody tr[tabindex]:hover {
  background: color-mix(in srgb, var(--viewer-text) 5%, transparent);
}

.viewer-clash-table tbody tr.is-selected {
  background: color-mix(in srgb, var(--viewer-accent) 22%, transparent);
}

.viewer-clash-table tbody tr:focus-visible {
  outline: 2px solid var(--viewer-accent);
  outline-offset: -2px;
}

.viewer-clash-name {
  font-weight: 600;
}

.viewer-clash-state[data-state="new"] {
  color: var(--viewer-muted);
}

.viewer-clash-state[data-state="old"] {
  color: #9a6700;
}

td.is-zero {
  color: color-mix(in srgb, var(--viewer-muted) 60%, transparent);
}

/* Status colours as in Clash Detective: new red, active orange, reviewed blue, approved green, resolved yellow-green. */
td[data-status="new"]:not(.is-zero),
.viewer-clash-status[data-status="new"] { color: #c62828; font-weight: 600; }
td[data-status="active"]:not(.is-zero),
.viewer-clash-status[data-status="active"] { color: #d9680f; font-weight: 600; }
td[data-status="reviewed"]:not(.is-zero),
.viewer-clash-status[data-status="reviewed"] { color: #1f6fd1; }
td[data-status="approved"]:not(.is-zero),
.viewer-clash-status[data-status="approved"] { color: #2e7d32; }
td[data-status="resolved"]:not(.is-zero),
.viewer-clash-status[data-status="resolved"] { color: #7a8c1f; }

.viewer-clash-folder td {
  padding: 4px 6px;
  background: var(--viewer-bg);
}

.viewer-clash-fold {
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: var(--viewer-text);
  font: inherit;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.viewer-clash-fold::before {
  content: "";
  flex: none;
  width: 0;
  height: 0;
  border-block: 4px solid transparent;
  border-inline-start: 6px solid currentColor;
  transition: transform 0.12s ease;
}

.viewer-clash-fold[aria-expanded="true"]::before {
  transform: rotate(90deg);
}

.viewer-clash-detail-pane > .viewer-empty {
  padding: var(--inplug-space-4, 16px);
}

.viewer-clash-detail {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.viewer-clash-detail[hidden],
.viewer-clash-select[hidden],
.viewer-clash-results[hidden] {
  display: none;
}

.viewer-clash-tabs {
  display: flex;
  gap: 2px;
  padding: 4px var(--inplug-space-3, 12px) 0;
  border-bottom: 1px solid var(--viewer-line);
  background: var(--viewer-bg);
}

.viewer-clash-select {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(180px, 220px);
  gap: var(--inplug-space-3, 12px);
  padding: var(--inplug-space-3, 12px);
  overflow: auto;
}

.viewer-clash-side {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.viewer-clash-side-title {
  font-weight: 600;
}

.viewer-clash-list {
  flex: 1;
  min-height: 120px;
  padding: 2px;
  font-size: 0.85rem;
}

.viewer-clash-settings {
  display: flex;
  flex-direction: column;
  gap: var(--inplug-space-2, 8px);
}

.viewer-clash-settings .viewer-remark-field[hidden] {
  display: none;
}

.viewer-clash-results {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.viewer-clash-results-head {
  display: flex;
  align-items: center;
  gap: var(--inplug-space-2, 8px);
  padding: 6px var(--inplug-space-3, 12px);
  border-bottom: 1px solid var(--viewer-line);
}

.viewer-clash-results-head select {
  width: auto;
  min-height: 30px;
  font-size: 0.85rem;
}

.viewer-clash-results-head .viewer-clash-summary {
  flex: 1;
}

.viewer-clash-results-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 28%);
}

.viewer-clash-report-form {
  display: grid;
  gap: var(--inplug-space-3, 12px);
}

.viewer-clash-report-form fieldset {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  border: 0;
}

.viewer-clash-report-form legend {
  margin-bottom: 4px;
  font-weight: 600;
}

.viewer-clash-report-statuses {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
}

.viewer-clash-scroll > .viewer-empty {
  margin: 0;
  padding: var(--inplug-space-3, 12px);
}

.viewer-clash-status {
  min-height: 24px;
  padding: 0 2px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}

.viewer-clash-status:hover,
.viewer-clash-status:focus-visible {
  border-color: var(--viewer-line);
}

.viewer-clash-date {
  color: var(--viewer-muted);
}

.viewer-clash-items {
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-content: start;
  gap: var(--inplug-space-2, 8px);
  padding: var(--inplug-space-2, 8px);
  border-inline-start: 1px solid var(--viewer-line);
  overflow: auto;
}

.viewer-clash-items > .viewer-clash-meta {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--viewer-muted);
}

.viewer-clash-card {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 4px;
}

.viewer-clash-card h3 {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 0.85rem;
}

.viewer-clash-work {
  grid-column: 1 / -1;
  display: grid;
  gap: 6px;
  padding-top: var(--inplug-space-2, 8px);
  border-top: 1px solid var(--viewer-line);
}

.viewer-clash-work h3 {
  margin: 4px 0 0;
  font-size: 0.85rem;
}

.viewer-clash-log {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.82rem;
}

.viewer-clash-log li {
  display: grid;
  gap: 1px;
  padding: 3px 6px;
  border-radius: 6px;
  background: var(--viewer-bg);
  overflow-wrap: anywhere;
}

.viewer-clash-log li[data-kind="status"],
.viewer-clash-log li[data-kind="assign"] {
  color: var(--viewer-muted);
  background: transparent;
}

.viewer-clash-log-meta {
  color: var(--viewer-muted);
  font-size: 0.75rem;
}

.viewer-clash-comment {
  display: grid;
  gap: 4px;
}

.viewer-clash-comment .viewer-button {
  justify-self: end;
}

.viewer-clash-group-bar {
  padding-block: 4px;
}

.viewer-clash-group-bar label.viewer-clash-summary {
  flex: none;
}

.viewer-clash-group-row td {
  background: color-mix(in srgb, var(--viewer-text) 4%, transparent);
  font-weight: 600;
}

.viewer-clash-group-row.is-selected td {
  background: color-mix(in srgb, var(--viewer-accent) 22%, transparent);
}

.viewer-clash-group-row .viewer-clash-fold {
  width: 20px;
  height: 20px;
  justify-content: center;
}

.viewer-clash-group-name {
  overflow: hidden;
  text-overflow: ellipsis;
}

.viewer-clash-table tbody tr.is-child td:first-child {
  padding-left: 22px;
}

.viewer-clash-table tbody tr.is-picked td {
  background: color-mix(in srgb, #1f6fd1 14%, transparent);
}

.viewer-clash-where {
  white-space: nowrap;
}

.viewer-clash-assignee {
  color: var(--viewer-muted);
}

.viewer-clash-swatch {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.viewer-clash-card dl {
  display: grid;
  gap: 1px;
  margin: 0;
  font-size: 0.8rem;
}

.viewer-clash-card dt {
  color: var(--viewer-muted);
}

.viewer-clash-card dd {
  margin: 0 0 3px;
  overflow-wrap: anywhere;
}

.viewer-clash-card .viewer-button {
  justify-self: start;
}

@media (max-width: 900px) {
  .viewer-clash-dock {
    height: 60vh;
  }

  .viewer-clash-body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(140px, 40%) minmax(0, 1fr);
  }

  .viewer-clash-tests-pane {
    border-inline-end: 0;
    border-bottom: 1px solid var(--viewer-line);
  }

  .viewer-clash-select,
  .viewer-clash-results-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .viewer-clash-items {
    border-inline-start: 0;
    border-top: 1px solid var(--viewer-line);
  }
}

/* ===================== BIM 360-style start page, breadcrumb, file versions ===================== */

/* Modes: home (projects list), project, local file */
.viewer-app[data-mode="home"] .viewer-body,
.viewer-app[data-mode="home"] .viewer-statusbar,
.viewer-app[data-mode="home"] #openButton,
.viewer-app[data-mode="home"] #cloudProjectsButton,
.viewer-app[data-mode="project"] #cloudProjectsButton { display: none; }
.viewer-app[data-mode="home"] { overflow: auto; }

.viewer-crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; padding-left: 16px; margin-left: 4px; border-left: 1px solid var(--viewer-line); font-size: 15px; }
.viewer-crumbs[hidden] { display: none; }
.viewer-crumb-link { color: var(--viewer-muted); text-decoration: none; }
.viewer-crumb-link:hover { color: var(--viewer-text); text-decoration: underline; }
.viewer-crumb-sep { color: var(--viewer-muted); }
.viewer-crumb-current { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 42vw; }

.viewer-home { flex: 1 1 auto; padding: 32px 24px 48px; }
.viewer-home[hidden] { display: none; }
.viewer-home-inner { max-width: 1080px; margin: 0 auto; display: grid; gap: 16px; }
.viewer-home-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.viewer-home-head h2 { margin: 0; font-family: var(--inplug-font-display, "Onest", sans-serif); font-size: 32px; }
.viewer-home-actions { display: flex; gap: 10px; align-items: center; }
.viewer-home-search { min-width: 260px; }
.viewer-home-search[hidden], .viewer-home-actions [hidden] { display: none; }
.viewer-home-form { display: flex; gap: 10px; flex-wrap: wrap; padding: 14px; border: 1px solid var(--viewer-line); border-radius: 12px; background: var(--viewer-surface); }
.viewer-home-form[hidden] { display: none; }
.viewer-home-form .viewer-input { flex: 1 1 320px; }
.viewer-home-message { margin: 0; color: var(--viewer-muted); }
.viewer-home-message[data-tone="error"] { color: var(--viewer-danger); }
.viewer-home-login { justify-self: start; display: inline-flex; align-items: center; text-decoration: none; }
.viewer-home-login[hidden] { display: none; }

.viewer-home-table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--viewer-surface); border: 1px solid var(--viewer-line); border-radius: 12px; overflow: hidden; }
.viewer-home-table[hidden] { display: none; }
.viewer-home-table th { text-align: left; font-size: 13px; font-weight: 600; color: var(--viewer-muted); padding: 12px 16px; border-bottom: 1px solid var(--viewer-line); background: color-mix(in srgb, var(--viewer-bg) 60%, var(--viewer-surface)); }
.viewer-home-table td { padding: 12px 16px; border-bottom: 1px solid color-mix(in srgb, var(--viewer-line) 55%, transparent); color: var(--viewer-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.viewer-home-table td:first-child { width: 55%; white-space: normal; }
.viewer-home-table tbody tr { cursor: pointer; }
.viewer-home-table tbody tr:last-child td { border-bottom: 0; }
.viewer-home-table tbody tr:hover td { background: color-mix(in srgb, var(--viewer-accent) 10%, var(--viewer-surface)); }
.viewer-home-project { display: inline-flex; align-items: center; gap: 12px; color: var(--viewer-text); font-weight: 600; text-decoration: none; }
.viewer-home-project:hover { text-decoration: underline; }
.viewer-home-row-actions { width: 1%; text-align: right; }
.viewer-home-delete { width: 32px; height: 32px; display: inline-grid; place-items: center; padding: 0; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--viewer-muted); cursor: pointer; opacity: 0.55; }
.viewer-home-delete svg { width: 18px; height: 18px; }
.viewer-home-table tbody tr:hover .viewer-home-delete, .viewer-home-delete:focus-visible { opacity: 1; }
.viewer-home-delete:hover { color: var(--viewer-danger); border-color: var(--viewer-line); background: var(--viewer-surface); }
.viewer-home-delete:focus-visible { outline: 3px solid var(--viewer-accent); outline-offset: 1px; }
.viewer-visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.viewer-home-local { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; border: 1px dashed var(--viewer-line); border-radius: 12px; }
.viewer-home-local div { display: grid; gap: 2px; }
.viewer-home-local span { color: var(--viewer-muted); font-size: 14px; }

/* Files of the project with version badges */
.viewer-cloud-files-title { margin: 14px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--viewer-muted); }
.viewer-cloud-files { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 2px; }
.viewer-cloud-file-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 0; }
.viewer-cloud-file-name { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-version-badge {
  flex: 0 0 auto; min-width: 34px; height: 22px; padding: 0 7px; border-radius: 6px;
  border: 1px solid var(--viewer-line); background: var(--viewer-surface); color: var(--viewer-text);
  font: inherit; font-size: 12px; font-weight: 700; cursor: pointer;
}
.viewer-version-badge:hover, .viewer-version-badge[aria-expanded="true"] { border-color: var(--viewer-accent); background: color-mix(in srgb, var(--viewer-accent) 18%, var(--viewer-surface)); }
.viewer-version-badge.is-old { border-color: #d97706; color: #92400e; background: #fef3c7; }
.viewer-version-list { list-style: none; margin: 2px 0 8px; padding: 6px 0 6px 10px; border-left: 2px solid var(--viewer-line); display: grid; gap: 6px; }
.viewer-version { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--viewer-muted); }
.viewer-version span { flex: 1 1 auto; }
.viewer-version em { font-style: normal; font-size: 12px; color: var(--viewer-text); font-weight: 600; }
.viewer-version-wait { font-size: 13px; color: var(--viewer-muted); }
.viewer-version-notice { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 8px 0; padding: 8px 10px; border-radius: 8px; background: #fef3c7; color: #78350f; font-size: 13px; }
.viewer-version-notice[hidden] { display: none; }

@media (max-width: 720px) {
  .viewer-crumbs { display: none; }
  .viewer-home-table th:nth-child(4), .viewer-home-table td:nth-child(4) { display: none; }
  .viewer-home-search { min-width: 0; flex: 1 1 auto; }
}
.viewer-cloud[hidden] { display: none; }
.viewer-home-actions .viewer-button { white-space: nowrap; }
.viewer-version { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.viewer-version em { justify-self: end; }

/* ===================== Model window as in BIM 360: bottom toolbar, panels on demand ===================== */

.viewer-toolbar {
  position: absolute; left: 12px; right: 12px; bottom: 16px; width: fit-content; margin: 0 auto; z-index: 6;
  display: flex; align-items: center; gap: 4px; padding: 4px;
  background: var(--viewer-surface); border: 1px solid var(--viewer-line); border-radius: 12px;
  box-shadow: 0 8px 28px rgba(17, 24, 21, 0.16);
  flex-wrap: wrap; justify-content: center;
}
.viewer-toolbar-group { display: flex; align-items: center; gap: 2px; }
.viewer-toolbar-group + .viewer-toolbar-group { padding-left: 4px; margin-left: 2px; border-left: 1px solid var(--viewer-line); }
.viewer-tool.viewer-tool--bar {
  width: 40px; height: 40px; min-width: 40px; min-height: 0; padding: 0;
  display: inline-grid; place-items: center; border: 0; border-radius: 8px;
  background: transparent; color: var(--viewer-text); flex-direction: row;
}
.viewer-tool.viewer-tool--bar svg { width: 21px; height: 21px; }
.viewer-tool.viewer-tool--bar .viewer-tool-label {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.viewer-tool.viewer-tool--bar:hover:not(:disabled) { background: color-mix(in srgb, var(--viewer-accent) 16%, var(--viewer-surface)); }
.viewer-tool.viewer-tool--bar:disabled { opacity: 0.35; cursor: default; }
.viewer-tool.viewer-tool--bar.is-active,
.viewer-tool.viewer-tool--bar[aria-pressed="true"]:not(#measureSnap),
.viewer-tool.viewer-tool--bar[aria-expanded="true"] {
  background: color-mix(in srgb, var(--viewer-accent) 34%, var(--viewer-surface));
  box-shadow: inset 0 -2px 0 var(--viewer-accent);
}

.viewer-toolbar-flyout-wrap { position: relative; display: inline-flex; }
.viewer-toolbar-flyout {
  position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%); z-index: 7;
  display: flex; gap: 2px; padding: 4px;
  background: var(--viewer-surface); border: 1px solid var(--viewer-line); border-radius: 10px;
  box-shadow: 0 8px 28px rgba(17, 24, 21, 0.16);
}
.viewer-toolbar-flyout[hidden] { display: none; }
#measureSnap.viewer-tool--bar { margin-left: 4px; border-left: 1px solid var(--viewer-line); border-radius: 0 8px 8px 0; }
#measureSnap.viewer-tool--bar[aria-pressed="true"] { color: #4f730c; }

/* Side panels open from the toolbar */
.viewer-body.is-tree-hidden #viewerTreePanel,
.viewer-body.is-tree-hidden [data-splitter="tree"],
.viewer-body.is-props-hidden #viewerPropsPanel,
.viewer-body.is-props-hidden [data-splitter="props"] { display: none; }

/* Panels inside the model keep clear of the toolbar */
.viewer-stage .viewer-section,
.viewer-stage .viewer-measure { margin-bottom: 72px; }
.viewer-tools-source[hidden] { display: none; }

/* Phones: the model takes the whole screen. One thin header row, the toolbar docked at the
   bottom (two rows of buttons), the model browser and the properties as sheets above it,
   one at a time. */
@media (max-width: 800px) {
  .viewer-app { height: 100dvh; min-height: 0; overflow: hidden; }
  .viewer-bar { flex-wrap: nowrap; min-height: 48px; padding: 6px 12px; gap: 10px; }
  .viewer-logo { --viewer-logo-height: 22px; }
  .viewer-crumbs { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 14px; }
  .viewer-crumb-link, .viewer-crumb-sep { display: none; }
  .viewer-actions .viewer-button { min-height: 36px; padding: 0 12px; font-size: 14px; white-space: nowrap; }
  .viewer-body { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
  .viewer-stage,
  .viewer-stage:has(.viewer-section:not([hidden])) { flex: 1 1 auto; order: 0; height: auto; min-height: 0; }
  .viewer-splitter { display: none !important; }
  .viewer-tree-panel,
  .viewer-panel {
    position: absolute; left: 0; right: 0; bottom: var(--viewer-toolbar-space, 104px); z-index: 8;
    height: min(55%, 520px); max-height: none; overflow: auto;
    background: var(--viewer-surface); border: 1px solid var(--viewer-line); border-radius: 16px 16px 0 0;
    box-shadow: 0 -10px 30px rgba(17, 24, 21, 0.18);
  }
  .viewer-toolbar {
    left: 0; right: 0; bottom: 0; width: auto; margin: 0; z-index: 9;
    border-radius: 14px 14px 0 0; border-bottom: 0;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px)); gap: 2px; justify-content: center;
  }
  .viewer-toolbar-group { display: contents; }
  .viewer-tool.viewer-tool--bar { width: 42px; height: 42px; min-width: 42px; }
  .viewer-stage { --viewer-cube-size: 84px; }
  .viewer-cube { top: 8px; bottom: auto; }
  .viewer-stage .viewer-section,
  .viewer-stage .viewer-measure { margin-bottom: 0; }
  .viewer-statusbar { min-height: 22px; font-size: 12px; }

  /* The projects page: each project a card, nothing wider than the screen. */
  .viewer-home { padding: 20px 16px 32px; }
  .viewer-home-head h2 { font-size: 26px; }
  .viewer-home-actions { width: 100%; }
  .viewer-home-actions .viewer-button { flex: 0 0 auto; }
  .viewer-home-table thead { display: none; }
  .viewer-home-table,
  .viewer-home-table tbody { display: block; }
  .viewer-home-table tr {
    display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "name name action" "models updated action";
    align-items: center; column-gap: 8px; padding: 12px 14px;
    border-bottom: 1px solid color-mix(in srgb, var(--viewer-line) 55%, transparent);
  }
  .viewer-home-table tbody tr:last-child { border-bottom: 0; }
  .viewer-home-table td { display: inline; padding: 0; border: 0; white-space: nowrap; font-size: 14px; }
  .viewer-home-table td:first-child { grid-area: name; width: auto; font-size: 16px; }
  .viewer-home-table td:nth-child(2) { grid-area: models; margin-right: 10px; }
  .viewer-home-table td:nth-child(3) { grid-area: updated; }
  .viewer-home-table th:nth-child(4), .viewer-home-table td:nth-child(4) { display: none; }
  .viewer-home-table td.viewer-home-row-actions { grid-area: action; width: auto; }
  .viewer-home-table tbody tr:hover td { background: transparent; }
  .viewer-home-delete { opacity: 1; width: 40px; height: 40px; }
  .viewer-home-local { flex-direction: column; align-items: stretch; }
}

/* Element card: a value that selects other elements (the wall of a door, a system). */
.rv-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--viewer-text);
  text-decoration-color: var(--viewer-accent);
  font: inherit;
  text-align: start;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  cursor: pointer;
  overflow-wrap: anywhere;
}

.rv-link:hover {
  text-decoration-thickness: 2px;
}

.rv-link:focus-visible {
  outline: 2px solid var(--viewer-accent);
  outline-offset: 2px;
}

/* Several elements: a property whose values differ. */
.rv-varies {
  color: var(--viewer-muted);
  font-style: italic;
}

/* Context menu of the model: actions with their shortcuts. */
.viewer-context-menu {
  z-index: 30;
  min-width: 260px;
}

.viewer-context-menu .viewer-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--inplug-space-4, 16px);
  min-height: 34px;
}

.viewer-context-menu .viewer-menu-item:disabled {
  color: var(--viewer-muted);
  cursor: default;
  opacity: 0.6;
}

.viewer-menu-hint {
  color: var(--viewer-muted);
  font-size: 0.85em;
  white-space: nowrap;
}

.viewer-menu-separator {
  height: 1px;
  margin: var(--inplug-space-1, 4px) var(--inplug-space-2, 8px);
  background: var(--viewer-line);
}

.viewer-menu-heading {
  padding: var(--inplug-space-1, 4px) var(--inplug-space-3, 12px) 0;
  color: var(--viewer-muted);
  font-size: 0.8em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The eye of a tree row: hide or show that node in one click. */
.tree-eye {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 26px;
  height: 26px;
  margin-left: auto;
  padding: 0;
  border: 0;
  border-radius: var(--inplug-radius-sm, 8px);
  background: transparent;
  color: var(--viewer-muted);
  cursor: pointer;
  opacity: 0;
}

.tree-row:hover .tree-eye,
.tree-eye:focus-visible,
.tree-row[data-visibility="hidden"] .tree-eye,
.tree-row[data-visibility="partial"] .tree-eye {
  opacity: 1;
}

.tree-eye:hover {
  background: var(--viewer-bg);
  color: var(--viewer-text);
}

.tree-eye svg {
  width: 16px;
  height: 16px;
}

@media (hover: none) {
  .tree-eye {
    opacity: 1;
  }
}

.tree-eye .tree-eye-closed,
.tree-row[data-visibility="hidden"] .tree-eye .tree-eye-open {
  display: none;
}

.tree-row[data-visibility="hidden"] .tree-eye .tree-eye-closed {
  display: block;
}

/* A note under a menu (storeys by level). */
.viewer-menu-note {
  max-width: 280px;
  margin: var(--inplug-space-1, 4px) 0 0;
  padding: var(--inplug-space-2, 8px) var(--inplug-space-3, 12px);
  border-top: 1px solid var(--viewer-line);
  color: var(--viewer-muted);
  font-size: 0.82em;
  line-height: 1.35;
}

/* «Заливка среза» in the section panel. */
.viewer-section-select {
  width: auto;
  min-height: 32px;
  padding-block: 0;
}

/* The position of a section plane in IFC coordinates and its shift step. */
.viewer-section-numbers {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--inplug-space-2, 8px);
}

.viewer-section-number {
  display: inline-flex;
  align-items: center;
  gap: var(--inplug-space-2, 8px);
  color: var(--viewer-muted);
  font-size: 0.9em;
}

.viewer-section-number input {
  width: 110px;
  min-height: 32px;
}

.viewer-section-shift {
  display: inline-flex;
  align-items: center;
  gap: var(--inplug-space-1, 4px);
}

.viewer-section-shift input {
  width: 70px;
  min-height: 32px;
}

.viewer-section-shift .viewer-button {
  min-width: 32px;
  justify-content: center;
}

/* Storey menu: the storey (isolate) and its plan side by side. */
.viewer-storey-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--inplug-space-1, 4px);
}

.viewer-storey-row > .viewer-menu-item:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-storey-plan {
  min-height: 30px;
  border: 1px solid var(--viewer-line);
  font-size: 0.85em;
}

/* A plan is on: what it is and the way out, above the model. */
.viewer-plan-badge {
  position: absolute;
  top: var(--inplug-space-3, 12px);
  left: 50%;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: var(--inplug-space-3, 12px);
  max-width: calc(100% - 2 * var(--inplug-space-4, 16px));
  padding: var(--inplug-space-2, 8px) var(--inplug-space-2, 8px) var(--inplug-space-2, 8px) var(--inplug-space-4, 16px);
  transform: translateX(-50%);
  border: 1px solid var(--viewer-line);
  border-radius: 999px;
  background: var(--viewer-surface);
  box-shadow: var(--inplug-elev-1, 0 8px 24px rgba(0, 0, 0, 0.12));
  font-size: 0.9em;
}

.viewer-plan-badge[hidden] {
  display: none;
}

.viewer-plan-badge span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Snaps of the measuring tools: the middle of an edge (a dark diamond), the foot of a
   perpendicular (a pale square), a point kept on an axis (dashed). */
.viewer-snap.is-middle {
  transform: translate(-50%, -50%) rotate(45deg);
  background: var(--viewer-text);
  border-color: var(--viewer-accent);
}

.viewer-snap.is-perpendicular {
  border-radius: 1px;
  background: color-mix(in srgb, var(--viewer-accent) 35%, transparent);
}

.viewer-snap.is-axis {
  border-style: dashed;
}

/* ---- Clash summary (clash-summary.js) ----
   Two series: found / open (blue) and resolved (orange), validated for colour-blind
   separation and contrast on the white surface; text stays in the text colours. */
.viewer-clash-summary-view {
  --chart-found: #2a78d6;
  --chart-resolved: #eb6834;
  --chart-grid: #e6e9e7;
  display: grid;
  gap: var(--inplug-space-3, 12px);
  min-height: 0;
  overflow: auto;
  padding: var(--inplug-space-2, 8px) var(--inplug-space-3, 12px) var(--inplug-space-4, 16px);
}

.viewer-clash-summary-view[hidden] {
  display: none;
}

.viewer-clash-summary-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--inplug-space-2, 8px);
}

.viewer-chart-heading {
  margin: 0 auto 0 0;
  font-size: 1rem;
}

.viewer-clash-summary-head select {
  width: auto;
  max-width: 260px;
  min-height: 32px;
}

.viewer-clash-summary-body {
  position: relative;
  display: grid;
  gap: var(--inplug-space-4, 16px);
}

.viewer-chart-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: var(--inplug-space-2, 8px);
}

.viewer-chart-tile {
  display: grid;
  gap: 2px;
  padding: var(--inplug-space-2, 8px) var(--inplug-space-3, 12px);
  border: 1px solid var(--viewer-line);
  border-radius: var(--inplug-radius-sm, 10px);
  background: var(--viewer-surface);
}

.viewer-chart-tile-label {
  color: var(--viewer-muted);
  font-size: 0.8em;
}

.viewer-chart-tile-value {
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
}

.viewer-chart {
  display: grid;
  gap: var(--inplug-space-1, 4px);
}

.viewer-chart-title {
  margin: 0;
  font-size: 0.9rem;
}

.viewer-chart-note {
  margin: 0;
  color: var(--viewer-muted);
  font-size: 0.8em;
}

.viewer-chart svg {
  display: block;
  max-width: 100%;
  overflow: visible;
}

.viewer-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--inplug-space-4, 16px);
  color: var(--viewer-text);
  font-size: 0.85em;
}

.viewer-chart-key {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.viewer-chart-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.viewer-chart-swatch.is-found {
  background: var(--chart-found);
}

.viewer-chart-swatch.is-resolved {
  background: var(--chart-resolved);
}

.viewer-chart-found {
  fill: var(--chart-found);
}

.viewer-chart-resolved {
  fill: var(--chart-resolved);
}

.viewer-chart-line {
  fill: none;
  stroke: var(--chart-found);
  stroke-width: 2;
  stroke-linejoin: round;
}

.viewer-chart-dot {
  fill: var(--chart-found);
  stroke: var(--viewer-surface);
  stroke-width: 2;
}

.viewer-chart-grid {
  stroke: var(--chart-grid);
  stroke-width: 1;
}

.viewer-chart-base {
  stroke: var(--viewer-line);
  stroke-width: 1;
}

.viewer-chart-axis,
.viewer-chart-label,
.viewer-chart-value {
  font-size: 11px;
  fill: var(--viewer-muted);
  font-variant-numeric: tabular-nums;
}

.viewer-chart-label {
  font-size: 12px;
  fill: var(--viewer-text);
}

.viewer-chart-value {
  fill: var(--viewer-text);
}

.viewer-chart-hit {
  fill: transparent;
}

.viewer-chart-hit:hover {
  fill: color-mix(in srgb, var(--viewer-text) 5%, transparent);
}

.viewer-chart-tip {
  position: absolute;
  z-index: 5;
  max-width: 260px;
  padding: 6px 10px;
  border: 1px solid var(--viewer-line);
  border-radius: var(--inplug-radius-sm, 8px);
  background: var(--viewer-surface);
  box-shadow: var(--inplug-elev-1, 0 4px 16px rgba(0, 0, 0, 0.12));
  color: var(--viewer-text);
  font-size: 0.82em;
  pointer-events: none;
}

.viewer-chart-tip[hidden] {
  display: none;
}

.viewer-chart-table summary {
  color: var(--viewer-muted);
  font-size: 0.8em;
  cursor: pointer;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---- Remarks: tools, journal, mentions, the project's disciplines ---- */
.viewer-remark-tools {
  display: flex;
  flex-wrap: wrap;
  gap: var(--inplug-space-2, 8px);
  margin: var(--inplug-space-2, 8px) 0;
}

.viewer-remark-more {
  width: 100%;
  justify-content: center;
}

.viewer-remark-journal {
  margin-top: var(--inplug-space-2, 8px);
  font-size: 0.85em;
}

.viewer-remark-journal summary {
  cursor: pointer;
  color: var(--viewer-muted);
}

.viewer-remark-journal ul {
  display: grid;
  gap: 4px;
  margin: var(--inplug-space-2, 8px) 0 0;
  padding: 0;
  list-style: none;
}

.viewer-remark-journal li {
  display: grid;
  gap: 1px;
  padding: 4px 8px;
  border-radius: var(--inplug-radius-sm, 8px);
  background: var(--viewer-bg);
}

.viewer-remark-note {
  position: relative;
}

.viewer-mention-menu {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 10;
  min-width: 200px;
  margin: 2px 0 0;
  padding: 4px;
  border: 1px solid var(--viewer-line);
  border-radius: var(--inplug-radius-sm, 8px);
  background: var(--viewer-surface);
  box-shadow: var(--inplug-elev-1, 0 8px 24px rgba(0, 0, 0, 0.12));
  list-style: none;
}

.viewer-mention-menu[hidden] {
  display: none;
}

.viewer-mention-menu button {
  width: 100%;
  min-height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--viewer-text);
  text-align: left;
  cursor: pointer;
}

.viewer-mention-menu button:hover,
.viewer-mention-menu button:focus-visible {
  background: var(--viewer-bg);
}

.viewer-remark-disciplines {
  display: grid;
  gap: var(--inplug-space-2, 8px);
  margin-bottom: var(--inplug-space-2, 8px);
  padding: var(--inplug-space-2, 8px) var(--inplug-space-3, 12px);
  border: 1px solid var(--viewer-line);
  border-radius: var(--inplug-radius-sm, 10px);
}

.viewer-remark-disciplines-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  gap: 4px 8px;
}

.viewer-remark-grid select option:disabled {
  color: var(--viewer-muted);
}

/* ---- The project's team, invitations and journal (project-team.js, invite-page.js) ---- */

.viewer-cloud-role {
  margin: 0;
  color: var(--viewer-text);
  font-size: var(--inplug-text-meta, 0.875rem);
}

.viewer-cloud-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--inplug-space-2, 8px);
}

.viewer-cloud-live {
  color: var(--viewer-muted);
  font-size: 0.78rem;
}

.viewer-cloud-live::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 5px;
  border-radius: 50%;
  background: #2e7d32;
  vertical-align: 1px;
}

.viewer-cloud-live.is-off::before {
  background: #b26a00;
}

.viewer-team-dialog {
  width: min(640px, calc(100vw - 32px));
}

.viewer-team-dialog[open] {
  overflow: auto;
}

.viewer-team-body {
  display: grid;
  gap: var(--inplug-space-3, 12px);
  min-width: 0;
}

.viewer-team-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.viewer-team-member {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--inplug-space-2, 8px);
  padding: var(--inplug-space-2, 8px) 0;
  border-bottom: 1px solid var(--viewer-line);
}

.viewer-team-who {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  min-width: 0;
}

.viewer-team-email,
.viewer-team-role {
  color: var(--viewer-muted);
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

.viewer-team-email {
  flex-basis: 100%;
}

.viewer-team-badge {
  display: inline-block;
  padding: 0 6px;
  border: 1px solid var(--viewer-line);
  border-radius: 999px;
  color: var(--viewer-muted);
  font-size: 0.72rem;
  line-height: 1.5;
}

.viewer-team-badge--me {
  border-color: transparent;
  background: var(--viewer-bg);
}

.viewer-team-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--inplug-space-2, 8px);
}

.viewer-team-controls select {
  width: auto;
}

.viewer-team-disciplines {
  display: grid;
  flex-basis: 100%;
  gap: var(--inplug-space-2, 8px);
  margin: 0;
  padding: var(--inplug-space-2, 8px) var(--inplug-space-3, 12px);
  border: 1px solid var(--viewer-line);
  border-radius: var(--inplug-radius-sm, 10px);
}

.viewer-team-disciplines legend {
  padding: 0 4px;
  color: var(--viewer-muted);
  font-size: 0.85rem;
}

.viewer-team-disciplines[hidden] {
  display: none;
}

.viewer-team-subtitle {
  margin: var(--inplug-space-2, 8px) 0 0;
  font-size: 1rem;
}

.viewer-team-invite {
  display: grid;
  gap: var(--inplug-space-2, 8px);
}

.viewer-team-link {
  display: flex;
  gap: var(--inplug-space-2, 8px);
}

.viewer-team-link input {
  flex: 1;
  min-width: 0;
}

.viewer-team-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.viewer-chip {
  padding: 4px 10px;
  border: 1px solid var(--viewer-line);
  border-radius: 999px;
  background: transparent;
  color: var(--viewer-text);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.viewer-chip.is-active {
  border-color: var(--viewer-text);
  background: var(--viewer-text);
  color: var(--viewer-surface);
}

.viewer-journal {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.viewer-journal-day {
  margin-top: var(--inplug-space-2, 8px);
  padding: 4px 0;
  color: var(--viewer-muted);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.viewer-journal-entry {
  display: grid;
  grid-template-columns: 3.2em minmax(0, 1fr);
  gap: 2px 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--viewer-line);
  font-size: 0.9rem;
}

.viewer-journal-time {
  grid-row: span 2;
  color: var(--viewer-muted);
  font-variant-numeric: tabular-nums;
}

.viewer-journal-text {
  overflow-wrap: anywhere;
}

.viewer-journal-meta {
  color: var(--viewer-muted);
  font-size: 0.78rem;
}

.viewer-invite {
  display: grid;
  gap: var(--inplug-space-3, 12px);
  max-width: 560px;
  margin: var(--inplug-space-5, 24px) auto;
  padding: var(--inplug-space-5, 24px);
  border: 1px solid var(--viewer-line);
  border-radius: var(--inplug-radius-md, 14px);
  background: var(--viewer-surface);
}

.viewer-invite h2 {
  margin: 0;
  font-family: var(--inplug-font-display, "Onest", sans-serif);
  font-size: 1.35rem;
}

.viewer-invite-facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 6px 14px;
  margin: 0;
}

.viewer-invite-facts dt {
  color: var(--viewer-muted);
}

.viewer-invite-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.viewer-invite-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--inplug-space-2, 8px);
}

@media (max-width: 560px) {
  .viewer-invite-facts {
    grid-template-columns: 1fr;
  }
  .viewer-invite-facts dd {
    margin-bottom: 6px;
  }
}

.viewer-invite a.viewer-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.viewer-invite a.viewer-button:not(.viewer-button--primary) {
  color: var(--viewer-text);
}

.viewer-banner-action {
  margin-left: 6px;
  vertical-align: baseline;
}

.viewer-journal-tools {
  display: flex;
  gap: var(--inplug-space-2, 8px);
}

/* ===================== Interface pass: ribbon labels, tooltips, states, welcome, status ===================== */

/* Buttons: a disabled main button reads as disabled, a dangerous one as dangerous. */
.viewer-button--primary:disabled {
  border-color: var(--viewer-line);
  background: var(--viewer-bg);
  color: var(--viewer-muted);
  opacity: 1;
}
.viewer-button--danger {
  border-color: transparent;
  background: #c62828;
  color: #ffffff;
  font-weight: 600;
}
.viewer-button--danger:hover { background: #a61f1f; }

/* The toolbar as a ribbon: a label under each icon when the bar fits. */
.viewer-toolbar.has-labels { flex-wrap: nowrap; }
.viewer-toolbar.has-labels .viewer-tool.viewer-tool--bar {
  width: auto; min-width: 54px; height: 52px; padding: 5px 6px 4px;
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
}
.viewer-toolbar.has-labels .viewer-tool.viewer-tool--bar .viewer-tool-label {
  position: static; width: auto; height: auto; overflow: visible; clip: auto;
  font-size: 11px; line-height: 1.1; letter-spacing: 0.01em; color: inherit;
}
.viewer-toolbar.has-labels .viewer-tool.viewer-tool--bar svg { width: 22px; height: 22px; }
.viewer-toolbar.has-labels .viewer-toolbar-flyout .viewer-tool-label { display: none; }
.viewer-toolbar.has-labels .viewer-toolbar-flyout .viewer-tool.viewer-tool--bar { min-width: 40px; height: 40px; padding: 0; }

/* Disabled tools: faded and flat; inactive ones crisp; the active one filled with a bar. */
.viewer-tool.viewer-tool--bar:disabled { opacity: 0.3; color: var(--viewer-muted); filter: grayscale(1); }
.viewer-tool.viewer-tool--bar:disabled .viewer-tool-label { opacity: 0.9; }
.viewer-tool.viewer-tool--bar.is-active,
.viewer-tool.viewer-tool--bar[aria-pressed="true"]:not(#measureSnap),
.viewer-tool.viewer-tool--bar[aria-expanded="true"] {
  background: color-mix(in srgb, var(--viewer-accent) 30%, var(--viewer-surface));
  color: var(--viewer-text);
  box-shadow: inset 0 -3px 0 var(--viewer-accent);
}

/* Tooltips: title, shortcut keys, a line of help. */
.viewer-tip {
  position: fixed; z-index: 1000; max-width: 280px; pointer-events: none;
  padding: 8px 10px; border-radius: 8px;
  background: #1b2420; color: #f4f7f5; font-size: 13px; line-height: 1.35;
  box-shadow: 0 10px 28px rgba(17, 24, 21, 0.28);
}
.viewer-tip[hidden] { display: none; }
.viewer-tip-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.viewer-tip-keys { display: inline-flex; gap: 3px; margin-left: auto; }
.viewer-tip-or { margin-left: auto; color: #9fb0a7; font-size: 12px; }
.viewer-tip-or + .viewer-tip-keys { margin-left: 0; }
.viewer-tip kbd {
  min-width: 20px; padding: 1px 5px; border: 1px solid #4a5a52; border-bottom-width: 2px; border-radius: 4px;
  background: #27322d; color: #ffffff; font: 600 11px/1.4 var(--inplug-font, "Source Sans 3", sans-serif); text-align: center;
}
.viewer-tip-text { margin-top: 3px; color: #c9d4ce; }
.viewer-tip-need { margin-top: 3px; color: #f2c879; }

/* Abbreviated table heads say what they stand for. */
.viewer-abbr { border-bottom: 1px dotted currentColor; cursor: help; }

/* «Ещё ▾» menus. */
.viewer-more { position: relative; display: inline-flex; }
.viewer-more-toggle::after { content: ""; display: inline-block; width: 0; height: 0; margin-left: 6px; border: 4px solid transparent; border-top-color: currentColor; transform: translateY(2px); }
.viewer-more-menu {
  position: absolute; bottom: calc(100% + 6px); left: 0; z-index: 20; min-width: 300px;
  display: grid; padding: 4px; border: 1px solid var(--viewer-line); border-radius: 10px;
  background: var(--viewer-surface); box-shadow: 0 12px 32px rgba(17, 24, 21, 0.18);
}
.viewer-more-menu[hidden] { display: none; }
.viewer-more-item {
  display: grid; gap: 1px; padding: 8px 10px; border: 0; border-radius: 6px;
  background: transparent; text-align: left; cursor: pointer; font-size: 0.92rem;
}
.viewer-more-item small { color: var(--viewer-muted); font-size: 0.78rem; }
.viewer-more-item:hover:not(:disabled),
.viewer-more-item:focus-visible { background: var(--viewer-bg); outline: none; }
.viewer-more-item:disabled { opacity: 0.45; cursor: default; }
.viewer-more-item--danger { color: #b42318; }
.viewer-clash-actions { flex-wrap: nowrap; align-items: center; }

/* Confirmations in the viewer's style. */
.viewer-confirm { width: min(440px, calc(100vw - 32px)); }
.viewer-confirm h2 { margin: 0; font-size: 1.15rem; }
.viewer-confirm-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* Messages: one card over the model, top centre, with a close button. */
.viewer-banner {
  position: fixed; top: 76px; left: 50%; transform: translateX(-50%); z-index: 40;
  width: max-content; max-width: min(760px, calc(100vw - 32px));
  padding: 12px 44px 12px 16px; border: 1px solid color-mix(in srgb, #c62828 35%, var(--viewer-line));
  border-left: 4px solid #c62828; border-radius: 10px;
  background: var(--viewer-surface); color: var(--viewer-text);
  box-shadow: 0 14px 36px rgba(17, 24, 21, 0.2); line-height: 1.4;
}
.viewer-banner-close {
  position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; display: grid; place-items: center;
  border: 0; border-radius: 6px; background: transparent; color: var(--viewer-muted); cursor: pointer;
}
.viewer-banner-close:hover { background: var(--viewer-bg); color: var(--viewer-text); }
.viewer-banner-close svg { width: 16px; height: 16px; }

/* The empty model window. */
.viewer-welcome {
  position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; padding: 24px 24px 96px;
  overflow: auto;
}
.viewer-welcome[hidden] { display: none; }
.viewer-welcome-card { width: min(760px, 100%); display: grid; gap: 22px; }
.viewer-welcome-drop {
  display: grid; justify-items: center; gap: 10px; padding: 34px 24px 26px; text-align: center;
  border: 2px dashed color-mix(in srgb, var(--viewer-accent) 70%, var(--viewer-line)); border-radius: 16px;
  background: color-mix(in srgb, var(--viewer-surface) 86%, transparent);
}
.viewer-welcome-icon { width: 56px; height: 56px; color: #4f730c; }
.viewer-welcome-drop h2 { margin: 0; font-family: var(--inplug-font-display, "Onest", sans-serif); font-size: 1.6rem; }
.viewer-welcome-drop p { margin: 0; max-width: 520px; color: var(--viewer-muted); }
.viewer-welcome-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 6px; }
.viewer-welcome-note { font-size: 0.86rem; }
.viewer-welcome-features {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0; padding: 0; list-style: none;
}
.viewer-welcome-features li {
  display: grid; grid-template-columns: 22px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 10px; row-gap: 2px;
  padding: 12px; border: 1px solid var(--viewer-line); border-radius: 12px; background: var(--viewer-surface);
}
.viewer-welcome-features svg { grid-row: span 2; width: 22px; height: 22px; color: #4f730c; }
.viewer-welcome-features strong { font-size: 0.95rem; }
.viewer-welcome-features span { color: var(--viewer-muted); font-size: 0.82rem; line-height: 1.35; }

/* The status bar: a message on the left; tool hint, selection, cursor, units on the right. */
.viewer-statusbar { gap: 16px; }
.viewer-status { flex: 1 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.viewer-status-meta { display: flex; align-items: center; gap: 14px; flex: 0 1 auto; min-width: 0; font-size: 0.82rem; color: var(--viewer-muted); white-space: nowrap; }
.viewer-status-item[hidden], .viewer-status-tool[hidden] { display: none; }
.viewer-status-item { padding-left: 14px; border-left: 1px solid var(--viewer-line); }
.viewer-status-tool { overflow: hidden; text-overflow: ellipsis; padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, var(--viewer-accent) 22%, var(--viewer-surface)); color: var(--viewer-text); }
.viewer-status-coords { font-variant-numeric: tabular-nums; }

/* «Только модель»: no header, no side panels. */
.viewer-app.is-focus .viewer-bar,
.viewer-app.is-focus #viewerTreePanel,
.viewer-app.is-focus #viewerPropsPanel,
.viewer-app.is-focus .viewer-splitter { display: none !important; }
#focusToggle[aria-pressed="true"] { background: color-mix(in srgb, var(--viewer-accent) 30%, var(--viewer-surface)); }
.viewer-app.is-focus #panelTreeToggle,
.viewer-app.is-focus #panelPropsToggle { background: transparent; box-shadow: none; }
#clashPopOut { margin-left: auto; }
#clashPopOut + #clashClose { margin-left: 0; }

/* The tree's grouping choice. */

/* «Коллизии» in a window of its own. */
.viewer-clash-popup { margin: 0; height: 100vh; overflow: hidden; background: var(--viewer-surface); }
.viewer-clash-popup .viewer-clash-dock { height: 100vh !important; border-top: 0; }
.viewer-clash-popup .viewer-clash-resize { display: none; }

@media (max-width: 980px) {
  .viewer-welcome-features { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .viewer-status-coords { display: none; }
}

/* Phones: a slim header (icons instead of words), one row of tools that scrolls, sheets with
   a handle, a smaller view cube. */
@media (max-width: 800px) {
  .viewer-actions .viewer-button {
    width: 40px; min-width: 40px; min-height: 40px; padding: 0; font-size: 0; position: relative; display: inline-grid; place-items: center;
  }
  .viewer-actions .viewer-button::before {
    content: ""; width: 22px; height: 22px; background: currentColor;
    -webkit-mask: var(--viewer-icon) center / contain no-repeat; mask: var(--viewer-icon) center / contain no-repeat;
  }
  #openButton { --viewer-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E"); }
  #cloudProjectsButton { --viewer-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 18.5a4.5 4.5 0 0 1-.6-9 6 6 0 0 1 11.5 1.6A3.8 3.8 0 0 1 17.5 18.5Z'/%3E%3Cpath d='M12 11v5M9.8 13.2 12 11l2.2 2.2'/%3E%3C/svg%3E"); }
  .viewer-crumbs { display: flex !important; flex: 1 1 auto; }
  .viewer-crumb-current { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }

  .viewer-toolbar {
    flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; scrollbar-width: none; -webkit-overflow-scrolling: touch;
    /* The row scrolls: its right edge fades to say there is more. */
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent);
    mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent);
  }
  .viewer-toolbar::-webkit-scrollbar { display: none; }
  .viewer-tool.viewer-tool--bar { width: 44px; height: 44px; min-width: 44px; flex: none; }
  .viewer-toolbar-flyout { position: fixed; left: 8px; right: 8px; bottom: calc(var(--viewer-toolbar-space, 64px) + 8px); transform: none; justify-content: center; flex-wrap: wrap; }

  .viewer-tree-panel::before,
  .viewer-panel::before {
    content: ""; position: sticky; top: 0; display: block; width: 40px; height: 4px; margin: 8px auto 0; border-radius: 2px;
    background: var(--viewer-line); z-index: 1;
  }
  .viewer-cube-turn { width: 32px; height: 32px; }
  .viewer-cube-turn svg { width: 16px; height: 16px; }
  .viewer-status-meta .viewer-status-item:not(.viewer-status-selection) { display: none; }
  .viewer-status-tool { display: none; }
  .viewer-banner { top: 56px; padding: 10px 40px 10px 12px; font-size: 0.92rem; }
  .viewer-welcome { padding: 16px 16px 84px; place-items: start center; }
  .viewer-welcome-drop { padding: 22px 16px; }
  .viewer-welcome-features { grid-template-columns: 1fr; }
  .viewer-welcome-features li:nth-child(n + 4) { display: none; }
}

/* ===================== Accessibility and sizes ===================== */

/* The size of the interface (ui-scale.js): the panels, the header, the toolbar and the
   dialogs are zoomed; the model and what is drawn over it are not. */
:root { --ui-scale: 1; }
:root[data-ui-scale]:not([data-ui-scale="1"]) :is(
  .viewer-bar,
  #viewerTreePanel,
  #viewerPropsPanel,
  .viewer-statusbar,
  .viewer-clash-dock,
  .viewer-toolbar,
  .viewer-stage > .viewer-section,
  .viewer-measure-panel,
  .viewer-cube-turns,
  .viewer-welcome-card,
  .viewer-home-inner,
  .viewer-banner,
  dialog
) { zoom: var(--ui-scale); }
.viewer-tip { font-size: calc(13px * var(--ui-scale)); max-width: calc(280px * var(--ui-scale)); }
.viewer-menu { font-size: calc(0.95rem * var(--ui-scale)); }
.viewer-status-scale { display: inline-flex; }
.viewer-status-select {
  min-height: 24px; padding: 0 4px; border: 1px solid transparent; border-radius: 6px;
  background: transparent; color: var(--viewer-muted); font: inherit; font-size: 0.8rem; cursor: pointer;
}
.viewer-status-select:hover, .viewer-status-select:focus-visible { border-color: var(--viewer-line); color: var(--viewer-text); }

/* Large screens (2560 px and wider): wider panels and a taller clash window. */
@media (min-width: 2400px) {
  .viewer-panel { width: var(--viewer-props-width, 480px); }
  .viewer-tree-panel { width: var(--viewer-tree-width, 380px); }
  .viewer-clash-dock { height: 44vh; }
}

/* The model tree: the focused row is clear; its buttons show on focus as on hover. */
.tree-row:focus { outline: none; }
.tree-row:focus-visible {
  outline: 2px solid var(--viewer-accent);
  outline-offset: -2px;
  background: color-mix(in srgb, var(--viewer-accent) 12%, transparent);
}
.tree-row:focus-visible .tree-eye { opacity: 1; }
.viewer-tree [role="tree"] { margin: 0; padding: 0; list-style: none; }

/* Targets: at least 24 × 24 px everywhere (WCAG 2.2 AA), 44 px for a finger. */
.viewer-check input[type="checkbox"],
.viewer-check input[type="radio"] { width: 18px; height: 18px; }
.viewer-check { min-height: 24px; display: inline-flex; align-items: center; gap: 6px; }
.viewer-close { min-width: 28px; min-height: 28px; }

@media (pointer: coarse) {
  .viewer-button,
  .viewer-button--small,
  .viewer-input,
  select.viewer-input,
  .viewer-chip { min-height: 44px; }
  .viewer-button--small { padding: 0 14px; }
  .viewer-tool,
  .viewer-tool.viewer-tool--bar,
  .viewer-cube-turn,
  .viewer-close,
  .viewer-banner-close { min-width: 44px; min-height: 44px; }
  .tree-row { min-height: 44px; }
  .tree-toggle,
  .tree-remove,
  .tree-eye { width: 40px; height: 40px; opacity: 1; }
  .tree-label { min-height: 44px; }
  .viewer-more-item { padding: 12px; }
  .viewer-check { min-height: 44px; }
  .viewer-check input[type="checkbox"],
  .viewer-check input[type="radio"] { width: 22px; height: 22px; }
  .viewer-menu-item { min-height: 44px; }
  .viewer-status-select { min-height: 40px; }
}

/* The page for a browser that cannot show the viewer (browser-check-page.js). */
.viewer-unsupported { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--viewer-bg); }
.viewer-unsupported-card {
  width: min(680px, 100%); display: grid; gap: 14px; padding: 28px;
  border: 1px solid var(--viewer-line); border-radius: 16px; background: var(--viewer-surface);
  box-shadow: 0 18px 48px rgba(17, 24, 21, 0.12);
}
.viewer-unsupported-card h1 { margin: 0; font-family: var(--inplug-font-display, "Onest", sans-serif); font-size: 1.6rem; }
.viewer-unsupported-lead, .viewer-unsupported-note { margin: 0; color: var(--viewer-muted); }
.viewer-unsupported-problem { padding: 14px 16px; border-left: 4px solid #c62828; border-radius: 10px; background: var(--viewer-bg); }
.viewer-unsupported-problem h2 { margin: 0 0 8px; font-size: 1.05rem; }
.viewer-unsupported-problem ol { margin: 0; padding-left: 1.3em; display: grid; gap: 6px; line-height: 1.45; }
.viewer-unsupported-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.viewer-unsupported-actions a.viewer-button { display: inline-flex; align-items: center; color: var(--viewer-text); text-decoration: none; }

/* ---- The «Проект» panel, quiet: the project's name with icon tools, one line of role and
   grouping, the files folded into a line, the search with its properties icon. ---- */
.viewer-panel-head { margin-bottom: 2px; min-width: 0; }
.viewer-panel-head h2 {
  flex: 1 1 auto; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 1.15rem; line-height: 1.3;
}
.viewer-panel-tools { flex: none; display: flex; align-items: center; gap: 2px; }
.viewer-icon-button {
  position: relative; flex: none;
  display: inline-grid; place-items: center;
  width: 32px; height: 32px; padding: 0;
  border: 0; border-radius: 8px; background: transparent; color: var(--viewer-muted);
  cursor: pointer;
}
.viewer-icon-button svg { width: 18px; height: 18px; }
.viewer-icon-button:hover:not(:disabled) { background: color-mix(in srgb, var(--viewer-text) 7%, transparent); color: var(--viewer-text); }
.viewer-icon-button:focus-visible { outline: 2px solid var(--viewer-accent); outline-offset: 1px; }
.viewer-icon-button:disabled { opacity: 0.4; cursor: default; }
.viewer-icon-button[hidden] { display: none; }
.viewer-icon-button.is-active,
.viewer-icon-button[aria-expanded="true"] { color: var(--viewer-text); background: color-mix(in srgb, var(--viewer-accent) 28%, transparent); }
.viewer-icon-count {
  position: absolute; top: 1px; right: 1px; min-width: 15px; height: 15px; padding: 0 3px;
  border-radius: 8px; background: var(--viewer-text); color: var(--viewer-surface);
  font-size: 10px; font-weight: 700; line-height: 15px; text-align: center;
}
.viewer-icon-count[hidden] { display: none; }

/* The live mark: a dot (green — changes come at once, amber — no connection). */
.viewer-cloud-live { display: inline-grid; place-items: center; width: 20px; height: 32px; font-size: 0; }
.viewer-cloud-live::before { margin: 0; }
.viewer-cloud-live[hidden] { display: none; }

.viewer-panel-sub {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin: 0 var(--inplug-space-2, 8px) 8px; min-height: 26px;
  color: var(--viewer-muted); font-size: 0.82rem;
}
.viewer-cloud-role { margin: 0; color: var(--viewer-muted); font-size: inherit; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-cloud-role[hidden] { display: none; }
.viewer-tree-grouping {
  margin-left: auto; flex: none; max-width: 60%;
  min-height: 26px; padding: 2px 22px 2px 8px;
  border: 1px solid transparent; border-radius: 7px;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235b6b63' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 5px center / 12px;
  color: var(--viewer-muted); font: inherit; font-size: 0.82rem; cursor: pointer;
  appearance: none; -webkit-appearance: none;
}
.viewer-tree-grouping:hover { border-color: var(--viewer-line); color: var(--viewer-text); }
.viewer-tree-grouping:focus-visible { outline: 2px solid var(--viewer-accent); outline-offset: 1px; }

.viewer-cloud { gap: 4px; margin-bottom: 10px; padding-bottom: 8px; }
.viewer-cloud-files-toggle {
  display: flex; align-items: center; gap: 6px; width: 100%;
  min-height: 30px; padding: 0 4px; margin: 0 -4px;
  border: 0; border-radius: 7px; background: transparent; cursor: pointer;
  font-size: 0.82rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--viewer-muted);
}
.viewer-cloud-files-toggle:hover { background: color-mix(in srgb, var(--viewer-text) 5%, transparent); color: var(--viewer-text); }
.viewer-cloud-files-toggle:focus-visible { outline: 2px solid var(--viewer-accent); outline-offset: 1px; }
.viewer-cloud-files-toggle[hidden] { display: none; }
.viewer-cloud-files-toggle svg { width: 14px; height: 14px; flex: none; transition: transform 0.15s ease; }
.viewer-cloud-files-toggle[aria-expanded="true"] svg { transform: rotate(90deg); }
.viewer-cloud-files-summary { margin-left: auto; font-weight: 400; text-transform: none; letter-spacing: 0; }
.viewer-cloud-files { margin: 0; gap: 0; }
.viewer-cloud-files[hidden] { display: none; }
.viewer-cloud-file-row { gap: 6px; padding: 0 0 0 20px; min-height: 30px; }
.viewer-cloud-file-name { flex: 1 1 auto; min-width: 0; font-size: 0.86rem; }
.viewer-cloud-file-row .viewer-version-badge { height: 20px; min-width: 28px; padding: 0 5px; border-color: transparent; background: transparent; color: var(--viewer-muted); font-size: 11px; }
.viewer-cloud-file-row .viewer-version-badge:hover,
.viewer-cloud-file-row .viewer-version-badge[aria-expanded="true"] { border-color: var(--viewer-line); color: var(--viewer-text); }
.viewer-cloud-file-row .viewer-version-badge.is-old { border-color: #d97706; color: #92400e; background: #fef3c7; }
.viewer-cloud-file-eye { width: 28px; height: 28px; }
.viewer-cloud-file-eye.is-on { color: var(--viewer-text); }
.viewer-cloud-file-eye:not(.is-on) { color: color-mix(in srgb, var(--viewer-muted) 70%, transparent); }
.viewer-cloud-file-wait { flex: none; width: 28px; height: 28px; display: grid; place-items: center; }
.viewer-cloud-file-wait::before {
  content: ""; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--viewer-line); border-top-color: var(--viewer-text);
  animation: viewer-spin 0.8s linear infinite;
}
@keyframes viewer-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .viewer-cloud-file-wait::before { animation: none; } }

.viewer-search-bar { display: flex; align-items: center; gap: 4px; }
.viewer-search-bar .viewer-input { flex: 1 1 auto; min-width: 0; }
.viewer-search-bar .viewer-search-toggle { width: 38px; height: 38px; }

@media (pointer: coarse) {
  .viewer-icon-button { width: 44px; height: 44px; }
  .viewer-cloud-file-eye, .viewer-cloud-file-wait { width: 44px; height: 44px; }
  .viewer-cloud-file-row, .viewer-cloud-files-toggle { min-height: 44px; }
  .viewer-tree-grouping { min-height: 40px; }
  .viewer-search-bar .viewer-search-toggle { width: 44px; height: 44px; }
}
.viewer-cloud-members[hidden] { display: none; }
.viewer-cloud, .viewer-cloud-files, .viewer-cloud-file, .viewer-cloud-file-row { min-width: 0; }
.viewer-cloud-files-toggle { width: calc(100% + 8px); }
.viewer-cloud-live::before { display: block; }
.viewer-cloud-live { align-self: center; height: 20px; }

/* The «BCF» menu in the remarks' tools (remarks-bcf.js). */
.viewer-remark-tools { position: relative; }
.viewer-bcf-menu { position: absolute; z-index: 30; top: calc(100% + 4px); right: 0; min-width: 220px; display: grid; }
.viewer-bcf-menu .viewer-menu-item:disabled { opacity: 0.5; cursor: default; }
