.asset-page {
  --asset-bg: #f7f8fb;
  --asset-panel: #ffffff;
  --asset-text: #1f2633;
  --asset-muted: #687385;
  --asset-line: #d9dee9;
  --asset-link: #1d5f91;
  --asset-active: #235f8f;
  --asset-active-text: #ffffff;
  --asset-shadow: 0 1px 3px rgba(20, 30, 50, 0.08);
  background: var(--asset-bg);
  color: var(--asset-text);
  min-height: calc(100vh - 82px);
}

body.dark-mode .asset-page {
  --asset-bg: #1a1a2e;
  --asset-panel: #232338;
  --asset-text: #e8e8ef;
  --asset-muted: #b4b5c6;
  --asset-line: #3a3b55;
  --asset-link: #8ec7ff;
  --asset-active: #6bb6ed;
  --asset-active-text: #111827;
  --asset-shadow: none;
}

.asset-wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 2.25em 1em 3.25em;
}

.asset-local-nav {
  margin-bottom: 1em;
}

.asset-back-link,
.open-file {
  color: var(--asset-link);
  font-size: 0.85em;
  text-decoration: none;
}

.asset-back-link:hover,
.open-file:hover {
  text-decoration: underline;
}

.asset-page h1 {
  color: var(--asset-text);
  font-size: 1.6em;
  line-height: 1.2;
  margin: 0 0 0.25em;
}

.asset-page .subtitle {
  color: var(--asset-muted);
  margin: 0 0 0.5em;
  font-size: 0.95em;
}

.asset-page .citation {
  color: var(--asset-muted);
  margin: 0 0 1.4em;
  font-size: 0.9em;
  max-width: 920px;
}

.asset-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 1.15em;
}

.selector {
  align-self: start;
  background: var(--asset-panel);
  border: 1px solid var(--asset-line);
  border-radius: 8px;
  box-shadow: var(--asset-shadow);
  max-height: calc(100vh - 138px);
  overflow: auto;
  padding: 0.7em;
  position: sticky;
  top: 1em;
}

.selector-label {
  color: var(--asset-muted);
  font-size: 0.75em;
  font-weight: 700;
  margin: 0.25em 0.5em 0.65em;
  text-transform: uppercase;
}

.asset-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--asset-text);
  cursor: pointer;
  display: block;
  font-size: 0.9em;
  line-height: 1.15;
  margin: 0.15em 0;
  padding: 0.6em 0.7em;
  text-align: left;
  width: 100%;
}

.asset-btn span {
  color: var(--asset-muted);
}

.asset-btn:hover {
  background: rgba(35, 95, 143, 0.1);
}

.asset-btn.active {
  background: var(--asset-active);
  color: var(--asset-active-text);
}

.asset-btn.active span {
  color: var(--asset-active-text);
}

.viewer {
  background: var(--asset-panel);
  border: 1px solid var(--asset-line);
  border-radius: 8px;
  box-shadow: var(--asset-shadow);
  min-height: 560px;
  padding: 1.1em;
}

.viewer-head {
  align-items: flex-start;
  border-bottom: 1px solid var(--asset-line);
  display: flex;
  gap: 1em;
  justify-content: space-between;
  margin-bottom: 1em;
  padding-bottom: 0.8em;
}

.viewer h2 {
  color: var(--asset-text);
  font-size: 1.35em;
  line-height: 1.2;
  margin: 0;
}

.kind {
  color: var(--asset-muted);
  font-size: 0.85em;
  margin-top: 0.25em;
}

.open-file {
  white-space: nowrap;
}

.media-list {
  display: grid;
  gap: 1em;
  margin-bottom: 1em;
}

.asset-img {
  background: #ffffff;
  border: 1px solid var(--asset-line);
  border-radius: 6px;
  display: block;
  margin: 0 auto;
  max-height: 72vh;
  max-width: 100%;
}

.table-img {
  height: auto;
  max-height: none;
  width: 100%;
}

.caption {
  color: var(--asset-text);
  font-size: 0.95em;
  max-width: 860px;
}

.caption p {
  margin: 0 0 0.7em;
}

.table-render,
.markdown-panel {
  background: #fbfcff;
  border: 1px solid var(--asset-line);
  border-radius: 6px;
  margin-top: 0.9em;
  max-height: 72vh;
  overflow: auto;
}

body.dark-mode .table-render,
body.dark-mode .markdown-panel {
  background: #171829;
}

.table-render pre,
.markdown-panel pre {
  color: var(--asset-text);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.8em;
  line-height: 1.55;
  margin: 0;
  padding: 1em;
  white-space: pre-wrap;
}

.data-table {
  background: #ffffff;
  border-collapse: collapse;
  color: #172033;
  font-size: 0.85em;
  min-width: 620px;
  width: 100%;
}

.data-table th,
.data-table td {
  border: 1px solid #d8deea;
  padding: 0.5em 0.65em;
  text-align: left;
  vertical-align: top;
}

.data-table th {
  background: #eef3fb;
  font-weight: 700;
}

.empty {
  color: var(--asset-muted);
  font-style: italic;
}

@media (max-width: 780px) {
  .asset-wrap {
    padding-top: 1.5em;
  }

  .asset-shell {
    grid-template-columns: 1fr;
  }

  .selector {
    max-height: none;
    position: static;
  }

  .viewer {
    min-height: 0;
  }

  .viewer-head {
    display: block;
  }

  .open-file {
    display: inline-block;
    margin-top: 0.5em;
  }

  .asset-img {
    max-height: none;
  }
}
