:root {
  color-scheme: dark;
  --bg: #111315;
  --surface: #181b20;
  --surface-2: #17332f;
  --line: #2d333b;
  --ink: #eef2f5;
  --muted: #9aa6b2;
  --teal: #0f766e;
  --teal-dark: #7bd7cf;
  --teal-hover: #0b5f59;
  --rose: #f087b1;
  --amber: #f1b867;
  --red: #ff8b82;
  --blue: #8abaff;
  --topbar-bg: rgba(17, 19, 21, 0.94);
  --hover: #222832;
  --thumb-bg: #151a20;
  --image-bg: #0d1014;
  --placeholder-a: #151a20;
  --placeholder-b: #1d242c;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.42);
  --topbar-height: 92px;
  --nav-height: 52px;
  --sticky-offset: 102px;
  --dataset-scroll-margin: 170px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
  scroll-behavior: auto;
}

body {
  margin: 0;
  overflow-x: hidden;
  padding-top: calc(var(--topbar-height) + max(var(--nav-height), 132px) + 18px);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
}

button,
input,
select {
  font: inherit;
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 30;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  width: 100vw;
  padding: 18px 24px 16px;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.12;
}

.page-links {
  display: inline-flex;
  gap: 6px;
  margin-top: 10px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.page-links a {
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
  text-decoration: none;
}

.page-links a:hover,
.page-links a[aria-current="page"] {
  background: rgba(15, 118, 110, 0.24);
  color: var(--teal-dark);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: flex-end;
  gap: 10px;
}

.toolbar > label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.toolbar .search input,
.toolbar .filter select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
}

.toolbar .search input {
  width: min(30vw, 310px);
  min-width: 220px;
  padding: 0 12px;
}

.toolbar .filter select {
  padding: 0 34px 0 10px;
}

.set-controls,
.view-control {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: 100%;
  min-width: 0;
  min-inline-size: 0;
  min-height: 38px;
  margin: 0;
  padding: 4px 8px 5px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  white-space: nowrap;
}

.set-controls legend,
.view-control legend {
  padding: 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.toolbar .control-option {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 850;
}

.toolbar .control-option input {
  width: 16px;
  height: 16px;
  min-height: 0;
  margin: 0;
  accent-color: var(--teal-dark);
}

.toolbar .control-option input:disabled + *,
.toolbar .control-option:has(input:disabled) {
  color: var(--muted);
}

.radio-cluster {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding-left: 8px;
  border-left: 1px solid var(--line);
}

.primary {
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 7px;
  background: var(--teal);
  color: white;
  font-weight: 800;
  cursor: pointer;
}

.primary:hover {
  background: var(--teal-hover);
}

.status {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 24px 4px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.chip strong {
  color: var(--ink);
}

.chip.ok {
  border-color: rgba(123, 215, 207, 0.32);
  color: var(--teal-dark);
}

.chip.warn {
  border-color: rgba(241, 184, 103, 0.32);
  color: var(--amber);
}

.chip.bad {
  border-color: rgba(255, 139, 130, 0.32);
  color: var(--red);
}

.workspace {
  display: block;
  padding: 16px 24px 32px;
}

.dataset-nav {
  position: fixed;
  top: var(--topbar-height);
  left: 10px;
  z-index: 29;
  display: grid;
  grid-template-columns: minmax(180px, max-content) minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: calc(100vw - 20px);
  max-width: calc(100vw - 20px);
  max-height: none;
  margin-bottom: 16px;
  overflow: visible;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(24, 27, 32, 0.97);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(12px);
}

.nav-current {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  min-width: 0;
  min-height: 34px;
  overflow: hidden;
  padding: 0 9px;
  border: 1px solid rgba(123, 215, 207, 0.24);
  border-radius: 7px;
  background: rgba(15, 118, 110, 0.13);
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.nav-current-number {
  color: var(--teal-dark);
  font-size: 17px;
  line-height: 1;
}

.nav-current-name {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
}

.nav-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(34px, 38px));
  justify-content: end;
  gap: 5px;
  min-width: 0;
}

.nav-item {
  position: relative;
  display: grid;
  place-items: center;
  width: 38px;
  min-height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #131820;
  color: var(--ink);
  text-align: center;
  cursor: pointer;
}

.nav-item:hover {
  background: var(--hover);
}

.nav-item.active {
  border-color: var(--teal-dark);
  background: rgba(15, 118, 110, 0.26);
  box-shadow: inset 0 0 0 1px rgba(123, 215, 207, 0.2);
}

.nav-number {
  color: var(--teal-dark);
  font-size: 15px;
  font-weight: 900;
}

.dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--line);
}

.dot.ok {
  background: var(--teal);
}

.dot.warn {
  background: var(--amber);
}

.dot.bad {
  background: var(--red);
}

.datasets {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.dataset-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  scroll-margin-top: calc(var(--topbar-height) + max(var(--nav-height), 132px) + 28px);
}

.dataset-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--line);
}

.dataset-title {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
}

.folder-path {
  margin: 5px 0 0;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  word-break: break-all;
}

.dataset-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.dataset-review-list {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(18, 27, 42, 0.58);
}

.dataset-review-item {
  display: grid;
  grid-template-columns: auto auto;
  gap: 2px 7px;
  min-width: 190px;
  max-width: 260px;
  padding: 7px 9px;
  border: 1px solid rgba(138, 186, 255, 0.28);
  border-radius: 7px;
  background: #121b2a;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.dataset-review-item strong,
.dataset-review-item em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dataset-review-item strong {
  font-size: 11px;
}

.dataset-review-item span {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--blue);
  color: #07111f;
  font-size: 11px;
  font-weight: 950;
}

.dataset-review-item em {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 750;
}

.set-grid {
  display: grid;
  grid-template-columns: repeat(var(--visible-set-count, 2), minmax(330px, 1fr));
  gap: 0;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
}

.set-panel {
  min-width: 330px;
  padding: 16px 18px 18px;
}

.set-panel-copy {
  background: #252b34;
  box-shadow: inset 0 0 0 1px rgba(154, 166, 178, 0.16);
}

.set-panel + .set-panel {
  border-left: 1px solid var(--line);
}

.set-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.set-panel h3 {
  margin: 0;
  font-size: 16px;
}

.section-label {
  margin: 16px 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.core-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 10px;
}

.trial-list {
  display: grid;
  gap: 12px;
}

.trial {
  min-width: 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.trial-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 8px;
  font-size: 14px;
}

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

.path-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
  padding-bottom: 4px;
}

.arrow {
  display: grid;
  place-items: center;
  min-width: 16px;
  color: var(--muted);
  font-weight: 900;
}

.thumb {
  position: relative;
  display: grid;
  grid-template-rows: auto auto;
  min-width: 112px;
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--thumb-bg);
  color: var(--ink);
}

.path-row .thumb {
  width: 118px;
  flex: 0 0 118px;
}

button.thumb {
  padding: 0;
  cursor: zoom-in;
}

button.missing-thumb {
  cursor: text;
}

button.thumb:hover {
  border-color: rgba(123, 215, 207, 0.62);
  box-shadow: 0 0 0 3px rgba(123, 215, 207, 0.12);
}

.thumb.has-reviews {
  border-color: rgba(138, 186, 255, 0.72);
  box-shadow: 0 0 0 3px rgba(138, 186, 255, 0.12);
}

.review-badge {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--blue);
  color: #07111f;
  font-size: 11px;
  font-weight: 950;
}

.thumb.upload-target.drag-over,
.thumb.missing-thumb.drag-over {
  border-color: var(--teal-dark);
  box-shadow: 0 0 0 4px rgba(123, 215, 207, 0.2);
}

.thumb.is-uploading {
  pointer-events: none;
}

.thumb.is-uploading::after {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.58);
  color: var(--ink);
  content: "Saving...";
  font-size: 13px;
  font-weight: 900;
}

.thumb img {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 3;
  height: auto;
  object-fit: contain;
  background: var(--image-bg);
}

.thumb-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: 30px;
  padding: 5px 7px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  line-height: 1.15;
}

.thumb-label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.placeholder {
  border-style: dashed;
  background: repeating-linear-gradient(
    135deg,
    var(--placeholder-a) 0,
    var(--placeholder-a) 8px,
    var(--placeholder-b) 8px,
    var(--placeholder-b) 16px
  );
}

.placeholder-art {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  aspect-ratio: 2 / 3;
  padding: 10px;
  color: var(--red);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.placeholder-art span {
  display: -webkit-box;
  max-width: 100%;
  overflow: hidden;
  color: var(--ink);
  font-size: 11px;
  font-weight: 750;
  line-height: 1.28;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 8;
}

.placeholder-art em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

.missing-thumb.has-idea {
  border-color: rgba(138, 186, 255, 0.48);
  background: #121b2a;
}

.missing-thumb.has-idea .placeholder-art {
  color: var(--blue);
}

.extra-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 10px;
}

.empty-state {
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 750;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
}

.lightbox[hidden] {
  display: none;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.82);
  cursor: zoom-out;
}

.lightbox-panel {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 10px;
  max-width: min(1100px, 94vw);
  max-height: 92vh;
  margin: 0;
}

.lightbox.review-only .lightbox-panel {
  display: none;
}

.lightbox-panel img {
  display: block;
  max-width: 100%;
  max-height: 84vh;
  border-radius: 8px;
  background: var(--surface);
  object-fit: contain;
}

.lightbox-panel figcaption {
  color: white;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.review-panel {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 10px;
  width: min(360px, 92vw);
  max-height: 84vh;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

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

.review-panel-header h2 {
  margin: 0;
  font-size: 15px;
  line-height: 1.25;
}

.review-list {
  display: grid;
  gap: 8px;
  max-height: min(320px, 34vh);
  overflow-y: auto;
}

.review-entry {
  display: grid;
  gap: 4px;
  padding: 9px;
  border: 1px solid rgba(138, 186, 255, 0.22);
  border-radius: 7px;
  background: #121b2a;
}

.review-entry.is-done {
  border-color: rgba(123, 215, 207, 0.62);
  background: rgba(15, 118, 110, 0.18);
  box-shadow: inset 3px 0 0 rgba(123, 215, 207, 0.88);
}

.review-entry-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.review-entry-meta,
.review-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.review-actions {
  justify-content: flex-end;
}

.review-entry p,
.review-empty {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
}

.review-entry time,
.review-entry-head span,
.review-empty {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.review-done-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 20px;
  padding: 0 7px;
  border: 1px solid rgba(123, 215, 207, 0.42);
  border-radius: 999px;
  background: rgba(123, 215, 207, 0.14);
  color: var(--teal-dark);
  font-size: 11px;
  font-weight: 950;
}

.review-done-label::before {
  content: "";
  width: 7px;
  height: 4px;
  border-bottom: 2px solid currentColor;
  border-left: 2px solid currentColor;
  transform: rotate(-45deg) translateY(-1px);
}

.review-done-at {
  color: var(--teal-dark);
}

.review-done-toggle,
.review-delete {
  padding: 3px 7px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 850;
}

.review-done-toggle {
  border: 1px solid rgba(123, 215, 207, 0.35);
  background: rgba(123, 215, 207, 0.08);
  color: var(--teal-dark);
}

.review-done-toggle:hover,
.review-done-toggle:focus-visible {
  border-color: rgba(123, 215, 207, 0.75);
  background: rgba(123, 215, 207, 0.16);
}

.review-delete {
  border: 1px solid rgba(255, 138, 138, 0.35);
  background: rgba(255, 117, 117, 0.08);
  color: #ff9b9b;
}

.review-delete:hover,
.review-delete:focus-visible {
  border-color: rgba(255, 138, 138, 0.75);
  background: rgba(255, 117, 117, 0.16);
}

.review-done-toggle:disabled,
.review-delete:disabled {
  cursor: wait;
  opacity: 0.62;
}

.review-panel textarea {
  width: 100%;
  min-height: 110px;
  resize: vertical;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #111720;
  color: var(--ink);
  line-height: 1.4;
}

.review-status {
  min-height: 18px;
  margin: 0;
  color: var(--amber);
  font-size: 12px;
  font-weight: 750;
}

.idea-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 24px;
}

.idea-modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.68);
}

.idea-panel {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 12px;
  width: min(620px, 94vw);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.idea-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.idea-header h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 900;
  cursor: pointer;
}

.idea-panel textarea {
  width: 100%;
  min-height: 190px;
  resize: vertical;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  line-height: 1.45;
}

.idea-panel textarea:disabled {
  background: #20252c;
  color: var(--muted);
}

.idea-status {
  min-height: 20px;
  margin: 0;
  color: var(--amber);
  font-size: 13px;
  font-weight: 750;
}

.idea-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.secondary {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

.primary:disabled,
.secondary:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

@media (max-width: 1080px) {
  .dataset-nav {
    grid-template-columns: 1fr;
    left: 6px;
    width: calc(100vw - 12px);
    max-width: calc(100vw - 12px);
  }

  .nav-grid {
    justify-content: start;
  }

  .nav-item {
    width: 36px;
  }
}

@media (max-width: 820px) {
  .topbar {
    top: 0;
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar {
    justify-content: stretch;
  }

  .toolbar > .search,
  .toolbar > .filter,
  .toolbar .search input,
  .toolbar .filter select,
  .toolbar > .primary {
    width: 100%;
  }

  .set-controls,
  .view-control {
    justify-content: flex-start;
    width: max-content;
    max-width: 100%;
  }

  .workspace,
  .status,
  .topbar {
    padding-left: 14px;
    padding-right: 14px;
  }

  .dataset-nav {
    top: var(--sticky-offset);
  }

  .set-grid {
    grid-template-columns: 1fr;
    overflow-x: visible;
  }

  .set-panel + .set-panel {
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}
