:root {
  --bg: #000;
  --fg: #c8c8c8;
  --dim: #555;
  --bright: #fff;
  --accent: #6cf;
  --selected: #1a1a1a;
  --rule: #1f1f1f;
}

* {
  box-sizing: border-box;
}

html {
  scrollbar-gutter: stable;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 14px;
  line-height: 1.5;
}

main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 16px;
}

:where(body, main) > [window] {
  max-width: var(--window-max-width, 1400px);
  margin: 0 auto;
  padding-inline: 16px;
}

:where(body, main) > [window="main"] {
  padding-bottom: 24px;
}

.toolbar {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 8px 0;
}

.toolbar h2 {
  margin: 0;
}

input,
select,
option {
  color: var(--bright);
}

select,
::picker(select) {
  appearance: base-select;
}

input:where([type="text"], [type="email"], [type="number"], [type="date"], [type="search"], [type="tel"], [type="url"]),
select,
textarea {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 1px solid var(--rule);
  padding: 6px 8px;
  font: inherit;
  outline: none;
  width: 100%;
}

input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

textarea {
  resize: vertical;
}

button {
  background: transparent;
  color: var(--bright);
  border: 1px solid var(--rule);
  padding: 4px 10px;
  font: inherit;
  cursor: pointer;
}

input:focus,
select:focus,
textarea:focus,
button:hover,
button:focus {
  border-color: var(--accent);
}

button:disabled {
  color: var(--dim);
}

input:disabled,
input:read-only {
  color: var(--dim);
}

label {
  display: block;
  margin: 6px 0;
}

label
  > :where(
    input[type="text"],
    input[type="email"],
    input[type="number"],
    input[type="date"],
    input[type="search"],
    input[type="tel"],
    input[type="url"],
    select,
    textarea
  ) {
  display: block;
  margin: 4px 0 0;
}

label > input:where([type="checkbox"], [type="radio"]) {
  width: auto;
  margin: 0 6px 0 0;
}

h2,
h3 {
  font-size: 1em;
  color: var(--bright);
  margin: 0 0 12px;
}

h3 {
  margin-top: 16px;
  margin-bottom: 6px;
}

dialog.window {
  position: fixed;
  background: #111;
  color: var(--fg);
  border: 1px solid var(--rule);
  padding: 16px;
  min-width: 320px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

dialog.window .actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 12px;
}

.custom-select {
  position: relative;
  outline: none;
}

.custom-select:focus .custom-select-button {
  border-color: var(--accent);
}

.custom-select-button {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 8px;
  align-items: center;
  width: 100%;
  min-height: 34px;
  padding-right: 28px;
  text-align: left;
  position: relative;
}

.custom-select-button::after {
  content: "v";
  position: absolute;
  right: 10px;
  top: 6px;
  color: var(--dim);
}

.custom-select-trigger-icon {
  color: var(--accent);
}

.custom-select-label {
  color: var(--bright);
}

.custom-select-popup {
  position: absolute;
  z-index: 10;
  inset-inline: 0;
  top: calc(100% + 4px);
  display: grid;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--rule);
  background: var(--bg);
  box-shadow: 0 8px 18px rgb(0 0 0 / 45%);
}

.custom-select-popup[hidden] {
  display: none;
}

.custom-select-option {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  text-align: left;
  border: 0;
}

.custom-select-option[aria-selected="true"] {
  background: var(--selected);
}

.custom-select-icon {
  color: var(--accent);
}

.custom-select-option-text {
  display: grid;
}

.custom-select-option-description {
  color: var(--dim);
  font-size: 12px;
}

.object-browser-window {
  inset: 64px 48px auto 48px;
  width: min(1180px, calc(100vw - 96px));
  min-height: 620px;
  z-index: 10;
}

.object-browser-window > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.object-browser-window > header .actions {
  margin-top: 0;
}

.object-path {
  min-height: 1.5em;
  color: var(--dim);
  border-bottom: 1px solid var(--rule);
  margin: 0 -16px 12px;
  padding: 0 16px 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.object-browser {
  display: block;
  min-height: 520px;
}

.object-columns {
  display: flex;
  overflow-x: auto;
  border: 1px solid var(--rule);
  min-width: 0;
  min-height: 520px;
}

.object-column {
  flex: 0 0 260px;
  border-right: 1px solid var(--rule);
  overflow-y: auto;
  max-height: 520px;
}

.object-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px auto;
  gap: 10px;
  align-items: baseline;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--rule);
  padding: 5px 8px;
  text-align: left;
}

.object-row[aria-selected="true"] {
  background: var(--selected);
}

.object-name {
  color: var(--bright);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.object-arrow {
  color: var(--dim);
}

.object-value {
  color: var(--dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.object-empty {
  color: var(--dim);
  padding: 8px;
}

.object-preview-column {
  padding: 8px;
}

.object-preview-heading {
  color: var(--bright);
  border-bottom: 1px solid var(--rule);
  padding-bottom: 6px;
  margin-bottom: 8px;
}

.object-preview-column pre {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
