:root {
  --bg: #f5f6f8; --panel: #ffffff; --line: #dfe3ea; --text: #1c2330; --muted: #667085;
  --accent: #2f5fe0; --accent-text: #ffffff; --chip: #eaeef6; --ok: #1a7f4b;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171c; --panel: #1c2027; --line: #2d333d; --text: #e6e9ef; --muted: #98a2b3;
    --accent: #6b93ff; --accent-text: #0d1320; --chip: #272d38; --ok: #5fd39a;
  }
}
* { box-sizing: border-box; }
body.registry {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; }

.top {
  display: flex; align-items: center; gap: 16px; padding: 12px 24px;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.top .brand { font-weight: 650; color: var(--text); white-space: nowrap; }
.top nav { flex: 1; min-width: 0; color: var(--muted); overflow-wrap: anywhere; }
.top nav a { color: var(--muted); }
.top .api { font-size: 13px; }
main { max-width: 1280px; margin: 0 auto; padding: 24px 16px 64px; }
h1 { font-size: 24px; margin: 0 0 4px; overflow-wrap: anywhere; }
h2 { font-size: 16px; margin: 32px 0 10px; }

.notice { background: var(--chip); border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  overflow: hidden; color: var(--text); display: flex; flex-direction: column;
}
.card:hover { border-color: var(--accent); text-decoration: none; }
.card .thumb { aspect-ratio: 4 / 3; background: #fff; display: grid; place-items: center; }
.card .thumb img { width: 100%; height: 100%; object-fit: contain; }
.card .body { padding: 12px 14px; border-top: 1px solid var(--line); }
.card .name { font-weight: 600; overflow-wrap: anywhere; }
.card .sub { color: var(--muted); font-size: 13px; }

.chip {
  display: inline-block; background: var(--chip); border-radius: 999px; padding: 1px 9px;
  font-size: 12px; color: var(--text); white-space: nowrap;
}
.chip.ok { color: var(--ok); }
.meta { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: 10px 0 18px; }
.meta .msg { color: var(--muted); flex-basis: 100%; overflow-wrap: anywhere; }
select, .btn {
  font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line);
  border-radius: 7px; padding: 6px 10px; max-width: 100%;
}
.btn { display: inline-block; cursor: pointer; white-space: nowrap; font-size: 13px; padding: 4px 10px; }
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-size: 14px; padding: 6px 14px; }

/* 3D viewer: one frame holding the scene tabs and three-cad-viewer, styled with the
   viewer's own theme variables (set on <body data-theme> by the viewer) so the tabs
   read as part of it. The frame is sized by app.js to the full window width. */
.viewer-frame {
  background: var(--tcv-bg-color, var(--panel)); color: var(--tcv-font-color, var(--text));
  border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px;
}
.tabs { display: flex; flex-wrap: wrap; gap: 2px; padding: 6px 8px 0; border-bottom: 1px solid var(--line); }
.tabs button {
  font: 13px/1.4 sans-serif; cursor: pointer; color: inherit; opacity: .7; background: none;
  border: 0; border-bottom: 2px solid transparent; padding: 5px 12px 6px; margin-bottom: -1px;
}
.tabs button:hover { opacity: 1; background: var(--tcv-bg-highlight-color, var(--chip)); border-radius: 5px 5px 0 0; }
.tabs button[aria-selected="true"] { opacity: 1; font-weight: 600; border-bottom-color: var(--tcv-theme-blue, var(--accent)); }
.viewer { position: relative; min-height: 120px; padding: 4px 2px 6px; }
.viewer .tcv_cad_viewer { border: 0; }
.viewer .state { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); pointer-events: none; }

.tablewrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 8px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
tr:last-child td { border-bottom: 0; }
td.num { font-variant-numeric: tabular-nums; }
td.actions { display: flex; gap: 6px; }
.gallery { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.gallery a { background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; display: block; }
.gallery img { width: 100%; display: block; }
.gallery span { display: block; padding: 4px 10px; font-size: 12px; color: #667085; border-top: 1px solid #dfe3ea; }
details { margin-top: 24px; }
details summary { cursor: pointer; color: var(--muted); }
details pre { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px; overflow-x: auto; font-size: 13px; }
