:root {
  color-scheme: light;
  --ink: #102b28;
  --muted: #5a706b;
  --line: #dce7e3;
  --line-strong: #c4d8d1;
  --brand: #145849;
  --brand-deep: #0e3b31;
  --brand-soft: #e7f3ed;
  --accent: #0f8a6a;
  --amber: #b45309;
  --canvas: #f4f7f5;
  --card: #ffffff;
  --shadow-sm: 0 1px 2px #123e3710, 0 4px 14px #123e3708;
  --shadow-md: 0 8px 30px #123e3716;
  --radius: 14px;
  font: 16px/1.55 system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--canvas); color: var(--ink); }
main > section, main > .workspace { scroll-margin-top: 82px; }
h1, h2, h3, p, dl, dd { margin: 0; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; cursor: pointer; }
a { color: var(--brand); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid #4ec3a1; outline-offset: 2px;
}
[hidden] { display: none !important; }
.shell { width: min(1280px, calc(100% - 72px)); margin-inline: auto; }
body { min-height: 100vh; display: flex; flex-direction: column; }
body > main { flex: 1; }

/* Lucide SVGs are inlined as <symbol> elements in index.html. */
.icon-sprite { display: none; }
.icon {
  display: inline-block; width: 18px; height: 18px; flex: 0 0 auto; vertical-align: -0.2em;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 20; background: #fffffff2;
  border-bottom: 1px solid var(--line); backdrop-filter: blur(12px);
}
.header-inner { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); font-weight: 720; text-decoration: none; letter-spacing: 0.01em; }
.brand-mark {
  flex: 0 0 34px; height: 34px; background: var(--brand); border-radius: 10px;
  display: grid; grid-template: repeat(2, 5px) / repeat(2, 5px); place-content: center; gap: 3px;
  box-shadow: 0 4px 10px #14584935;
}
.brand-mark i { background: #a6e7cb; border-radius: 2px; }
.brand-mark i:last-child { background: #fff; }
.platform-nav { display: flex; align-items: center; gap: 4px; }
.platform-nav a {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 13px;
  border-radius: 9px; color: var(--muted); font-size: 0.9rem; text-decoration: none;
  transition: color 180ms, background 180ms;
}
.platform-nav a:hover { color: var(--brand); background: var(--brand-soft); }
.platform-nav a[aria-current="page"] { color: #fff; background: var(--brand); }
.platform-nav .icon { width: 16px; height: 16px; }
time { font: 0.88rem ui-monospace, monospace; color: var(--muted); }

/* Hero */
.hero {
  position: relative; isolation: isolate; overflow: hidden;
  min-height: 250px; margin: 30px 0 36px; padding: 38px 44px;
  display: flex; align-items: center; justify-content: space-between; gap: 40px;
  color: #fff; background: var(--brand-deep); border-radius: 22px;
  box-shadow: 0 18px 48px #0e3b3124;
}
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background-image: linear-gradient(#ffffff0d 1px, transparent 1px), linear-gradient(90deg, #ffffff0d 1px, transparent 1px);
  background-size: 34px 34px; mask-image: linear-gradient(90deg, transparent 8%, #000 85%);
}
.hero::after {
  content: ""; position: absolute; z-index: -1; right: -120px; top: -160px;
  width: 520px; height: 520px; border-radius: 50%;
  background: radial-gradient(circle, #5fd5ac55 0%, #1f8f6b1a 58%, transparent 72%);
}
.eyebrow { display: inline-flex; align-items: center; gap: 9px; font-size: 0.82rem; letter-spacing: 0.12em; color: #a9dccb; }
.pulse { width: 7px; height: 7px; border-radius: 50%; background: #7fe3bb; box-shadow: 0 0 0 5px #7fe3bb26; }
.hero h1 { margin-top: 12px; font-size: clamp(1.9rem, 3.8vw, 3rem); font-weight: 760; letter-spacing: 0.02em; line-height: 1.18; }
.hero-lead { margin-top: 14px; color: #c9e5dc; font-size: 0.98rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 17px;
  border-radius: 10px; font-size: 0.9rem; font-weight: 620; text-decoration: none;
  transition: transform 180ms, background 180ms, box-shadow 180ms;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { color: #0c342a; background: #a6e7cb; box-shadow: 0 8px 20px #06281c33; }
.btn-primary:hover { background: #c3f2dd; }
.btn-ghost { color: #dff4eb; border: 1px solid #a9dccb55; }
.btn-ghost:hover { background: #ffffff14; }
.stats { display: flex; gap: 0; margin: 0; flex: 0 0 auto; }
.stats div {
  position: relative; display: flex; flex-direction: column; gap: 3px;
  padding-inline: clamp(16px, 2.2vw, 32px); min-width: 112px; border-left: 1px solid #c4e3d84a;
}
.stats div:last-child { padding-right: 0; }
.stat-icon { color: #8fd9c0; margin-bottom: 6px; }
.stats dt { font-size: 0.82rem; color: #bcded3; white-space: nowrap; }
.stats dd { color: #fff; font-size: 2.15rem; font-weight: 720; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-unit { font-size: 0.76rem; color: #9fd3c1; }

/* Shared section furniture */
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 18px; }
.section-kicker { margin-bottom: 4px; color: var(--accent); font: 600 0.72rem/1.4 ui-monospace, monospace; letter-spacing: 0.14em; }
.section-heading h2 { font-size: clamp(1.35rem, 2.4vw, 1.72rem); letter-spacing: 0.01em; }
.section-heading p { color: var(--muted); font-size: 0.88rem; white-space: nowrap; }
.platform-panel { padding-bottom: 42px; }
.entry-action {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 13px;
  border: 1px solid var(--line-strong); border-radius: 9px; background: #fff;
  color: var(--brand); font-size: 0.875rem; font-weight: 620; text-decoration: none;
  transition: background 180ms, border-color 180ms;
}
.entry-action:hover { background: var(--brand-soft); border-color: #a9d4c4; }
.entry-action .icon { width: 15px; height: 15px; }

/* Directory */
.directory-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.directory-entry {
  display: flex; align-items: center; gap: 18px; min-width: 0; padding: 24px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--card);
  box-shadow: var(--shadow-sm); transition: transform 200ms, box-shadow 200ms, border-color 200ms;
}
.directory-entry:hover { transform: translateY(-3px); border-color: #a9d4c4; box-shadow: var(--shadow-md); }
.entry-icon {
  display: grid; place-items: center; flex: 0 0 52px; height: 52px;
  border-radius: 14px; color: var(--brand); background: var(--brand-soft);
}
.entry-icon .icon { width: 24px; height: 24px; }
.entry-body { min-width: 0; flex: 1; }
.entry-category { color: var(--accent); font-size: 0.76rem; font-weight: 700; letter-spacing: 0.08em; }
.directory-entry h3 { margin: 4px 0 5px; font-size: 1.12rem; }
.directory-entry p { color: var(--muted); font-size: 0.86rem; }

/* Model workspace */
.model-layout { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 20px; align-items: start; }
.model-sidebar { display: grid; gap: 14px; position: sticky; top: 82px; }
.control-card, .info-card {
  padding: 18px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--card); box-shadow: var(--shadow-sm);
}
.control-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; font-size: 0.9rem; font-weight: 700; }
.count-badge {
  padding: 2px 8px; border-radius: 999px; background: var(--brand-soft);
  color: var(--brand); font: 600 0.75rem/1.6 ui-monospace, monospace; font-variant-numeric: tabular-nums;
}
.search-field {
  position: relative; display: flex; align-items: center; gap: 8px;
  padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 10px; background: #fbfdfc;
  transition: border-color 180ms, box-shadow 180ms;
}
.search-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px #0f8a6a1f; }
.search-field > .icon { color: var(--muted); }
#scan-search { flex: 1; min-width: 0; height: 40px; border: 0; outline: 0; background: none; font-size: 0.92rem; }
#scan-search::-webkit-search-cancel-button { display: none; }
#scan-clear {
  display: grid; place-items: center; width: 26px; height: 26px; padding: 0;
  border: 0; border-radius: 7px; background: #eaf1ee; color: var(--muted);
}
#scan-clear:hover { background: #dceae4; color: var(--ink); }
#scan-clear .icon { width: 14px; height: 14px; }
.batch-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 16px; }
.chip {
  padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px;
  background: #fff; color: var(--muted); font-size: 0.78rem; font-weight: 600;
  transition: background 160ms, color 160ms, border-color 160ms;
}
.chip:hover { border-color: #a9d4c4; color: var(--brand); }
.chip[aria-pressed="true"] { color: #fff; background: var(--brand); border-color: var(--brand); }
.field label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 0.8rem; font-weight: 650; }
.select-wrap { position: relative; }
#scan-select {
  width: 100%; height: 42px; padding: 0 34px 0 12px; appearance: none;
  border: 1px solid var(--line-strong); border-radius: 10px; background: #fff;
  color: var(--ink); font-size: 0.92rem; font-variant-numeric: tabular-nums;
}
#scan-select:disabled { color: var(--muted); background: #f4f7f5; cursor: not-allowed; }
.select-arrow { position: absolute; right: 12px; top: 12px; color: var(--muted); pointer-events: none; width: 16px; height: 16px; }
.empty-hint { margin-top: 10px; color: var(--amber); font-size: 0.82rem; }
.info-card { background: linear-gradient(160deg, #ffffff 40%, #f1f8f4); }
.info-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; font-size: 0.86rem; font-weight: 700; }
.pill { padding: 3px 9px; border-radius: 999px; background: var(--brand); color: #fff; font: 600 0.76rem ui-monospace, monospace; }
.info-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 10px; }
.info-grid div { min-width: 0; }
.info-grid dt { color: var(--muted); font-size: 0.75rem; }
.info-grid dd { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.95rem; font-weight: 680; font-variant-numeric: tabular-nums; }
.info-note { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.78rem; }
.model-controls { display: flex; flex-wrap: wrap; gap: 6px; }
.model-controls button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 9px;
  background: #fff; color: var(--brand); font-size: 0.84rem; font-weight: 620;
  transition: background 160ms, border-color 160ms, color 160ms;
}
.model-controls button:hover:not(:disabled) { background: var(--brand-soft); border-color: #a9d4c4; }
.model-controls button[aria-pressed="true"] { color: #fff; background: var(--brand); border-color: var(--brand); }
.model-controls button:disabled { opacity: 0.5; cursor: not-allowed; }
.model-controls .icon { width: 15px; height: 15px; }
.zoom-row { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; color: var(--muted); font-size: 0.82rem; }
.zoom-row .model-controls button { min-width: 42px; }

.model-main { min-width: 0; }
.model-stage {
  position: relative; overflow: hidden; border: 1px solid #1f5c4e; border-radius: var(--radius);
  background: radial-gradient(ellipse at 50% 42%, #245d51, #102f2a 76%);
  box-shadow: var(--shadow-md);
}
.model-stage::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(#ffffff0a 1px, transparent 1px), linear-gradient(90deg, #ffffff0a 1px, transparent 1px);
  background-size: 42px 42px;
}
#foot-model { position: relative; display: block; width: 100%; height: clamp(380px, 52vw, 610px); cursor: grab; }
#foot-model:active { cursor: grabbing; }
#foot-model:focus-visible { outline: 3px solid #9de3cc; outline-offset: -4px; }
.stage-badge {
  position: absolute; z-index: 2; top: 14px; left: 14px; padding: 6px 11px;
  border: 1px solid #a9dccb45; border-radius: 8px; background: #0b2824b8;
  color: #d4f2e5; font: 600 0.78rem ui-monospace, monospace; letter-spacing: 0.04em;
}
.model-message {
  position: absolute; inset: auto 12px 18px; display: grid; justify-items: center; gap: 8px;
  color: #fff; text-align: center; font-size: 0.88rem; pointer-events: none;
}
.model-message p { padding: 7px 12px; border-radius: 8px; background: #0b2824d9; }
.model-file { display: grid; gap: 4px; padding: 9px 12px; border-radius: 8px; background: #0b2824e6; pointer-events: auto; }
.model-file input { width: min(220px, 60vw); }
.stage-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 13px 4px; color: var(--muted); font-size: 0.83rem;
}
.stage-tip { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.stage-tip .icon { width: 15px; height: 15px; }

/* Reports */
.workspace { display: grid; grid-template-columns: 224px minmax(0, 1fr); gap: 30px; padding-bottom: 52px; }
.sidebar { align-self: start; padding: 18px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow-sm); }
.sidebar h2 { margin: 2px 0 14px 8px; font-size: 1rem; }
.people { display: grid; gap: 5px; }
.person {
  display: grid; grid-template-columns: 34px 1fr auto; gap: 9px; align-items: center;
  width: 100%; padding: 8px; min-width: 0; border: 1px solid transparent; border-radius: 10px;
  background: transparent; text-align: left; font-size: 0.92rem;
  transition: background 160ms, border-color 160ms;
}
.avatar { display: grid; place-items: center; height: 34px; border-radius: 9px; background: #eff4f2; color: var(--brand); font-size: 0.86rem; font-weight: 700; }
.person-count { color: var(--muted); font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.person:hover { background: #f3f7f5; }
.person[aria-pressed="true"] { color: var(--brand); background: var(--brand-soft); border-color: #bfded1; font-weight: 700; }
.person[aria-pressed="true"] .avatar { background: #cbe7dc; }
.library { min-width: 0; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 20px; }
.filter {
  padding: 8px 15px; min-height: 38px; border: 1px solid var(--line); border-radius: 9px;
  background: #fff; font-size: 0.85rem; font-weight: 620;
  transition: background 160ms, border-color 160ms, color 160ms;
}
.filter:hover { border-color: #a9d4c4; color: var(--brand); }
.filter[aria-pressed="true"] { color: #fff; background: var(--brand); border-color: var(--brand); }
.gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.card {
  display: block; padding: 9px; width: 100%; min-width: 0; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius);
  text-align: left; transition: border-color 180ms, box-shadow 180ms, transform 180ms;
}
.card:hover { transform: translateY(-2px); border-color: #a9d4c4; box-shadow: var(--shadow-md); }
.preview {
  position: relative; display: grid; place-items: center; aspect-ratio: 1.25;
  padding: 12px; border-radius: 9px; overflow: hidden; background: #eaf1ee;
}
.preview img {
  display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain;
  filter: drop-shadow(0 2px 4px #172c2630);
}
.card-info { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 11px 5px 4px; }
.card-info strong { font-size: 0.92rem; }
.card-info span { color: var(--muted); font-size: 0.8rem; white-space: nowrap; }

/* Viewer */
dialog {
  width: min(940px, calc(100% - 24px)); max-height: 94dvh; padding: 0;
  border: 1px solid var(--line); border-radius: 16px; color: var(--ink); background: #fff;
  box-shadow: 0 30px 90px #06201959;
}
dialog[open] { display: flex; flex-direction: column; }
dialog::backdrop { background: #0d201ecc; backdrop-filter: blur(3px); }
body:has(dialog[open]) { overflow: hidden; }
.viewer-header, .viewer-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; }
.viewer-header { border-bottom: 1px solid var(--line); }
.viewer-footer { border-top: 1px solid var(--line); }
.viewer-header h2 { font-size: 1rem; }
.viewer-header p, .viewer-footer span { color: var(--muted); font-size: 0.85rem; }
.viewer-actions { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.viewer-actions a, .viewer-actions button, .viewer-footer button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: #fff; padding: 7px 11px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 0.85rem; text-decoration: none;
}
.viewer-actions a:hover, .viewer-footer button:hover:not(:disabled) { background: var(--brand-soft); }
.viewer-actions button { padding: 5px 10px; }
.viewer-footer button:disabled { color: #8a9894; background: #f2f5f3; cursor: not-allowed; }
.viewer-image { min-height: 0; overflow: auto; background: #eaf1ee; padding: 10px; }
#zoom { display: block; width: max-content; max-width: 100%; padding: 0; margin: auto; border: 0; background: none; cursor: zoom-in; }
#viewer-image { display: block; max-width: 100%; max-height: 70dvh; }
#zoom[aria-pressed="true"] { max-width: none; cursor: zoom-out; }
#zoom[aria-pressed="true"] img { max-width: none; max-height: none; }

.platform-footer { border-top: 1px solid var(--line); padding-block: 20px; color: var(--muted); background: #fff; font-size: 0.85rem; }

@media (max-width: 1080px) {
  .model-layout { grid-template-columns: 280px minmax(0, 1fr); gap: 16px; }
  .hero { padding: 32px; }
}
@media (max-width: 990px) {
  .workspace { grid-template-columns: 190px minmax(0, 1fr); gap: 22px; }
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .model-layout { grid-template-columns: 1fr; }
  .model-sidebar { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .model-sidebar .control-card:last-child { grid-column: 1 / -1; }
}
@media (max-width: 700px) {
  .shell { width: calc(100% - 32px); }
  .header-inner { min-height: 58px; flex-wrap: wrap; justify-content: flex-start; gap: 6px; padding-block: 9px; }
  .brand { flex-basis: 100%; font-size: 0.92rem; }
  .platform-nav a { padding: 6px 9px; font-size: 0.84rem; }
  .hero { align-items: flex-start; flex-direction: column; margin: 18px 0 26px; padding: 24px; gap: 24px; }
  .hero h1 { font-size: clamp(1.45rem, 5.2vw, 1.9rem); }
  .hero-lead { font-size: 0.9rem; }
  .stats { width: 100%; justify-content: space-between; }
  .stats div { min-width: 0; padding-inline: clamp(8px, 2.5vw, 20px); }
  .stats div:first-child { padding-left: 0; border-left: 0; }
  .stats dd { font-size: 1.6rem; }
  .directory-list { grid-template-columns: 1fr; gap: 12px; }
  .directory-entry { padding: 16px; gap: 12px; }
  .entry-icon { flex-basis: 44px; height: 44px; }
  .model-sidebar { grid-template-columns: 1fr; }
  .model-sidebar .control-card:last-child { grid-column: auto; }
  .stage-footer { flex-direction: column; align-items: flex-start; gap: 4px; }
  .workspace { display: block; }
  .sidebar { margin-bottom: 20px; padding: 12px; }
  .sidebar h2 { margin-bottom: 8px; }
  .people { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gallery { gap: 10px; }
  .card { padding: 6px; }
  .preview { padding: 6px; }
  .section-heading { align-items: center; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
