:root {
  color-scheme: light dark;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --border: #e1e5eb;
  --text: #172033;
  --muted: #5d6879;
  --accent: #0b5cab;
  --ok-bg: #e6f6ee;
  --ok-fg: #137a43;
  --bad-bg: #fdecec;
  --bad-fg: #b42318;
  --neutral-bg: #eef1f5;
  --neutral-fg: #4b5565;
  --radius: 10px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="light"] {
  color-scheme: light;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f141a;
  --surface: #161c24;
  --surface-2: #1c232d;
  --border: #2a323d;
  --text: #e6eaf0;
  --muted: #98a2b3;
  --accent: #6cb4ff;
  --ok-bg: #12301f;
  --ok-fg: #5fd394;
  --bad-bg: #3a1717;
  --bad-fg: #ff8a80;
  --neutral-bg: #222a35;
  --neutral-fg: #b3bccb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.85em;
  overflow-wrap: anywhere;
}

.container {
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: clamp(16px, 4vw, 32px);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.site-header .container {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 52px;
  padding-block: 8px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  white-space: nowrap;
  font-size: 0.92rem;
}

.brand-mark {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--accent);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}

.breadcrumb a {
  color: var(--muted);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--text);
}

.breadcrumb .sep {
  color: var(--muted);
}

.breadcrumb .current {
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 650;
}

.site-nav {
  margin-left: auto;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.88rem;
  padding: 6px 10px;
  border-radius: 6px;
  white-space: nowrap;
}

.site-nav a:hover {
  color: var(--text);
  background: var(--surface-2);
}

.site-nav a[hidden],
.visual-diff-section[hidden] {
  display: none;
}

.theme-toggle {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}

.theme-toggle:hover {
  color: var(--text);
  border-color: var(--muted);
}

.theme-toggle svg {
  width: 16px;
  height: 16px;
}

.theme-toggle .icon-sun {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

:root[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

main {
  padding-bottom: 56px;
}

.page-head {
  padding: 28px 0 8px;
}

.page-head h1 {
  margin: 0 0 10px;
  font-size: 1.6rem;
  letter-spacing: -0.01em;
}

.status-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--neutral-bg);
  color: var(--neutral-fg);
  text-decoration: none;
}

.pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.pill[data-state="success"] {
  background: var(--ok-bg);
  color: var(--ok-fg);
}

.pill[data-state="failure"] {
  background: var(--bad-bg);
  color: var(--bad-fg);
}

.pill.plain::before {
  display: none;
}

.pill.link {
  color: var(--accent);
}

.section {
  margin-top: 36px;
}

.section-compact {
  margin-top: 28px;
}

.section-heading {
  margin-bottom: 12px;
}

.section-heading h2 {
  margin: 0;
  font-size: 1.15rem;
}

.section-heading p {
  margin: 2px 0 0;
  max-width: none;
  color: var(--muted);
  font-size: 0.9rem;
}

.card,
article,
.viewer-shell,
.model-fallback,
.preview-panel,
.empty-state {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.card-head h3 {
  margin: 0;
  font-size: 0.95rem;
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

iframe {
  width: 100%;
  height: 520px;
  border: 0;
  background: var(--surface);
}

.viewer-shell {
  height: min(760px, 78vh);
}

kicanvas-embed {
  display: block;
  width: 100%;
  height: 100%;
}

.model-fallback {
  padding: 28px;
  min-height: 260px;
}

x3d-canvas {
  display: block;
  width: 100%;
  height: min(640px, 72vh);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.model-actions {
  margin: 10px 0 0;
}

.tab-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 12px;
  padding: 4px;
  background: var(--surface-2);
  border-radius: 8px;
  width: fit-content;
  max-width: 100%;
}

.tab-button {
  border: 0;
  background: transparent;
  padding: 6px 12px;
  border-radius: 6px;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}

.tab-button:hover,
.tab-button:focus-visible,
.tab-button.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.08);
  outline: none;
}

.diff-image-link {
  display: block;
  padding: 10px;
  background: var(--surface);
}

.diff-image {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  background: var(--surface);
}

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

.file,
.download-grid a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 550;
}

.file:hover,
.download-grid a:hover {
  border-color: var(--accent);
}

.file .type {
  flex: none;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--muted);
}

.board-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.board-card {
  display: grid;
  gap: 8px;
  min-height: 120px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: inherit;
  text-decoration: none;
}

.board-card:hover,
.board-card:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.board-name {
  font-size: 1.05rem;
  font-weight: 700;
}

.board-path,
.board-meta {
  color: var(--muted);
  font-size: 0.88rem;
  overflow-wrap: anywhere;
}

.empty-state {
  padding: 28px;
}

.site-footer {
  margin: 48px 0 32px;
  color: var(--muted);
  font-size: 0.82rem;
}

@media (max-width: 760px) {
  .site-header .container {
    gap: 10px;
  }

  .breadcrumb .crumb-root {
    display: none;
  }

  .report-grid,
  .download-grid,
  .file-grid {
    grid-template-columns: 1fr;
  }

  iframe {
    height: 440px;
  }
}
