:root {
  --panel-width: 400px;
  --tree-width: 300px;
  --tree-collapsed-width: 48px;
  --panel-height: 44vh;
  --shell-menu-height: 76px;
  --ink: var(--hbds-menu-ink);
  --muted: var(--hbds-menu-muted);
  --line: var(--hbds-menu-line);
  --surface: var(--hbds-menu-surface);
  --surface-soft: var(--hbds-menu-surface-soft);
  --accent: var(--hbds-menu-accent);
  --accent-strong: var(--hbds-menu-accent-strong);
  --on-accent: var(--hbds-menu-on-accent);
  --summary-bg: var(--hbds-menu-summary-bg);
  --summary-open-bg: var(--hbds-menu-summary-open-bg);
  --collapsed-bg: var(--hbds-menu-collapsed-bg);
  --collapsed-ink: var(--hbds-menu-collapsed-ink);
  --control-bg: var(--hbds-menu-control-bg);
  --danger: var(--hbds-menu-danger);
  --ok: var(--hbds-menu-ok);
  --warn: var(--hbds-menu-warn);
}

* { box-sizing: border-box; }

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  color: var(--ink);
  background: var(--hbds-menu-page-bg);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

button,
select,
textarea {
  width: 100%;
}

input[type="text"] {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
  padding: 7px 9px;
}

input[type="password"] {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
  padding: 7px 9px;
}

button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease;
}

button:hover:not(:disabled) {
  border-color: #cbd5e1;
  background: #f8fafc;
}

button:active:not(:disabled) {
  transform: translateY(1px);
}

button:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

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

button.primary:hover:not(:disabled) {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
}

button.danger {
  border-color: #f1c6c1;
  color: var(--danger);
  background: #fff8f7;
}

button.quiet {
  color: #334155;
  background: var(--surface-soft);
}

label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  font-weight: 650;
  color: #333;
}

select,
textarea {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
  padding: 7px 9px;
}

input[type="color"] {
  width: 44px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 3px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

textarea {
  min-height: 210px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
}

textarea.compact-textarea {
  min-height: 82px;
}

#container {
  position: fixed;
  inset: 0 var(--panel-width) 0 var(--tree-width);
  overflow: hidden;
  background: #f8fafc;
  transition: right 160ms ease, bottom 160ms ease;
}

body.model-tree-collapsed #container {
  top: 0;
  right: var(--panel-width);
  bottom: 0;
  left: 0 !important;
}

#container canvas {
  display: block;
}

#canvas-model-title {
  position: absolute;
  top: 14px;
  left: 50%;
  z-index: 18;
  max-width: calc(100% - 32px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 20px;
  font-weight: 780;
  color: #333;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid #ddd;
  border-radius: 7px;
  padding: 6px 12px;
  backdrop-filter: blur(3px);
  display: none;
  transform: translateX(-50%);
}

body.has-model #canvas-model-title {
  display: inline-block;
}

.canvas-collaboration-status {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 24;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: min(420px, calc(100% - 48px));
  min-height: 42px;
  border: 1px solid rgba(82, 113, 153, 0.28);
  border-radius: 8px;
  color: #172033;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.16);
  padding: 9px 14px;
  pointer-events: none;
  transform: translate(-50%, -50%);
  backdrop-filter: blur(6px);
}

.canvas-collaboration-status[hidden] {
  display: none;
}

.canvas-load-progress {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 25;
  display: grid;
  gap: 9px;
  width: min(360px, calc(100% - 48px));
  min-height: 58px;
  border: 1px solid rgba(82, 113, 153, 0.3);
  border-radius: 8px;
  color: #172033;
  background: rgba(255, 255, 255, 0.91);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
  padding: 12px 14px;
  pointer-events: none;
  transform: translate(-50%, -50%);
  backdrop-filter: blur(6px);
}

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

.canvas-load-progress-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 750;
}

.canvas-load-progress-track {
  display: block;
  width: 100%;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #dbe7f5;
}

.canvas-load-progress-bar {
  display: block;
  width: 8%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2563eb, #0f766e);
  transition: width 180ms ease;
}

.canvas-collaboration-status-spinner,
.collaboration-deferred-spinner {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  border: 2px solid #cbd8e8;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: collaboration-spin 900ms linear infinite;
}

@keyframes collaboration-spin {
  to { transform: rotate(360deg); }
}

.label-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.label {
  border-radius: 6px;
  padding: 1px 4px;
  pointer-events: auto;
  cursor: pointer;
  transition: background 140ms ease, box-shadow 140ms ease;
}

.label.is-selected {
  background: #f8fafc;
  box-shadow: 0 0 0 1px #cbd5e1;
}

.attribute-label.is-selected,
.link-label.is-selected {
  outline: 2px solid #cbd5e1;
  outline-offset: 2px;
}

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

#model-overview {
  position: fixed;
  top: 16px;
  left: calc(var(--tree-width) + 16px);
  z-index: 20;
  width: 224px;
  height: 150px;
  overflow: hidden;
  border: 1px solid rgba(100, 116, 139, 0.42);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(241, 245, 249, 0.9)),
    #f8fafc;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.18);
  backdrop-filter: blur(8px);
  touch-action: none;
}

#model-overview-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
}

#model-overview-viewport {
  position: absolute;
  border: 2px solid rgba(14, 165, 233, 0.95);
  border-radius: 5px;
  background: rgba(14, 165, 233, 0.11);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.85),
    0 0 0 4px rgba(14, 165, 233, 0.08);
  pointer-events: auto;
  cursor: grab;
}

#model-overview.is-dragging #model-overview-canvas,
#model-overview.is-dragging #model-overview-viewport {
  cursor: grabbing;
}

#model-tree-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 32;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  width: var(--tree-width);
  min-width: 0;
  border-right: 1px solid #d7e0ec;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 251, 255, 0.98)),
    #f8fbff;
  box-shadow: 18px 0 42px rgba(40, 54, 72, 0.08);
  padding: 14px;
  gap: 10px;
  transition: none;
}

body.model-tree-collapsed #model-tree-sidebar {
  width: 0 !important;
  min-width: 0;
  border-right: 0;
  box-shadow: none;
  padding: 0;
  pointer-events: none;
}

.model-tree-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.model-tree-header h2 {
  margin: 2px 0 0;
  color: #172033;
  font-size: 18px;
  line-height: 1.1;
}

#model-tree-toggle {
  flex: 0 0 auto;
  width: auto;
  min-width: 42px;
  min-height: 30px;
  border-color: #c8d9ee;
  color: #315a82;
  background: #f5faff;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 750;
}

body.model-tree-collapsed .model-tree-header > div,
body.model-tree-collapsed .model-tree-search,
body.model-tree-collapsed .model-tree-list {
  display: none;
}

body.model-tree-collapsed #model-tree-toggle {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 34;
  min-width: 34px;
  width: auto;
  padding: 5px 9px;
  pointer-events: auto;
  writing-mode: horizontal-tb;
  text-orientation: mixed;
}

.model-tree-search {
  display: grid;
  gap: 6px;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
}

.model-tree-search input {
  min-height: 32px;
  border: 1px solid #cbd9eb;
  border-radius: 8px;
  background: #fff;
  padding: 7px 9px;
}

.model-tree-list {
  min-height: 0;
  overflow: auto;
  border: 1px solid #d7e4f2;
  border-radius: 8px;
  background: #ffffff;
  padding: 6px;
}

.model-tree-empty {
  display: grid;
  min-height: 96px;
  place-items: center;
  color: #64748b;
  font-size: 12px;
  font-weight: 650;
}

.model-tree-group {
  display: grid;
  gap: 4px;
}

.model-tree-section {
  margin: 7px 3px 3px;
  color: #64748b;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.model-tree-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-height: 30px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: #263548;
  padding: 5px 6px 5px calc(6px + var(--depth, 0) * 12px);
  text-align: left;
}

.model-tree-item:hover:not(:disabled) {
  border-color: #c7d8ee;
  background: #f4f9ff;
}

.model-tree-item.is-selected {
  border-color: #93b8e6;
  background: #edf6ff;
}

.model-tree-kind {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 18px;
  border-radius: 999px;
  color: #315a82;
  background: #e9f3ff;
  font-size: 10px;
  font-weight: 850;
}

.model-tree-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 750;
}

.model-tree-meta {
  color: #7b8fa6;
  font-size: 10px;
  font-weight: 700;
}

#dynamic-test-panel {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 30;
  width: var(--panel-width);
  height: 100%;
  overflow: auto;
  border-left: 1px solid #ddd;
  background: var(--hbds-menu-panel-bg);
  box-shadow: -18px 0 48px rgba(40, 54, 72, 0.1);
  padding: 16px;
}

body.model-tree-collapsed #model-overview {
  left: 116px;
}

#collaboration-split {
  position: fixed;
  top: 16px;
  right: calc(var(--panel-width) + 16px);
  z-index: 72;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  box-sizing: border-box;
  width: min(720px, calc(100vw - var(--panel-width) - 40px));
  height: calc(100vh - var(--shell-menu-height) - 32px);
  min-width: 340px;
  min-height: 360px;
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 24px);
  border: 1px solid #bfd3ee;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(246, 250, 255, 0.96) 48%, rgba(247, 252, 248, 0.96)),
    #f8fbff;
  box-shadow: 0 18px 44px rgba(42, 74, 116, 0.2);
  padding: 16px;
  gap: 12px;
  overflow: hidden;
  resize: both;
}

#collaboration-split[hidden] {
  display: none;
}

body.has-collaboration-split #container {
  right: var(--panel-width);
}

body.embedded-shell-menu #collaboration-split {
  top: calc(var(--shell-menu-height) + 16px);
}

.collaboration-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid #d6e6f8;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(239, 247, 255, 0.9), rgba(245, 251, 247, 0.9) 58%, rgba(250, 247, 255, 0.82)),
    #f8fbff;
  padding: 8px 10px;
  cursor: move;
  user-select: none;
  touch-action: none;
}

.collaboration-heading {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.collaboration-header-controls {
  display: flex;
  flex: 0 1 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
  max-width: 68%;
}

#collaboration-split.is-dragging,
.models-collaboration-split.is-dragging,
#collaboration-split.is-resizing {
  opacity: 0.96;
}

.collaboration-resize-handle {
  position: absolute;
  z-index: 8;
  display: block;
  background: transparent;
  touch-action: none;
}

.collaboration-resize-handle.is-north,
.collaboration-resize-handle.is-south {
  left: 18px;
  right: 18px;
  height: 14px;
  cursor: ns-resize;
}

.collaboration-resize-handle.is-north {
  top: 0;
}

.collaboration-resize-handle.is-south {
  bottom: 0;
}

.collaboration-resize-handle.is-east,
.collaboration-resize-handle.is-west {
  top: 18px;
  bottom: 18px;
  width: 14px;
  cursor: ew-resize;
}

.collaboration-resize-handle.is-east {
  right: 0;
}

.collaboration-resize-handle.is-west {
  left: 0;
}

.collaboration-resize-handle.is-north-east,
.collaboration-resize-handle.is-north-west,
.collaboration-resize-handle.is-south-east,
.collaboration-resize-handle.is-south-west {
  width: 24px;
  height: 24px;
}

.collaboration-resize-handle.is-north-east {
  top: 0;
  right: 0;
  cursor: nesw-resize;
}

.collaboration-resize-handle.is-north-west {
  top: 0;
  left: 0;
  cursor: nwse-resize;
}

.collaboration-resize-handle.is-south-east {
  right: 0;
  bottom: 0;
  cursor: nwse-resize;
}

.collaboration-resize-handle.is-south-west {
  bottom: 0;
  left: 0;
  cursor: nesw-resize;
}

.collaboration-resize-handle.is-south-east::after {
  content: "";
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 12px;
  height: 12px;
  border-right: 2px solid #93a4ba;
  border-bottom: 2px solid #93a4ba;
  border-radius: 1px;
}

.collaboration-header h2 {
  color: #172033;
  margin: 2px 0 0;
  font-size: 18px;
  line-height: 1.15;
}

#collaboration-split .eyebrow {
  color: #4b6e95;
}

.collaboration-count {
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid #a9dfbf;
  border-radius: 999px;
  color: #0f6b3b;
  background:
    linear-gradient(180deg, #f8fff9, #edf9f1),
    #f1fbf5;
  font-size: 12px;
  font-weight: 750;
  padding: 5px 9px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.collaboration-warning {
  border: 1px solid #f3d9a7;
  border-radius: 8px;
  color: #83520a;
  background:
    linear-gradient(180deg, #fffaf0, #fff5df),
    #fff8e8;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.35;
  padding: 9px 10px;
}

.collaboration-preview {
  min-height: 0;
  overflow: auto;
  border: 1px solid #cadcf0;
  border-radius: 8px;
  background:
    linear-gradient(180deg, #ffffff, #fbfdff 58%, #fffdf8),
    #ffffff;
  padding: 12px;
}

.collaboration-empty {
  display: grid;
  min-height: 160px;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.collaboration-preview-title {
  display: grid;
  gap: 0;
  margin-bottom: 6px;
}

.collaboration-preview-title span {
  color: #5f7188;
  font-size: 12px;
}

.collaboration-preview-mode {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  color: #496579;
  font-size: 11px;
  font-weight: 750;
}

.collaboration-preview-mode span:last-child {
  color: #7b8fa6;
  font-weight: 650;
}

.collaboration-live-preview,
.collaboration-model-preview {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.collaboration-live-preview-scroll {
  overflow: auto;
  max-height: min(46vh, 420px);
  border: 1px solid #d4e2f2;
  border-radius: 8px;
  background:
    linear-gradient(180deg, #fbfdff, #f7fbff),
    #f8fafc;
}

.collaboration-live-preview img {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: auto;
}

.collaboration-live-preview img.is-zoomed {
  max-width: none;
}

.collaboration-preview-note {
  color: #64748b;
  font-size: 11px;
  line-height: 1.3;
}

.collaboration-deferred-detail {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 84px;
  margin-bottom: 12px;
  border: 1px solid #d9e5f4;
  border-radius: 8px;
  color: #475569;
  background: #fbfdff;
  padding: 12px;
}

.collaboration-diagram-shell {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.collaboration-diagram-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #496579;
  font-size: 11px;
  font-weight: 750;
}

.collaboration-preview-zoom {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  width: auto;
}

.collaboration-preview-zoom button {
  width: auto;
  min-width: 28px;
  min-height: 26px;
  padding: 3px 8px;
  border-radius: 7px;
  border-color: #d5e3f4;
  color: #365b7f;
  background: #f8fbff;
  font-size: 11px;
  line-height: 1;
}

.collaboration-preview-zoom button:hover:not(:disabled) {
  border-color: #bcd1eb;
  background: #eef7ff;
}

.collaboration-preview-zoom span {
  min-width: 38px;
  text-align: center;
}

.collaboration-diagram-scroll {
  overflow: auto;
  max-height: min(42vh, 360px);
  border: 1px solid #d4e2f2;
  border-radius: 8px;
  background:
    linear-gradient(180deg, #fbfdff, #f7fbff),
    #f8fafc;
}

.collaboration-diagram {
  display: block;
  max-width: none;
  min-width: 100%;
  min-height: 170px;
  background: #f7fbff;
}

.collaboration-diagram-bg {
  fill: #f7fbff;
}

.collaboration-diagram-link {
  stroke-linecap: round;
  opacity: 0.72;
}

.collaboration-diagram-link.is-selected {
  opacity: 1;
  stroke: #dc2626;
}

.collaboration-diagram-node-body {
  stroke-width: 1.4;
}

.collaboration-diagram-node.is-selected .collaboration-diagram-node-body {
  filter: drop-shadow(0 3px 6px rgba(37, 99, 235, 0.28));
  stroke-width: 3;
}

.collaboration-diagram-node.is-hyperclass .collaboration-diagram-node-body {
  stroke-width: 2.2;
}

.collaboration-diagram-hyperclass-header {
  opacity: 0.16;
  pointer-events: none;
}

.collaboration-diagram-node text {
  font-family: Arial, sans-serif;
  pointer-events: none;
}

.collaboration-diagram-title {
  font-size: 10px;
  font-weight: 800;
}

.collaboration-diagram-node.is-hyperclass .collaboration-diagram-title {
  font-size: 11px;
}

.collaboration-diagram-attribute-marker {
  opacity: 0.92;
}

.collaboration-diagram-attribute.is-selected .collaboration-diagram-attribute-marker {
  fill: #dc2626;
}

.collaboration-diagram-attribute-label,
.collaboration-diagram-attribute-more {
  fill: #334155;
  font-size: 8.6px;
  font-weight: 700;
  text-anchor: start;
}

.collaboration-diagram-attribute-more {
  fill: #64748b;
  font-style: italic;
}

.collaboration-diagram-attribute-count rect {
  opacity: 0.14;
}

.collaboration-diagram-attribute-count text {
  fill: #1f2937;
  font-size: 8.4px;
  font-weight: 800;
  text-anchor: middle;
}

.collaboration-diagram-empty {
  display: grid;
  min-height: 128px;
  margin-bottom: 12px;
  place-items: center;
  border: 1px dashed #c5d8ee;
  border-radius: 8px;
  color: #60758d;
  background: #f8fbff;
  font-size: 12px;
  font-weight: 650;
}

.collaboration-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 8px;
}

.collaboration-stat {
  border: 1px solid #d9e5f4;
  border-radius: 8px;
  background: #fbfdff;
  padding: 6px 8px;
}

.collaboration-stat:nth-child(1) {
  border-color: #ddd7f5;
  background: #faf8ff;
}

.collaboration-stat:nth-child(2) {
  border-color: #cfe0f6;
  background: #f6faff;
}

.collaboration-stat:nth-child(3) {
  border-color: #f0dfbc;
  background: #fffaf0;
}

.collaboration-stat:nth-child(4) {
  border-color: #cce8d7;
  background: #f5fcf7;
}

.collaboration-stat b {
  display: block;
  color: #172033;
  font-size: 16px;
  line-height: 1;
}

.collaboration-stat span {
  display: block;
  margin-top: 5px;
  color: #64748b;
  font-size: 11px;
}

.collaboration-operation-list {
  display: grid;
  align-content: start;
  gap: 6px;
  max-height: clamp(132px, 24vh, 280px);
  overflow: auto;
  margin: 0;
  padding: 0 4px 0 0;
  list-style: none;
}

.collaboration-operation-list li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 7px;
  border: 1px solid #d8e4f2;
  border-left-width: 4px;
  border-radius: 7px;
  background: #ffffff;
  padding: 7px 8px 7px 7px;
  color: #334155;
  font-size: 12px;
  line-height: 1.35;
}

.collaboration-change-time {
  min-width: 74px;
  border: 1px solid #d8e4f2;
  border-radius: 999px;
  color: #536b86;
  background: #f7fbff;
  padding: 1px 6px;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  font-weight: 750;
  line-height: 1.45;
  text-align: center;
  white-space: nowrap;
}

.collaboration-change-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.collaboration-operation-list li.change-added {
  border-left-color: #087443;
  background: #f7fcf9;
}

.collaboration-operation-list li.change-removed {
  border-left-color: #b42318;
  background: #fff8f7;
}

.collaboration-operation-list li.change-updated {
  border-left-color: #2563eb;
  background: #f8fbff;
}

.collaboration-operation-list li.change-moved {
  border-left-color: #7c3aed;
  background: #fbf9ff;
}

.collaboration-operation-list li.change-none {
  grid-template-columns: minmax(0, 1fr);
  border-left-color: #94a3b8;
  color: var(--muted);
  background: #f8fafc;
}

.collaboration-operation-list li.change-more {
  border-left-color: #a15c07;
  background: #fffaf0;
}

.collaboration-diff {
  display: grid;
  gap: 8px;
  border: 1px solid #dbe7f5;
  border-radius: 8px;
  background:
    linear-gradient(180deg, #ffffff, #f9fcff),
    #ffffff;
  padding: 9px;
}

.collaboration-section-title {
  color: #2f4863;
  font-size: 12px;
  font-weight: 800;
}

.collaboration-selection-detail {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  margin-bottom: 8px;
  border: 1px solid #d5e5f6;
  border-radius: 8px;
  background: #f7fbff;
  padding: 7px 9px;
  color: #334155;
  font-size: 12px;
  line-height: 1.25;
}

.collaboration-selection-detail strong {
  flex: 0 0 auto;
  color: #1f2937;
  font-weight: 800;
}

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

.collaboration-selection-detail p {
  margin: 0;
  color: #475569;
  font-size: 12px;
  line-height: 1.35;
}

.collaboration-selection-heading {
  display: grid;
  gap: 3px;
}

.collaboration-selection-heading strong {
  color: #172033;
  font-size: 13px;
}

.collaboration-selection-heading span {
  color: #64748b;
  font-size: 11px;
}

.collaboration-attribute-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 5px;
  max-height: 118px;
  overflow: auto;
  margin: 0;
  padding: 0;
  list-style: none;
}

.collaboration-attribute-list li {
  overflow: hidden;
  border: 1px solid #d7e3f1;
  border-radius: 6px;
  background: #fbfdff;
  padding: 5px 7px;
  color: #334155;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.collaboration-attribute-list li.is-selected {
  border-color: #fca5a5;
  color: #991b1b;
  background: #fff5f5;
}

.collaboration-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
}

.collaboration-actions button {
  min-height: 26px;
  border-color: #e1e8f2;
  color: #475569;
  background: #fbfdff;
  padding: 3px 5px;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.15;
}

.collaboration-actions button:hover:not(:disabled) {
  border-color: #c6d3e4;
  color: #1f2937;
  background: #f3f7fc;
}

#collaboration-merge-button {
  border-color: #d8e8df;
  color: #376149;
  background: #f7fcf9;
}

#collaboration-apply-right-button {
  border-color: #e9dfcf;
  color: #705529;
  background: #fffaf2;
}

#collaboration-apply-left-button {
  border-color: #d7e4f2;
  color: #3c5e82;
  background: #f7fbff;
}

#collaboration-merge-button:hover:not(:disabled) {
  border-color: #b9d8c4;
  background: #eef8f2;
}

#collaboration-apply-right-button:hover:not(:disabled) {
  border-color: #d8c6a8;
  background: #fff4df;
}

#collaboration-apply-left-button:hover:not(:disabled) {
  border-color: #b8cee6;
  background: #edf6ff;
}

.collaboration-client-picker {
  display: flex;
  flex: 0 1 210px;
  align-items: center;
  width: min(210px, 34vw);
  margin: 0;
  color: #64748b;
  font-size: 11px;
  font-weight: 750;
}

.collaboration-client-picker select {
  width: 100%;
  min-width: 132px;
  height: 30px;
  border-color: #c7d8ee;
  color: #27374a;
  background:
    linear-gradient(180deg, #ffffff, #f4f8ff),
    #ffffff;
  padding: 4px 28px 4px 8px;
  font-size: 12px;
}

body.embedded-shell-menu #dynamic-test-panel {
  top: var(--shell-menu-height);
  height: calc(100% - var(--shell-menu-height));
  border-top: 0;
  box-shadow: -18px 0 48px rgba(40, 54, 72, 0.1);
}

@media (max-width: 720px) {
  :root {
    --shell-menu-height: 74px;
  }
}

.panel-header {
  display: grid;
  gap: 4px;
  margin-bottom: 10px;
}

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

.eyebrow {
  color: #64748b;
  font-size: 12px;
  font-weight: 750;
}

h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.15;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.stat {
  min-height: 56px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fff;
  padding: 8px;
}

.stat-value {
  display: block;
  font-size: 18px;
  font-weight: 750;
  line-height: 1.1;
  color: #333;
}

.stat-label {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.status-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  margin-bottom: 10px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
  text-align: center;
}

.status-chip.ok {
  border-color: #b7e4c7;
  color: var(--ok);
  background: #f1fbf5;
}

.status-chip.warn {
  border-color: #f7d89d;
  color: var(--warn);
  background: #fff8e8;
}

.status-chip.error {
  border-color: #f3b8b0;
  color: var(--danger);
  background: #fff5f3;
}

.status-chip.save-status {
  font-weight: 700;
}

.validation-status {
  min-width: 0;
  min-height: 24px;
  margin-bottom: 0;
  padding: 3px 8px;
  justify-self: end;
  text-align: right;
  overflow-wrap: anywhere;
}

.validation-status[hidden] {
  display: none !important;
}

.control-group {
  --group-accent: var(--hbds-menu-accent);
  --group-border: var(--hbds-menu-line);
  --group-bg: var(--hbds-menu-surface-soft);
  --group-bg-strong: var(--hbds-menu-surface-soft);
  --group-control-bg: var(--hbds-menu-surface-soft);
  --group-summary-bg: var(--summary-bg);
  --group-summary-open-bg: var(--summary-open-bg);
  --group-collapsed-bg: var(--collapsed-bg);
  --group-collapsed-ink: var(--collapsed-ink);
  display: grid;
  gap: 9px;
  margin-bottom: 10px;
  border: 1px solid var(--group-border);
  border-left: 4px solid var(--group-accent);
  border-radius: 8px;
  background: linear-gradient(135deg, var(--group-bg-strong) 0%, var(--group-summary-bg) 100%);
  padding: 10px;
}

details.control-group {
  display: block;
  padding: 0;
  overflow: hidden;
  background: linear-gradient(135deg, var(--group-bg-strong) 0%, var(--group-summary-bg) 100%);
}

details.control-group > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 36px;
  cursor: pointer;
  list-style: none;
  padding: 9px 10px;
  font-size: 13px;
  font-weight: 760;
  color: var(--group-accent);
  background: linear-gradient(90deg, var(--group-bg-strong), var(--group-summary-bg));
}

details.control-group > summary::-webkit-details-marker {
  display: none;
}

details.control-group > summary::after {
  content: "+";
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  color: var(--group-accent);
  background: var(--group-bg-strong);
  font-size: 16px;
  line-height: 1;
  text-align: center;
}

details.control-group[open] > summary {
  background: linear-gradient(90deg, var(--group-bg-strong) 0%, var(--group-summary-open-bg) 100%);
}

details.control-group[open] > summary::after {
  content: "-";
}

details.control-group:not([open]) > summary {
  color: var(--group-accent);
  background: linear-gradient(90deg, var(--group-collapsed-bg) 0%, var(--group-summary-bg) 100%);
  box-shadow: inset 4px 0 0 var(--group-accent);
}

details.control-group:not([open]) > summary::after {
  color: var(--on-accent);
  background: var(--group-accent);
}

details.control-group > .details-body {
  display: grid;
  gap: 9px;
  border-top: 1px solid var(--group-border);
  background: linear-gradient(160deg, var(--group-bg-strong) 0%, var(--group-summary-open-bg) 100%);
  padding: 10px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 1px;
  font-size: 13px;
  font-weight: 760;
  color: var(--group-accent);
}

.control-group label {
  color: #333;
}

.control-group select,
.control-group textarea,
.control-group input[type="text"],
.control-group input[type="password"] {
  border-color: var(--group-border);
  background: var(--control-bg);
}

.control-group button:not(.primary):not(.danger):not(.quiet) {
  border-color: var(--group-border);
  background: var(--control-bg);
}

.control-group button:not(.primary):not(.danger):not(.quiet):hover:not(:disabled) {
  border-color: var(--group-accent);
  color: var(--accent);
  background: var(--group-bg-strong);
}

details.control-group > summary .section-title {
  width: 100%;
  margin: 0;
}

.control-group[data-section="model"] {
  --group-accent: var(--hbds-menu-model-accent);
  --group-bg-strong: #edf5ff;
  --group-summary-bg: #f8fbff;
  --group-summary-open-bg: #eef6ff;
  --group-collapsed-bg: #e7f0ff;
}

.control-group[data-section="ai-support"] {
  --group-accent: #be185d;
  --group-bg-strong: #fff0f6;
  --group-summary-bg: #fff8fb;
  --group-summary-open-bg: #fff1f7;
  --group-collapsed-bg: #fde4ef;
  --group-border: #f9a8d4;
}

.control-group[data-section="scenario-suite"] {
  --group-accent: var(--hbds-menu-mode-accent);
  --group-bg-strong: #f5efff;
  --group-summary-bg: #fcf9ff;
  --group-summary-open-bg: #f7f1ff;
  --group-collapsed-bg: #f0e5ff;
}

.control-group[data-section="layout-session"],
.control-group[data-section="layout-view"],
.control-group[data-section="layout-and-view"] {
  --group-accent: var(--hbds-menu-layout-accent);
  --group-bg-strong: #e8f7f4;
  --group-summary-bg: #f7fcfb;
  --group-summary-open-bg: #eef9f7;
  --group-collapsed-bg: #ddf3ef;
}

.control-group[data-section="model-builder"] {
  --group-accent: var(--hbds-menu-builder-accent);
  --group-bg-strong: #fff1e8;
  --group-summary-bg: #fffaf7;
  --group-summary-open-bg: #fff4ec;
  --group-collapsed-bg: #ffe9dc;
}

.control-group[data-section="productivity"] {
  --group-accent: #2563eb;
  --group-bg-strong: #eef6ff;
  --group-summary-bg: #f8fbff;
  --group-summary-open-bg: #edf6ff;
  --group-collapsed-bg: #e2efff;
  --group-border: #bfdbfe;
}

.control-group[data-section="settings"] {
  --group-accent: var(--hbds-menu-settings-accent);
  --group-bg-strong: #fffef7;
  --group-summary-bg: #fffffb;
  --group-summary-open-bg: #fffdf0;
  --group-collapsed-bg: #fff8d8;
  --group-collapsed-ink: #5f370e;
}

.control-group[data-section="json"] {
  --group-accent: var(--hbds-menu-json-accent);
  --group-bg-strong: #f1f5f9;
  --group-summary-bg: #fbfcfe;
  --group-summary-open-bg: #f3f6fa;
  --group-collapsed-bg: #e9eef5;
}

.control-group[data-section="session"] {
  --group-accent: var(--hbds-menu-session-accent);
  --group-bg-strong: #fff0f4;
  --group-summary-bg: #fff9fb;
  --group-summary-open-bg: #fff2f6;
  --group-collapsed-bg: #ffe5ed;
}

.control-group[data-section="validation"] {
  --group-accent: #b45309;
  --group-bg-strong: #fff7ed;
  --group-summary-bg: #fffaf5;
  --group-summary-open-bg: #fff3e4;
  --group-collapsed-bg: #ffedd5;
  --group-border: #fed7aa;
}

.control-group[data-section="share"] {
  --group-accent: #0f766e;
  --group-bg-strong: #ecfdf5;
  --group-summary-bg: #f7fffb;
  --group-summary-open-bg: #effcf6;
  --group-collapsed-bg: #dff8ea;
  --group-border: #bbf7d0;
}

.section-meta,
.inline-hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

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

.share-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.share-warning {
  color: #92400e;
  font-weight: 700;
}

.validation-issues {
  display: grid;
  gap: 7px;
}

.validation-empty {
  min-height: 28px;
  display: flex;
  align-items: center;
  color: var(--ok);
  font-size: 12px;
  font-weight: 700;
}

.validation-issue {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  gap: 8px;
  width: 100%;
  min-height: 34px;
  align-items: start;
  border: 1px solid var(--group-border);
  border-radius: 8px;
  padding: 7px 8px;
  background: #ffffff;
  color: #172033;
  text-align: left;
  font-size: 12px;
  line-height: 1.3;
}

.validation-issue:hover:not(:disabled) {
  border-color: var(--group-accent);
  background: var(--group-bg-strong);
}

.validation-issue:disabled {
  cursor: default;
  opacity: 0.82;
}

.validation-issue-kind {
  font-weight: 800;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0;
}

.validation-issue.error .validation-issue-kind {
  color: var(--danger);
}

.validation-issue.warn .validation-issue-kind {
  color: var(--warn);
}

.validation-issue-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.builder-separator {
  height: 1px;
  margin: 2px 0;
  background: #ddd;
}

.link-builder-actions {
  display: none;
}

.link-builder-actions.is-active {
  display: grid;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 34px;
  border: 1px solid var(--group-border);
  border-radius: 8px;
  background: var(--group-control-bg);
  padding: 7px 9px;
  font-size: 12px;
  font-weight: 650;
}

.toggle-row input {
  width: auto;
  margin: 0;
}

.inline-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 34px;
  border: 1px solid var(--group-border);
  border-radius: 8px;
  background: var(--group-control-bg);
  padding: 7px 9px;
  font-size: 12px;
  font-weight: 650;
}

.compact-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  border: 1px solid var(--group-border);
  border-radius: 8px;
  background: var(--group-control-bg);
  padding: 4px 7px;
}

.compact-field span {
  flex: 0 0 auto;
  color: #334155;
  font-size: 12px;
  font-weight: 750;
}

.compact-field select {
  min-width: 0;
  min-height: 28px;
  border: 0;
  background: transparent;
  padding: 3px 4px;
}

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

.inline-field input[type="text"] {
  min-width: 0;
  flex: 1 1 auto;
}

.ai-secret-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.ai-secret-row button {
  width: auto;
  min-width: 64px;
  white-space: nowrap;
}

.range-field {
  display: grid;
  grid-template-columns: minmax(92px, 0.9fr) minmax(120px, 1.1fr);
  align-items: center;
  gap: 8px;
  min-height: 32px;
  font-size: 12px;
  font-weight: 650;
}

.range-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.range-value {
  min-width: 44px;
  color: var(--group-accent);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.settings-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.selected-card {
  display: grid;
  gap: 3px;
  min-height: 50px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fff;
  padding: 9px;
}

.selected-name {
  overflow-wrap: anywhere;
  font-weight: 750;
}

.selected-meta {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 12px;
}

.property-panel {
  display: grid;
  gap: 8px;
  margin-top: 2px;
  border-top: 1px solid var(--group-border);
  padding-top: 10px;
}

.property-panel-title {
  color: var(--group-accent);
  font-size: 13px;
  font-weight: 800;
}

.inspector-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 2px;
}

.inspector-subtitle {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.inspector-actions {
  display: inline-flex;
  gap: 6px;
  flex: 0 0 auto;
}

.inspector-icon-button,
.inspector-reset-button {
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 7px;
  font-size: 11px;
}

.property-empty {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.property-group {
  display: grid;
  gap: 8px;
  margin: 0;
  border: 1px solid var(--group-border);
  border-radius: 8px;
  background: var(--group-control-bg);
  padding: 8px;
}

.property-group legend {
  padding: 0 5px;
  color: #64748b;
  font-size: 11px;
  font-weight: 760;
}

.property-row {
  display: grid;
  grid-template-columns: minmax(96px, 0.85fr) minmax(0, 1.15fr);
  align-items: center;
  gap: 8px;
  min-height: 32px;
  color: #333;
  font-size: 12px;
  font-weight: 650;
}

.property-row input[type="text"],
.property-row input[type="number"],
.property-row select {
  width: 100%;
  min-height: 32px;
  border: 1px solid var(--group-border);
  border-radius: 8px;
  color: var(--ink);
  background: var(--control-bg);
  padding: 6px 8px;
  font: inherit;
  font-weight: 500;
}

.property-row input[type="checkbox"] {
  justify-self: start;
  width: auto;
  margin: 0;
}

.property-row input[type="color"] {
  justify-self: start;
}

.inspector-section {
  border: 1px solid var(--group-border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.35);
  overflow: hidden;
}

.inspector-section > summary {
  cursor: pointer;
  list-style: none;
  padding: 8px 10px;
  color: var(--group-accent);
  background: linear-gradient(90deg, var(--group-bg-strong), rgba(255, 255, 255, 0.45));
  font-size: 12px;
  font-weight: 800;
}

.inspector-section > summary::-webkit-details-marker {
  display: none;
}

.inspector-section-body {
  display: grid;
  gap: 9px;
  padding: 10px;
}

.inspector-row {
  display: grid;
  grid-template-columns: minmax(86px, 0.72fr) minmax(0, 1.28fr);
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 680;
}

.inspector-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.inspector-control > input[type="text"],
.inspector-control > input[type="number"],
.inspector-control > select,
.inspector-control > textarea,
.color-control input[type="text"],
.slider-number-control input[type="number"] {
  width: 100%;
  min-height: 32px;
  border: 1px solid var(--group-border);
  border-radius: 8px;
  color: var(--ink);
  background: var(--control-bg);
  padding: 6px 8px;
  font: inherit;
  font-weight: 520;
}

.inspector-control > textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.35;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 11px;
  grid-column: 1 / -1;
}

.slider-number-control {
  display: grid;
  grid-template-columns: minmax(72px, 1fr) 68px;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.slider-number-control input[type="range"] {
  width: 100%;
  accent-color: var(--group-accent);
}

.color-control {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.color-control input[type="color"] {
  width: 42px;
  height: 32px;
  border: 1px solid var(--group-border);
  border-radius: 8px;
  background: var(--control-bg);
  padding: 3px;
  cursor: pointer;
}

.recent-colors {
  display: flex;
  grid-column: 1 / -1;
  gap: 5px;
  min-height: 0;
}

.recent-colors:empty {
  display: none;
}

.color-swatch {
  width: 20px;
  height: 20px;
  min-height: 20px;
  border: 1px solid rgba(15, 23, 42, 0.22);
  border-radius: 999px;
  padding: 0;
}

.inspector-control input[type="checkbox"] {
  justify-self: start;
  width: auto;
  margin: 0;
  accent-color: var(--group-accent);
}

.danger-zone {
  display: grid;
  gap: 8px;
  margin-top: 2px;
  padding-top: 10px;
  border-top: 1px solid #f1c6c1;
}

#layout-status {
  min-height: 112px;
  margin: 0;
  overflow: auto;
  border: 1px solid #263241;
  border-radius: 8px;
  background: #111827;
  color: #d9fbe7;
  padding: 9px;
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
}

#toast {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 45;
  max-width: min(420px, calc(100% - var(--panel-width) - 48px));
  min-height: 34px;
  padding: 9px 12px;
  border: 1px solid rgba(84, 96, 112, 0.22);
  border-radius: 8px;
  background: rgba(24, 32, 42, 0.94);
  color: #ffffff;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 160ms ease, transform 160ms ease;
}

#toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.command-palette {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 72px 16px 16px;
  background: rgba(15, 23, 42, 0.38);
}

.command-palette[hidden] {
  display: none;
}

.command-palette-panel {
  width: min(560px, calc(100vw - 32px));
  max-height: min(620px, calc(100vh - 104px));
  display: grid;
  gap: 10px;
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, 0.22);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
  padding: 12px;
}

.command-palette-panel label {
  color: #172033;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

#command-palette-input {
  min-height: 40px;
  border: 1px solid #cad6e3;
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 14px;
}

.command-palette-list {
  display: grid;
  gap: 5px;
  max-height: min(470px, calc(100vh - 210px));
  overflow: auto;
}

.modal-shell {
  position: fixed;
  inset: 0;
  z-index: 82;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.46);
  padding: 18px;
}

.modal-shell[hidden] {
  display: none !important;
}

.modal-panel {
  width: min(760px, calc(100vw - 36px));
  max-height: calc(100vh - 36px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.28);
  padding: 14px;
}

.modal-header,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.modal-header h2 {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
}

.modal-actions {
  justify-content: flex-end;
  flex-wrap: nowrap;
  margin-top: 12px;
}

.modal-actions button {
  min-width: 112px;
  white-space: nowrap;
}

.ai-diff-panel {
  display: grid;
  gap: 12px;
}

.ai-diff-actions button {
  flex: 1 1 0;
  font-weight: 750;
}

#ai-diff-preview-button {
  border-color: #93c5fd;
  color: #1d4ed8;
  background: #eff6ff;
}

#ai-diff-preview-button:hover:not(:disabled) {
  border-color: #60a5fa;
  background: #dbeafe;
}

#ai-diff-apply-new-button {
  border-color: #c084fc;
  color: #6b21a8;
  background: #faf5ff;
}

#ai-diff-apply-new-button:hover:not(:disabled) {
  border-color: #a855f7;
  background: #f3e8ff;
}

#ai-diff-cancel-button {
  border-color: #cbd5e1;
  color: #334155;
  background: #f8fafc;
}

#ai-diff-close-button {
  border-color: #f1c6c1;
  color: #b42318;
  background: #fff8f7;
}

.ai-diff-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.ai-diff-summary > div {
  min-height: 44px;
  border: 1px solid #f9a8d4;
  border-radius: 8px;
  background: #fff0f6;
  padding: 8px;
  color: #4a1029;
  font-size: 12px;
  font-weight: 750;
  text-align: center;
}

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

.ai-diff-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 10px;
}

.ai-diff-section h3 {
  margin: 0 0 6px;
  color: var(--ink);
  font-size: 13px;
}

.ai-diff-section ul {
  margin: 0;
  padding-left: 18px;
  color: #334155;
  font-size: 12px;
  line-height: 1.35;
}

.ai-diff-warning {
  border-color: #f3b8b0;
  background: #fff5f3;
}

.ai-diff-confirm {
  align-items: flex-start;
}

@media (max-width: 760px) {
  .modal-actions {
    flex-wrap: wrap;
  }

  .modal-actions button {
    flex: 1 1 150px;
  }
}

.command-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #f8fafc;
  color: #172033;
  padding: 8px 10px;
  text-align: left;
}

.command-item.is-active,
.command-item:hover:not(:disabled) {
  border-color: #8bb8e8;
  background: #eef6ff;
}

.command-item:disabled {
  opacity: 0.56;
  cursor: default;
}

.command-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.command-meta {
  color: var(--muted);
  font-size: 11px;
}

.command-empty {
  min-height: 40px;
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  padding: 8px 10px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  padding: 0;
}

@media (max-width: 900px) {
  #model-tree-sidebar {
    display: none;
  }

  #container {
    inset: 0 0 var(--panel-height) 0;
  }

  body.has-collaboration-split #container {
    inset: 0 0 var(--panel-height) 0;
  }

  #collaboration-split {
    top: 12px;
    right: 12px;
    width: calc(100vw - 24px);
    height: min(58vh, calc(100vh - 24px));
    min-width: min(320px, calc(100vw - 24px));
    min-height: 320px;
    max-width: calc(100vw - 24px);
    max-height: min(58vh, calc(100vh - 24px));
  }

  body.embedded-shell-menu #collaboration-split {
    top: 12px;
  }

  #dynamic-test-panel {
    top: auto;
    bottom: 0;
    width: 100%;
    height: var(--panel-height);
    border-top: 1px solid #ddd;
    border-left: 0;
    box-shadow: 0 -18px 48px rgba(40, 54, 72, 0.12);
  }

  #model-overview {
    left: 16px;
    width: 168px;
    height: 112px;
  }

  #toast {
    max-width: calc(100% - 36px);
    bottom: calc(var(--panel-height) + 14px);
  }

  .command-palette {
    padding-top: 28px;
  }

  .command-palette-panel {
    max-height: calc(100vh - 56px);
  }

  .command-palette-list {
    max-height: calc(100vh - 170px);
  }
}
