:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --panel: #ffffff;
  --ink: #1c1f24;
  --muted: #68717d;
  --line: #d7dcd4;
  --accent: #096f75;
  --accent-weak: #d7eceb;
  --warn: #8a4b00;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: #fbfcfa;
  padding: 20px;
  overflow-y: auto;
}

.brand h1 {
  margin: 0 0 8px;
  font-size: 21px;
  line-height: 1.15;
  letter-spacing: 0;
}

.brand p,
#viewerSubtitle {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.project-links {
  display: grid;
  gap: 6px;
  margin-top: 14px;
}

.project-links a {
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.project-links a:hover {
  text-decoration: underline;
}

.field {
  display: grid;
  gap: 7px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

select,
input[type="range"] {
  width: 100%;
}

select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 20px;
}

.tab,
#resetSelection {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.tab.is-active {
  border-color: var(--accent);
  background: var(--accent-weak);
  color: #064c50;
}

.panel-section {
  margin-top: 8px;
}

.is-hidden {
  display: none !important;
}

.details {
  display: grid;
  grid-template-columns: minmax(92px, auto) minmax(0, 1fr);
  gap: 8px 12px;
  margin: 18px 0 0;
  font-size: 13px;
}

.details dt {
  color: var(--muted);
}

.details dd {
  margin: 0;
  min-width: 0;
  word-break: break-word;
}

.workspace {
  min-width: 0;
  padding: 22px;
}

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

.viewer-toolbar h2 {
  margin: 0 0 4px;
  font-size: 22px;
  line-height: 1.2;
}

#resetSelection {
  padding: 0 14px;
  white-space: nowrap;
}

.image-stage {
  position: relative;
  min-height: 520px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.image-stage img {
  max-width: 100%;
  max-height: 74vh;
  display: block;
}

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

.empty-state {
  max-width: 520px;
  padding: 24px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
}

.lower-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.95fr) minmax(280px, 1.05fr);
  gap: 16px;
  margin-top: 16px;
}

.table-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
}

.section-title h3 {
  margin: 0;
  font-size: 14px;
}

.section-title span {
  color: var(--muted);
  font-size: 12px;
}

.record-list {
  max-height: 320px;
  overflow-y: auto;
}

.record-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) 92px;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 8px 12px;
  text-align: left;
  cursor: pointer;
}

.record-row:hover,
.record-row.is-selected {
  background: var(--accent-weak);
}

.record-row strong {
  font-size: 13px;
}

.record-row span {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.json-view {
  max-height: 320px;
  overflow: auto;
  margin: 0;
  padding: 14px;
  font-size: 12px;
  line-height: 1.45;
  background: #fcfcfb;
}

@media (max-width: 920px) {
  .app-shell,
  .lower-grid {
    grid-template-columns: 1fr;
  }

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

  .image-stage {
    min-height: 360px;
  }
}
