:root {
  color-scheme: light;
  --bg: #f3f4f6;
  --panel: #ffffff;
  --ink: #111827;
  --muted: #6b7280;
  --line: rgba(17, 24, 39, 0.12);
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.12);
  --shadow: 0 8px 24px rgba(17, 24, 39, 0.08);
  --editor: #1e1f24;
  --editor-ink: #e7e9ee;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
}

body {
  display: grid;
  grid-template-rows: 52px 1fr;
  min-height: 100%;
}

.workspace {
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.workspace > #component-workspace {
  flex: 1 1 auto;
  min-height: 0;
}

.workspace > #tokens-workspace {
  display: none;
  flex: 1 1 auto;
  min-height: 0;
}

.workspace[data-mode="tokens"] > #component-workspace {
  display: none !important;
}

.workspace[data-mode="tokens"] > #tokens-workspace {
  display: flex;
}

.stage-pane[hidden] {
  display: none !important;
}

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

.app-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.app-bar__start {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
  justify-self: start;
}

.app-bar__center {
  display: flex;
  align-items: center;
  gap: 16px;
  justify-self: center;
}

.app-bar__title {
  font-weight: 650;
  letter-spacing: -0.02em;
  flex: 0 0 auto;
}

.app-bar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-self: end;
}

.app-bar__actions .app-bar__theme {
  flex: 0 0 auto;
}

.app-bar__group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.app-bar__group + .app-bar__group {
  padding-left: 12px;
  border-left: 1px solid var(--line);
}

.app-bar__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}

.app-bar__btn:hover {
  background: #f8fafc;
}

.app-bar__btn:active {
  transform: scale(0.98);
}

.app-bar__btn.is-busy {
  opacity: 0.7;
  pointer-events: none;
}

.mode-switch {
  display: inline-flex;
  padding: 2px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f3f4f6;
}

.mode-switch__btn {
  min-height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.mode-switch__btn.is-active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.08);
}

.theme-switch {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f3f4f6;
}

.theme-switch__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.theme-switch__btn:active { transform: scale(0.96); }

.theme-switch__btn.is-active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.08);
}

.theme-switch__btn:focus-visible {
  outline: 2px solid var(--accent-soft);
  outline-offset: 1px;
}

.app-bar__theme,
.app-bar__local-examples.is-active {
  background: var(--gray-3, #e2e8f0);
}

.app-bar__workspace {
  flex: 0 0 auto;
}

.app-bar__workspace.viewport select {
  min-width: 12rem;
  max-width: 22rem;
}

.split {
  --col-tree: 260px;
  --col-props: 280px;
  --col-editor: minmax(224px, 0.7fr);
  display: grid;
  grid-template-columns: var(--col-tree) var(--col-props) var(--col-editor) minmax(280px, 1.2fr);
  flex: 1 1 auto;
  min-height: 0;
}

.page-meta {
  margin: 0;
  padding: 8px 16px;
  list-style: none;
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--muted);
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}

.page-canvas {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #e5e7eb;
}

.model-toolbars {
  position: absolute;
  top: 16px;
  left: 50%;
  z-index: 20;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transform: translateX(-50%);
  pointer-events: none;
}

.model-toolbars > * {
  pointer-events: auto;
}

.model-toolbar {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 9999px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

button.model-toolbar--solo {
  padding: 4px 14px;
  font-size: 12px;
  font-weight: 500;
  line-height: 32px;
  color: var(--muted);
  cursor: pointer;
}

.model-toolbar__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 9999px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.model-toolbar__btn:hover {
  background: #f3f4f6;
}

.model-toolbar__btn--active {
  background: var(--accent-soft);
  color: var(--accent);
}

.model-toolbar__zoom {
  min-width: 44px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

.model-toolbar__icon {
  display: block;
  flex-shrink: 0;
}

.model-toolbar--page {
  gap: 0;
  padding: 4px 10px 4px 12px;
  max-width: min(14rem, 40vw);
}

.model-toolbar__page-select {
  min-width: 0;
  max-width: 100%;
  height: 32px;
  padding: 0 20px 0 0;
  border: none;
  border-radius: 9999px;
  background: transparent;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16'%3E%3Cpath fill='%236b7280' d='M4.427 6.427l3.396 3.396a.25.25 0 0 0 .354 0l3.396-3.396A.25.25 0 0 0 11.396 6H4.604a.25.25 0 0 0-.177.427Z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 2px center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-toolbar__page-select:hover {
  color: var(--accent);
}

.model-toolbar__page-select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.page-canvas__viewport {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  outline: none;
}

.page-canvas__viewport--select {
  cursor: default;
}

.page-canvas__viewport--pan,
.page-canvas__viewport--grabbing {
  cursor: grab;
}

.page-canvas__viewport.page-canvas__viewport--grabbing {
  cursor: grabbing;
}

.page-canvas__grid {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.page-canvas__grid-dot {
  fill: rgba(17, 24, 39, 0.14);
}

.page-canvas__world {
  position: absolute;
  inset: 0;
  transform-origin: 0 0;
}

.page-canvas__frames {
  display: flex;
  align-items: flex-start;
  gap: 48px;
  padding: 48px;
  width: max-content;
}

.hv-page-frame {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hv-page-frame__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.hv-page-frame__screen {
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid rgba(17, 24, 39, 0.12);
  background: #111827;
  box-shadow:
    0 1px 2px rgba(17, 24, 39, 0.06),
    0 8px 24px rgba(17, 24, 39, 0.08);
}

.hv-page-frame__body {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  width: 100%;
  min-height: 0;
}

.hv-page-frame__main {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  align-items: stretch;
  min-width: 0;
}

.hv-page-frame__main > .hv-page-chrome {
  width: 100%;
  align-self: stretch;
  box-sizing: border-box;
}

.hv-page-chrome {
  flex: 0 0 auto;
  min-width: 0;
  box-sizing: border-box;
}

.hv-page-frame__body > .hv-page-chrome[data-card="sidebar"] {
  width: auto;
  flex: 0 0 auto;
  align-self: stretch;
}

.hv-overlay-backdrop {
  position: relative;
  width: 100%;
  min-height: 120px;
}

.hv-overlay-panel {
  position: relative;
  z-index: 1;
  margin-inline: auto;
  max-width: min(420px, calc(100% - 32px));
  width: 100%;
  box-sizing: border-box;
}

.hv-field-slot {
  align-self: stretch;
  width: 100%;
  max-width: 100%;
}

.hv-field-slot--email {
  padding-left: var(--padding-4, 16px);
  padding-right: var(--padding-4, 16px);
  box-sizing: border-box;
}

.hv-field-mount {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
}

.hv-field-country {
  position: relative;
  flex: 0 0 auto;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}

.hv-field-slot__country-select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  border: 0;
  margin: 0;
  padding: 0;
  font: inherit;
}

.hv-field-slot__input {
  font: inherit;
  color: inherit;
  background: transparent;
  border: 0;
  outline: none;
  min-width: 0;
  flex: 1;
  width: 100%;
}

.hv-field-slot__input::placeholder {
  color: var(--auth-muted, rgba(255, 255, 255, 0.45));
  opacity: 1;
}

.hv-field-slot__error {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.3;
  color: #f87171;
}

/* Dialog-on-backdrop layout only; without backdrop (e.g. auth modal) negative margin clips the top. */
.hv-overlay-backdrop + .hv-overlay-panel {
  margin-top: -80px;
}

.preview:has(.hv-overlay-panel):not(:has(.hv-overlay-backdrop)) {
  padding-top: 8px;
}

.preview-block.is-overlay-sheet .frame {
  max-width: 390px;
  margin-inline: auto;
}

.page-canvas__sprite-host {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

.split.is-tree-hidden { --col-tree: 40px; }
.split.is-props-hidden { --col-props: 40px; }
.split.is-editor-hidden { --col-editor: 40px; }

.pane {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--panel);
}

.pane--tree,
.pane--props,
.pane--editor {
  position: relative;
}

.pane-resize {
  position: absolute;
  top: 0;
  right: -3px;
  z-index: 3;
  width: 6px;
  height: 100%;
  touch-action: none;
  cursor: col-resize;
}

.pane-resize::after {
  content: "";
  position: absolute;
  inset: 0 -2px;
}

.pane-resize:hover::after,
.pane-resize.is-dragging::after {
  background: rgba(37, 99, 235, 0.18);
}

.split.is-tree-hidden .pane-resize--tree,
.split.is-props-hidden .pane-resize--props,
.split.is-editor-hidden .pane-resize--editor {
  display: none;
}

body.is-resizing-pane {
  cursor: col-resize;
  user-select: none;
}

.pane--stage {
  border-right: 0;
  background: transparent;
}

.stage-pane {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.pane__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 40px;
  padding: 0 8px 0 12px;
  font-size: 13px;
  font-weight: 600;
  border-bottom: 1px solid var(--line);
  background: #fafafa;
}

.pane__actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}

.pane__head--preview {
  gap: 12px;
}

.pane__head-tools {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.preview-surface-controls {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
}

button.pane__save {
  min-height: 28px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  flex: 0 0 auto;
}

button.pane__save:hover:not(:disabled) { background: #f8fafc; }

button.pane__save:active:not(:disabled) { transform: scale(0.98); }

button.pane__save:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

button.pane__save.is-copied {
  color: #059669;
  border-color: rgba(5, 150, 105, 0.35);
}

button.pane__copy {
  min-width: 28px;
  min-height: 28px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  flex: 0 0 auto;
}

button.pane__copy:hover { background: #f8fafc; }

button.pane__copy:active { transform: scale(0.98); }

button.pane__copy.is-copied {
  color: #059669;
  border-color: rgba(5, 150, 105, 0.35);
}

button.pane__toggle {
  min-width: 28px;
  min-height: 28px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  box-shadow: none;
  outline: none;
}

button.pane__toggle:hover {
  background: rgba(17, 24, 39, 0.06);
}

.pane.is-collapsed > :not(.pane__head) { display: none; }

.pane.is-collapsed .pane__head {
  flex: 0 0 auto;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  height: auto;
  min-height: 40px;
  padding: 8px 4px;
}

.pane.is-collapsed .pane__toggle,
.pane.is-collapsed .pane__actions {
  order: -1;
}

.pane.is-collapsed .pane__actions {
  flex-direction: column;
  gap: 8px;
}

.pane.is-collapsed .pane__title {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  flex: 0 0 auto;
  max-height: min(240px, 50vh);
  overflow: hidden;
  text-overflow: ellipsis;
}

.pane.is-collapsed button.pane__save {
  min-width: 28px;
  padding: 0;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 11px;
  letter-spacing: 0.02em;
}

.pane.is-collapsed .pane__toggle svg { transform: scaleX(-1); }

.tree {
  overflow: auto;
  padding: 8px 0 16px;
  outline: none;
}

.tree-branch[hidden] {
  display: none;
}

.tree-row-head {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  min-height: 28px;
}

.tree-row-head .tree-leaf {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
}

.tree-bulk-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 2px;
  padding-right: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms ease;
}

.tree-row-head:hover .tree-bulk-actions,
.tree-row-head:focus-within .tree-bulk-actions {
  opacity: 1;
  pointer-events: auto;
}

.tree-bulk-btn {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.tree-bulk-btn:hover {
  color: var(--ink);
  background: rgba(17, 24, 39, 0.08);
}

.tree-bulk-btn:active {
  transform: scale(0.96);
}

.tree-bulk-btn__icon {
  width: 14px;
  height: 14px;
}

.tree-leaf {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-width: 0;
  min-height: 28px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font-size: 13px;
}

.tree-leaf:hover { background: #f3f4f6; }

.tree-leaf.is-selected { background: #e8eefc; }

.tree-leaf__mark {
  width: 16px;
  color: var(--muted);
  flex: 0 0 auto;
  text-align: center;
}

.tree-leaf__toggle {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  cursor: pointer;
  border-radius: 4px;
}

.tree-leaf__toggle:hover {
  color: var(--ink);
  background: rgba(17, 24, 39, 0.08);
}

.tree-leaf__chevron {
  width: 16px;
  height: 16px;
  transition: transform 150ms ease;
}

.tree-leaf__chevron.is-collapsed {
  transform: rotate(-90deg);
}

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

.tree-tooltip {
  position: fixed;
  z-index: 1000;
  max-width: min(420px, calc(100vw - 16px));
  padding: 6px 10px;
  border-radius: 8px;
  background: #111827;
  color: #f9fafb;
  font-size: 12px;
  line-height: 16px;
  white-space: normal;
  word-break: break-word;
  pointer-events: none;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.08),
    0 4px 12px rgba(0, 0, 0, 0.12);
}

.editor-shell {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
}

#source {
  flex: 1;
  width: 100%;
  margin: 0;
  padding: 12px 14px;
  border: 0;
  resize: none;
  background: var(--editor);
  color: var(--editor-ink);
  font-family: ui-monospace, Menlo, Monaco, monospace;
  font-size: 12px;
  line-height: 18px;
  outline: none;
}

.editor-measure {
  position: absolute;
  top: 0;
  left: 0;
  visibility: hidden;
  pointer-events: none;
  white-space: pre;
}

.editor-swatches {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.editor-swatches__layer {
  position: absolute;
  inset: 0;
}

.editor-swatch {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.error {
  padding: 8px 12px;
  color: #991b1b;
  background: #fee2e2;
  font-size: 13px;
}

.stage {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 24px;
}

.preview-block {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  margin: 0 auto;
  max-width: 100%;
}

.preview-block.is-fluid {
  width: 100%;
  min-width: 0;
}

.preview-block.is-fixed {
  width: var(--preview-block-width);
  min-width: var(--preview-block-width);
}

.frame {
  margin: 0 auto;
  background: var(--frame-preview-bg, #d8dce3);
  border-radius: 16px;
  padding: 24px 0 48px;
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.06);
  max-width: 100%;
  width: 100%;
}

.frame.is-fluid {
  min-width: 0;
}

.frame.is-fixed {
  width: 100%;
  min-width: 0;
}

.preview-breakpoint-hint {
  margin: 0 16px 16px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(17, 24, 39, 0.06);
  border: 1px solid rgba(17, 24, 39, 0.1);
  color: #1f2937;
  font-size: 13px;
  line-height: 1.45;
}

.preview-breakpoint-hint__title {
  margin: 0 0 10px;
}

.preview-breakpoint-hint__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.preview-breakpoint-hint__label {
  color: #4b5563;
  font-size: 12px;
}

.preview-breakpoint-hint__btn {
  appearance: none;
  border: 1px solid rgba(17, 24, 39, 0.14);
  border-radius: 8px;
  background: #fff;
  color: #111827;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 10px;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease;
}

.preview-breakpoint-hint__btn:hover {
  background: #f9fafb;
  border-color: rgba(17, 24, 39, 0.22);
}

.preview-breakpoint-hint__btn:active {
  transform: scale(0.98);
}

.preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  min-height: 56px;
}

.preview > .hv-root {
  width: 100%;
  align-self: stretch;
  flex: 0 0 auto;
  margin-inline: auto;
}

.preview > .hv-root[data-card="sidebar"] {
  width: auto;
  align-self: flex-start;
  margin-inline: 0;
}

/* Carousel rows: the client scrolls them with the section arrows. */
.preview > .hv-root[data-card="lobby"] [id^="lobby-row-"] {
  overflow: hidden;
}

.hv-widget-element-host {
  display: block;
  width: 100%;
  min-height: 240px;
  padding: 24px 16px;
  box-sizing: border-box;
  overflow-x: auto;
}

.hv-widget-element-host > .hv-node {
  flex: 0 0 auto;
  width: max-content;
  max-width: none;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.22);
}

.frame.is-fluid .preview {
  min-width: min(960px, 100%);
}

.frame.is-fixed .preview {
  min-width: 0;
  width: 100%;
  overflow-x: auto;
}

.viewport {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  color: var(--muted);
}

.viewport select {
  min-width: 9rem;
  max-width: 12rem;
  min-height: 28px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
}

.viewport--color input[type="color"] {
  width: 28px;
  height: 28px;
  padding: 2px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
}

.viewport--color input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.viewport--color input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 4px;
}

.widget-dataset-panel {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.05);
}

.widget-dataset-panel[hidden] {
  display: none;
}

.widget-dataset-panel__kind {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

.widget-dataset-panel .viewport select {
  min-width: 12rem;
  max-width: 28rem;
}

.widget-preview-mode {
  display: inline-flex;
  padding: 2px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f4f4f5;
  gap: 2px;
}

.widget-preview-mode__btn {
  min-height: 26px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}

.widget-preview-mode__btn.is-active {
  background: #fff;
  color: var(--text, #111);
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.08);
}

.widget-dataset-panel.is-skeleton .widget-preview-dataset {
  opacity: 0.45;
  pointer-events: none;
}

.meta, #actions {
  margin: 0;
  padding: 8px 12px 12px;
  list-style: none;
  font-size: 12px;
  color: var(--muted);
}

.meta { display: flex; gap: 16px; }

.log {
  border-top: 1px solid var(--line);
  background: var(--panel);
  flex: 0 0 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.log:not(.is-collapsed) {
  max-height: 180px;
}

.log .pane__head {
  flex: 0 0 auto;
}

.log.is-collapsed .pane__head {
  border-bottom: 0;
}

.log.is-collapsed .pane__toggle svg {
  transform: scaleX(-1);
}

.log.is-collapsed > #actions {
  display: none;
}

#actions {
  overflow: auto;
  flex: 1 1 auto;
  min-height: 0;
}

#actions li {
  padding: 4px 0;
  font-family: ui-monospace, Menlo, monospace;
}

a.hv-node {
  text-decoration: none;
  color: inherit;
}

.preview [data-hv-key],
.page-canvas__frames [data-hv-key] {
  cursor: pointer;
}

.hv-node.is-hit {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

@media (max-width: 1100px) {
  .split {
    --col-tree: 220px;
    --col-props: 240px;
    --col-editor: minmax(168px, 0.7fr);
    grid-template-columns: var(--col-tree) var(--col-props) var(--col-editor);
  }
  .pane--stage { grid-column: 1 / -1; min-height: 420px; }
}

.props-inspector {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 8px 10px 12px;
  font-size: 12px;
}

.props-inspector__empty {
  margin: 12px 4px;
  color: var(--muted);
  line-height: 1.45;
}

.props-inspector__layer {
  margin: 0 0 10px;
  padding: 6px 8px;
  border-radius: 6px;
  background: #f3f4f6;
  color: var(--muted);
  font-size: 11px;
}

.props-section {
  margin-bottom: 14px;
}

.props-section__title {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.props-contract__intro,
.props-contract__empty {
  margin: 0 0 8px;
  color: var(--muted);
  line-height: 1.4;
}

.props-contract__group {
  margin-bottom: 10px;
}

.props-contract__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.props-contract__label {
  color: var(--ink);
  font-weight: 600;
}

.props-contract__toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--muted);
  font-weight: 500;
  cursor: pointer;
  user-select: none;
}

.props-contract__toggle input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: #5b5bd6;
}

#preview .hv-field-bind,
.page-canvas .hv-field-bind {
  outline: 2px solid #5b5bd6;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(91, 91, 214, 0.28);
}

.props-contract__row {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 4px 8px;
  align-items: baseline;
  padding: 4px 0;
  border-top: 1px solid var(--line);
}

.props-contract__name {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  word-break: break-all;
}

.props-contract__meta {
  color: var(--muted);
  line-height: 1.35;
}

.props-field {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 6px 8px;
  align-items: center;
  margin-bottom: 8px;
}

.props-field__label {
  color: var(--muted);
  font-size: 11px;
}

.props-field__control {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.props-field__control select,
.props-field__control input[type="text"],
.props-field__control input[type="number"],
.props-field__control textarea,
.props-text-input {
  width: 100%;
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font: inherit;
  color: var(--ink);
}

.props-field__control textarea,
.props-text-input {
  min-height: 72px;
  resize: vertical;
  line-height: 1.35;
}

.props-field__control select:focus,
.props-field__control input:focus,
.props-field__control textarea:focus {
  outline: 2px solid var(--accent-soft);
  border-color: var(--accent);
}

.props-field__row {
  display: flex;
  gap: 4px;
  align-items: center;
}

.props-field__mode {
  flex: 0 0 auto;
  min-height: 28px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-size: 11px;
  cursor: pointer;
}

.props-field__mode:active { transform: scale(0.98); }

.props-field__mode.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.props-color-picker {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}

.props-color-picker__trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font: inherit;
  color: var(--ink);
  text-align: left;
}

.props-color-picker__trigger:active { transform: scale(0.99); }

.props-color-picker__trigger:focus-visible {
  outline: 2px solid var(--accent-soft);
  border-color: var(--accent);
}

.props-color-chit {
  position: relative;
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  overflow: hidden;
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #e5e7eb 25%, transparent 25%),
    linear-gradient(-45deg, #e5e7eb 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e5e7eb 75%),
    linear-gradient(-45deg, transparent 75%, #e5e7eb 75%);
  background-size: 8px 8px;
  background-position: 0 0, 0 4px, 4px -4px, -4px 0;
}

.props-color-chit__fill {
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.14);
}

.props-color-picker__name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.props-color-picker__chevron {
  flex: 0 0 auto;
  font-size: 10px;
  color: var(--muted);
}

.props-color-picker__menu {
  z-index: 100;
  max-height: min(280px, 50vh);
  overflow: auto;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow:
    0 1px 2px rgba(17, 24, 39, 0.06),
    0 8px 24px rgba(17, 24, 39, 0.12);
}

.props-color-picker__group {
  padding: 6px 8px 2px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.props-color-picker__option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 5px 8px;
  border: none;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  font: inherit;
  color: var(--ink);
  text-align: left;
}

.props-color-picker__option:hover { background: #f3f4f6; }

.props-color-picker__option:active { transform: scale(0.99); }

.props-color-picker__option.is-selected {
  background: var(--accent-soft);
}

.props-color-picker__option-text {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.props-color-picker__option-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  line-height: 1.25;
}

.props-color-picker__option-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
  line-height: 1.25;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.props-color-picker__option--custom {
  margin-top: 2px;
  border-top: 1px solid var(--line);
  border-radius: 0 0 6px 6px;
  color: var(--muted);
  font-size: 12px;
}

.props-color-picker__custom {
  width: 100%;
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font: inherit;
}

.props-spacing-token-select {
  flex: 1 1 auto;
  min-width: 0;
}

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

.props-paddings label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 10px;
  color: var(--muted);
}

button.props-add-fill {
  width: 100%;
  min-height: 28px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  background: #fff;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

button.props-add-fill:active { transform: scale(0.98); }

.pane.is-collapsed .props-inspector { display: none; }

.tokens-workspace {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--panel);
}

.tokens-workspace__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}

.tokens-workspace__title {
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.tokens-workspace__panel {
  flex: 1 1 auto;
  min-height: 0;
}

.tokens-panel__loading {
  margin: 24px 16px;
  font-size: 13px;
  color: var(--muted);
}

.tokens-panel {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  height: 100%;
  min-height: 0;
}

.tokens-panel__sidebar {
  border-right: 1px solid var(--line);
  padding: 12px 8px;
  overflow: auto;
  background: #f9fafb;
}

.tokens-panel__section-title {
  padding: 4px 8px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.tokens-panel__nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 12px;
}

.tokens-panel__nav-btn {
  display: flex;
  align-items: center;
  min-height: 28px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  font-size: 13px;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
}

.tokens-panel__nav-btn:hover {
  background: rgba(17, 24, 39, 0.06);
}

.tokens-panel__nav-btn:active {
  transform: scale(0.98);
}

.tokens-panel__nav-btn.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.tokens-panel__main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.tokens-panel__table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.tokens-panel__footer {
  flex: 0 0 auto;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  background: #fafafa;
}

.tokens-panel__new {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.tokens-panel__add-btn {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.tokens-panel__add-btn:active {
  transform: scale(0.98);
}

.tokens-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.tokens-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel);
  box-shadow: 0 1px 0 var(--line);
}

.tokens-table th {
  padding: 8px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.tokens-table td {
  padding: 4px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.tokens-table__group-row td {
  padding: 10px 12px 4px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
  background: #f9fafb;
  border-bottom: 0;
}

.tokens-table__empty {
  padding: 24px 12px !important;
  text-align: center;
  color: var(--muted);
}

.tokens-table__value-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.tokens-table__input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  font: inherit;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.tokens-table__input:hover {
  border-color: var(--line);
  background: #fff;
}

.tokens-table__input:focus {
  outline: 2px solid var(--accent-soft);
  border-color: var(--accent);
  background: #fff;
}

.tokens-table__input--name {
  font-weight: 500;
}

.tokens-table__actions-head {
  width: 40px;
}

.tokens-table__actions {
  text-align: center;
}

.tokens-table__delete {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  font-size: 18px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
}

.tokens-table__delete:hover {
  background: rgba(220, 38, 38, 0.08);
  color: #b91c1c;
}

.tokens-table__delete:active {
  transform: scale(0.96);
}

.tokens-color-chit {
  flex: 0 0 auto;
  display: inline-flex;
  width: 20px;
  height: 20px;
  padding: 2px;
  border-radius: 4px;
  border: 1px solid var(--line);
  /* Checkerboard behind semi-transparent swatches (fill must not set its own background-image). */
  background-color: #fff;
  background-image: repeating-conic-gradient(#e5e7eb 0 25%, #fff 0 50%);
  background-size: 8px 8px;
  background-position: 50% 50%;
}

.tokens-color-chit__fill {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 2px;
}
