:root {
  color-scheme: dark;
  --ink: #eef0ed;
  --muted: #9ca49c;
  --soft: #c8cdc6;
  --page: #0b0d0c;
  --panel: #121513;
  --panel-2: #171b18;
  --canvas: #070909;
  --line: #2a312d;
  --line-strong: #3a453f;
  --accent: #56b6a7;
  --accent-2: #c79a57;
  --danger: #c66f5b;
  --shadow: 0 20px 70px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 20% 0%, rgba(86, 182, 167, 0.08), transparent 34rem),
    linear-gradient(180deg, #111310 0%, var(--page) 42%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

button,
input {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: #161a17;
  color: var(--ink);
  cursor: pointer;
}

button:hover,
.file-button:hover {
  border-color: var(--accent);
  background: #1a211d;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(9, 11, 10, 0.82);
  backdrop-filter: blur(18px);
}

.brand-lockup {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  width: 122px;
  height: 54px;
  flex: 0 0 auto;
  object-fit: contain;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: #f7f7f2;
}

.topbar h1,
.detail-header h2,
.panel-heading h2,
.notes-panel h3 {
  margin: 0;
}

.topbar h1 {
  color: #f7f8f4;
  font-size: 21px;
  font-weight: 650;
  line-height: 1.1;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.topbar-actions button,
.file-button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 0 13px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.file-button {
  border-color: rgba(86, 182, 167, 0.5);
  background: rgba(86, 182, 167, 0.16);
  color: #ddfff8;
  cursor: pointer;
}

.file-button input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(230px, 292px) minmax(380px, 1fr) minmax(290px, 352px);
  gap: 12px;
  padding: 12px;
  min-height: 0;
}

.object-panel,
.viewer-panel,
.detail-panel {
  min-height: 0;
  background: #151916;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.object-panel,
.detail-panel {
  overflow: auto;
}

.panel-heading {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(18, 21, 19, 0.96);
  backdrop-filter: blur(14px);
}

.panel-heading h2 {
  color: #f5f6f2;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
}

.panel-heading span {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 24px;
  border: 1px solid rgba(86, 182, 167, 0.26);
  border-radius: 999px;
  background: rgba(86, 182, 167, 0.1);
  color: var(--accent);
  font-size: 12px;
  font-weight: 750;
}

.object-list {
  display: grid;
  gap: 7px;
  padding: 10px;
}

.object-card {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 10px;
  width: 100%;
  min-height: 74px;
  padding: 8px;
  text-align: left;
  border-radius: 8px;
  background: transparent;
}

.object-card.active {
  border-color: rgba(86, 182, 167, 0.62);
  background: linear-gradient(90deg, rgba(86, 182, 167, 0.14), rgba(86, 182, 167, 0.04));
}

.object-card img {
  width: 58px;
  height: 58px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #080a09;
}

.object-card strong {
  display: block;
  margin-bottom: 5px;
  color: #f0f2ee;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
}

.object-card span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.viewer-panel {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
  background: #080a09;
}

.viewer-toolbar {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px;
  border-bottom: 1px solid var(--line);
  background: rgba(18, 21, 19, 0.86);
}

.segmented-control {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  min-width: 176px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0d100e;
}

.segmented-control button {
  min-height: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.segmented-control button.active {
  background: #26312c;
  color: #f5fffb;
}

.status-pill,
.status-label {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 26px;
  padding: 4px 9px;
  border: 1px solid rgba(199, 154, 87, 0.26);
  border-radius: 999px;
  background: rgba(199, 154, 87, 0.1);
  color: #e7c995;
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
}

#renderCanvas {
  width: 100%;
  height: 100%;
  min-height: 560px;
  display: block;
  touch-action: none;
  background: var(--canvas);
}

.detail-panel {
  padding: 14px;
}

.detail-header {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.detail-header h2 {
  color: #f6f7f3;
  font-size: 22px;
  font-weight: 680;
  line-height: 1.12;
}

.reference-media {
  display: grid;
  gap: 9px;
  margin-bottom: 16px;
}

.reference-media img,
.reference-media video {
  width: 100%;
  max-height: 226px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #070909;
}

.reference-media video[hidden] {
  display: none;
}

.reference-gallery {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.reference-gallery:empty {
  display: none;
}

.reference-gallery button {
  height: 58px;
  padding: 0;
  overflow: hidden;
  border-radius: 8px;
  background: #080a09;
}

.reference-gallery button.active {
  border-color: var(--accent);
  outline: 2px solid rgba(86, 182, 167, 0.18);
}

.reference-gallery img {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: cover;
  border: 0;
  border-radius: 0;
}

.metadata-list {
  display: grid;
  gap: 0;
  margin: 0 0 16px;
  border-top: 1px solid var(--line);
}

.metadata-list div {
  display: grid;
  grid-template-columns: 104px 1fr;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.metadata-list dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
}

.metadata-list dd {
  margin: 0;
  color: var(--soft);
  font-size: 13px;
  line-height: 1.35;
}

.notes-panel {
  padding: 13px;
  border: 1px solid rgba(199, 154, 87, 0.2);
  border-left: 3px solid var(--accent-2);
  background: rgba(199, 154, 87, 0.08);
  border-radius: 8px;
}

.notes-panel h3 {
  margin-bottom: 8px;
  color: #f2e2c6;
  font-size: 13px;
  font-weight: 750;
  text-transform: uppercase;
}

.notes-panel p {
  margin: 0;
  color: #d0c3ac;
  font-size: 13px;
  line-height: 1.5;
}

@media (max-width: 1100px) {
  .workspace {
    grid-template-columns: 250px 1fr;
  }

  .detail-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .brand-logo {
    width: 112px;
    height: 50px;
  }

  .topbar h1 {
    font-size: 20px;
  }

  .workspace {
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .object-panel {
    max-height: 270px;
  }

  #renderCanvas {
    min-height: 430px;
  }
}
