:root {
  color-scheme: dark;
  --bg: #101114;
  --panel: #181a1f;
  --panel-2: #20232a;
  --line: #333842;
  --text: #f2f2f0;
  --muted: #a7adb8;
  --accent: #e56b2f;
  --accent-2: #3fa7d6;
  --danger: #ff6b6b;
  --ok: #6fd48c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button,
select,
input,
textarea {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 6px;
}

button {
  min-height: 36px;
  padding: 0 12px;
  cursor: pointer;
}

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

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #111;
  font-weight: 700;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(16, 17, 20, 0.95);
  backdrop-filter: blur(10px);
}

h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0;
}

h2 {
  margin: 4px 0 0;
  font-size: 18px;
  letter-spacing: 0;
}

.topbar p,
.muted {
  margin: 0;
  color: var(--muted);
}

.topActions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.layout {
  display: grid;
  grid-template-columns: minmax(320px, 38vw) 1fr;
  min-height: calc(100vh - 70px);
}

.sidebar {
  border-right: 1px solid var(--line);
  background: var(--panel);
  min-width: 0;
}

.filters {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px auto;
  gap: 8px;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.filters input,
.filters select {
  width: 100%;
  min-height: 38px;
  padding: 0 10px;
}

.resultNav {
  display: flex;
  gap: 8px;
}

.resultNav button {
  min-width: 62px;
  white-space: nowrap;
}

.stats,
.resultMeta {
  padding: 8px 12px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.list {
  height: calc(100vh - 183px);
  overflow: auto;
}

.item {
  width: 100%;
  display: block;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 10px 12px;
  background: transparent;
}

.item:hover,
.item.active {
  background: var(--panel-2);
}

.item.changed .itemTitle::before {
  content: "* ";
  color: var(--accent);
}

.itemTitle {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.itemSub {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor {
  min-width: 0;
  padding: 18px;
}

.emptyState {
  color: var(--muted);
}

.editorHeader {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.fieldGroup {
  margin-bottom: 14px;
}

label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-weight: 700;
}

pre {
  margin: 0;
  min-height: 42px;
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: var(--panel);
}

textarea {
  width: 100%;
  min-height: 180px;
  resize: vertical;
  padding: 10px;
  line-height: 1.55;
}

.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -4px 0 14px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
}

.pill.ok {
  color: var(--ok);
  border-color: rgba(111, 212, 140, 0.55);
}

.pill.bad {
  color: var(--danger);
  border-color: rgba(255, 107, 107, 0.55);
}

.pill.changed {
  color: var(--accent);
  border-color: rgba(229, 107, 47, 0.65);
}

.refs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.recordInfo {
  margin-top: 14px;
  color: var(--muted);
}

@media (max-width: 860px) {
  .topbar {
    position: static;
    display: block;
  }

  .topActions {
    justify-content: flex-start;
    margin-top: 10px;
  }

  .filters {
    grid-template-columns: 1fr 130px;
  }

  .resultNav {
    grid-column: 1 / -1;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .list {
    height: 42vh;
  }

  .refs {
    grid-template-columns: 1fr;
  }
}
