:root {
  color-scheme: light;
  --bg: #f4efe4;
  --panel: rgba(255, 252, 246, 0.92);
  --panel-border: rgba(122, 83, 40, 0.18);
  --ink: #1d2628;
  --muted: #5d655f;
  --accent: #0d6c78;
  --accent-strong: #0a4c55;
  --highlight: #d88b38;
  --shadow: 0 18px 45px rgba(34, 45, 38, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Helvetica Neue", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(216, 139, 56, 0.22), transparent 28%),
    radial-gradient(circle at top right, rgba(13, 108, 120, 0.18), transparent 30%),
    linear-gradient(180deg, #f6f2e8 0%, #efe6d8 100%);
}

.shell {
  width: min(1200px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 3rem;
}

.hero {
  padding: 1rem 0 1.5rem;
}

.eyebrow {
  margin: 0;
  color: var(--accent-strong);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.8rem;
  font-weight: 700;
}

h1,
h2,
h3 {
  font-family: "Iowan Old Style", "Palatino Linotype", serif;
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 4vw, 3.7rem);
  line-height: 0.95;
  margin-top: 0.35rem;
}

.intro {
  width: min(70ch, 100%);
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 1.2rem;
  margin-top: 1rem;
  backdrop-filter: blur(12px);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
  margin-bottom: 1rem;
}

.panel-header p {
  margin: 0;
  color: var(--muted);
}

.dataset-meta {
  margin: 0;
  color: var(--muted);
  word-break: break-word;
}

.search-grid {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: 2fr 1fr 1.2fr auto;
  align-items: end;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
}

label.wide {
  min-width: 0;
}

.checkbox-label {
  justify-content: end;
}

.checkbox-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 3rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid rgba(44, 69, 74, 0.18);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  font-weight: 500;
}

.checkbox-wrap input {
  width: auto;
  margin: 0;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  border: 1px solid rgba(44, 69, 74, 0.18);
  border-radius: 14px;
  padding: 0.8rem 0.95rem;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
}

button {
  border: 0;
  border-radius: 14px;
  padding: 0.85rem 1.2rem;
  background: #d5d2ca;
  color: #253033;
  font-weight: 700;
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease;
}

button:hover {
  transform: translateY(-1px);
  background: #c8c5bd;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

button.accent {
  background: var(--accent);
  color: white;
}

button.accent:hover {
  background: var(--accent-strong);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 380px) 1fr;
  gap: 1rem;
  margin-top: 1rem;
}

.results-panel,
.details-panel {
  min-width: 0;
}

.details-panel {
  display: flex;
  flex-direction: column;
  max-height: 72vh;
  overflow: hidden;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.results-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
  max-height: 65vh;
  overflow: auto;
}

.result-item button {
  width: 100%;
  text-align: left;
  padding: 0.9rem 1rem;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(44, 69, 74, 0.08);
}

.result-item button.active {
  background: rgba(13, 108, 120, 0.12);
  border-color: rgba(13, 108, 120, 0.28);
}

.resource-label {
  font-weight: 700;
  display: block;
  font-family: "Menlo", "Consolas", monospace;
}

.resource-meta {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.9rem;
  color: var(--muted);
  word-break: break-word;
}

.selected-card,
.predicate-group {
  border: 1px solid rgba(44, 69, 74, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.84);
  padding: 1rem;
}

.selected-card.empty {
  color: var(--muted);
}

.actions {
  display: flex;
  gap: 0.85rem;
  align-items: end;
  margin: 0.85rem 0 1rem;
}

.predicate-filter {
  min-width: min(100%, 28rem);
}

.incoming-summary {
  margin-bottom: 0.8rem;
  color: var(--muted);
}

.incoming-pane {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  overflow: auto;
  padding-right: 0.2rem;
}

.incoming-groups {
  display: grid;
  gap: 0.85rem;
}

.predicate-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
  margin-bottom: 0.6rem;
}

.predicate-title {
  font-weight: 800;
  font-family: "Menlo", "Consolas", monospace;
}

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

.finder-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2rem;
  padding: 0.15rem 0;
}

.resource-row {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}

.tree-list {
  display: grid;
  gap: 0;
}

.tree-node {
  min-width: 0;
}

.tree-item {
  flex: 1;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  text-align: left;
  background: transparent;
  padding: 0.25rem 0.2rem;
  border-radius: 10px;
  color: var(--ink);
  transform: none;
}

.tree-item:hover {
  transform: none;
  background: rgba(13, 108, 120, 0.08);
}

.twisty {
  width: 1.35rem;
  min-width: 1.35rem;
  padding: 0;
  background: transparent;
  color: var(--accent-strong);
  border-radius: 8px;
  transform: none;
}

.twisty:hover {
  transform: none;
  background: rgba(13, 108, 120, 0.08);
}

.twisty.spacer {
  display: inline-block;
  width: 1.35rem;
  min-width: 1.35rem;
}

.tree-children {
  margin-left: 1.1rem;
  padding-left: 0.45rem;
  border-left: 1px solid rgba(44, 69, 74, 0.12);
}

.tree-placeholder {
  padding: 0.2rem 0 0.4rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.kind-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  background: rgba(13, 108, 120, 0.11);
  color: var(--accent-strong);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kind-chip.deprecated {
  background: rgba(216, 139, 56, 0.18);
  color: #8f5615;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  background: rgba(216, 139, 56, 0.16);
  color: #7e4e19;
  font-size: 0.82rem;
  font-weight: 700;
}

@media (max-width: 900px) {
  .search-grid,
  .workspace {
    grid-template-columns: 1fr;
  }

  .actions {
    flex-direction: column;
    align-items: stretch;
  }

  .details-panel {
    max-height: 60vh;
  }

  .predicate-filter {
    min-width: 0;
  }

  .results-list {
    max-height: 36vh;
  }
}
