:root {
  color-scheme: light;
  --bg: #eef2f4;
  --surface: #ffffff;
  --surface-soft: #f7f9f8;
  --ink: #111820;
  --muted: #5e6975;
  --line: #d5dce2;
  --line-strong: #aeb9c4;
  --blue: #1677c7;
  --cyan: #0ea5b7;
  --green: #2f9d55;
  --amber: #b7791f;
  --red: #c73a31;
  --violet: #7656b7;
  --charcoal: #1a232d;
  --active-hotspot-color: var(--cyan);
  --shadow: 0 24px 60px rgba(17, 24, 32, 0.16);
  --shadow-soft: 0 14px 34px rgba(17, 24, 32, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(22, 119, 199, 0.08), transparent 34%),
    linear-gradient(135deg, rgba(183, 121, 31, 0.08), transparent 38%),
    var(--bg);
  color: var(--ink);
  font-family:
    "PingFang SC",
    "Microsoft YaHei",
    "Noto Sans CJK SC",
    system-ui,
    sans-serif;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(26, 35, 45, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(26, 35, 45, 0.05) 1px, transparent 1px),
    linear-gradient(135deg, transparent 0 47%, rgba(14, 165, 183, 0.08) 47% 48%, transparent 48% 100%);
  background-size:
    42px 42px,
    42px 42px,
    280px 280px;
  content: "";
  pointer-events: none;
}

button {
  font: inherit;
}

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

.page-shell {
  min-height: 100vh;
}

.topbar {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 28px;
  align-items: end;
  overflow: hidden;
  padding: 28px 32px 24px;
  border-bottom: 1px solid rgba(174, 185, 196, 0.75);
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 250, 0.94)),
    var(--surface);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset;
}

.topbar::before {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--blue), var(--cyan) 38%, var(--amber) 70%, var(--green));
  content: "";
}

.topbar::after {
  position: absolute;
  right: 32px;
  bottom: -1px;
  width: min(520px, 42vw);
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(17, 24, 32, 0.22));
  content: "";
}

.brand-block {
  min-width: 0;
}

.eyebrow,
.section-kicker,
.detail-kicker {
  margin: 0 0 7px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.eyebrow span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(47, 157, 85, 0.12);
}

h1 {
  margin-bottom: 10px;
  max-width: 860px;
  font-size: 31px;
  line-height: 1.16;
  letter-spacing: 0;
}

h1 span {
  display: block;
}

.lead {
  max-width: 780px;
  margin-bottom: 0;
  color: #42505e;
  font-size: 14px;
  line-height: 1.7;
}

.meta-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(92px, auto));
  gap: 10px;
  margin: 0;
}

.meta-strip div {
  position: relative;
  min-width: 92px;
  overflow: hidden;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(247, 249, 248, 0.92)),
    var(--surface);
  box-shadow: 0 10px 20px rgba(17, 24, 32, 0.06);
}

.meta-strip div::before {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 2px;
  background: var(--blue);
  content: "";
  opacity: 0.75;
}

.meta-strip div:nth-child(2)::before {
  background: var(--cyan);
}

.meta-strip div:nth-child(3)::before {
  background: var(--amber);
}

.meta-strip div:nth-child(4)::before {
  background: var(--green);
}

.meta-strip dt {
  color: var(--muted);
  font-size: 11px;
}

.meta-strip dd {
  margin: 2px 0 0;
  font-size: 15px;
  font-weight: 800;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(350px, 430px);
  gap: 20px;
  padding: 20px;
}

.plan-area {
  min-width: 0;
}

.section-bar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
}

.section-bar h2 {
  margin-bottom: 0;
  font-size: 21px;
  line-height: 1.25;
}

.drawing-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  color: #354251;
  font-size: 12px;
  font-weight: 700;
}

.drawing-stats span {
  padding: 7px 9px;
  border: 1px solid rgba(174, 185, 196, 0.78);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 8px 20px rgba(17, 24, 32, 0.06);
}

.plan-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  padding: 7px;
  border: 1px solid rgba(174, 185, 196, 0.78);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 0 12px 30px rgba(17, 24, 32, 0.08);
  backdrop-filter: blur(14px);
}

.filter-btn {
  --filter-color: var(--charcoal);
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #3d4854;
  cursor: pointer;
  font-size: 13px;
  font-weight: 750;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.filter-btn[data-filter="process"] {
  --filter-color: var(--red);
}

.filter-btn[data-filter="storage"] {
  --filter-color: var(--amber);
}

.filter-btn[data-filter="support"] {
  --filter-color: var(--violet);
}

.filter-btn[data-filter="admin"] {
  --filter-color: var(--green);
}

.filter-btn[data-filter="safety"] {
  --filter-color: var(--blue);
}

.filter-mark {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: var(--filter-color);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--filter-color), transparent 84%);
}

.filter-count {
  min-width: 22px;
  padding: 2px 5px;
  border-radius: 6px;
  background: rgba(17, 24, 32, 0.07);
  color: #27313b;
  font-size: 11px;
  text-align: center;
}

.filter-btn:hover,
.filter-btn:focus-visible {
  border-color: color-mix(in srgb, var(--filter-color), transparent 52%);
  background: color-mix(in srgb, var(--filter-color), white 92%);
  color: #111820;
  outline: none;
}

.filter-btn.is-active {
  border-color: color-mix(in srgb, var(--filter-color), black 12%);
  background: var(--filter-color);
  color: #fff;
  box-shadow: 0 12px 22px color-mix(in srgb, var(--filter-color), transparent 78%);
}

.filter-btn.is-active .filter-mark {
  background: #fff;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.18);
}

.filter-btn.is-active .filter-count {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.plan-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 1786 / 1266;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 249, 248, 0.98)),
    #fff;
  box-shadow: var(--shadow);
  isolation: isolate;
}

.plan-frame::before {
  position: absolute;
  inset: 0;
  z-index: 2;
  background-image:
    linear-gradient(rgba(22, 119, 199, 0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(22, 119, 199, 0.09) 1px, transparent 1px);
  background-size: 34px 34px;
  content: "";
  opacity: 0.32;
  pointer-events: none;
}

.plan-frame::after {
  position: absolute;
  inset: 10px;
  z-index: 4;
  border: 1px solid rgba(17, 24, 32, 0.08);
  border-radius: 5px;
  content: "";
  pointer-events: none;
}

.plan-image {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: saturate(0.95) contrast(1.04);
  pointer-events: none;
  user-select: none;
}

.hotspot-layer {
  position: absolute;
  inset: 0;
  z-index: 3;
}

.hotspot {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--w);
  height: var(--h);
  min-width: 22px;
  min-height: 20px;
  border: 1px solid color-mix(in srgb, var(--hotspot-color), transparent 52%);
  border-radius: var(--radius, 6px);
  background: color-mix(in srgb, var(--hotspot-color), transparent 88%);
  color: var(--ink);
  cursor: pointer;
  isolation: isolate;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    opacity 160ms ease,
    transform 160ms ease;
}

.hotspot::before {
  position: absolute;
  left: 7px;
  top: 7px;
  z-index: 1;
  width: 10px;
  height: 10px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--hotspot-color);
  box-shadow:
    0 0 0 4px color-mix(in srgb, var(--hotspot-color), transparent 82%),
    0 6px 14px rgba(17, 24, 32, 0.18);
  content: "";
}

.hotspot::after {
  position: absolute;
  inset: -4px;
  z-index: -1;
  border: 1px solid color-mix(in srgb, var(--hotspot-color), transparent 64%);
  border-radius: inherit;
  content: "";
  opacity: 0;
  transform: scale(0.96);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.hotspot span {
  position: absolute;
  left: 24px;
  top: 4px;
  max-width: calc(100% - 31px);
  overflow: hidden;
  padding: 4px 7px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 10px 20px rgba(17, 24, 32, 0.12);
  color: #17202a;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.24;
  opacity: 0;
  text-overflow: ellipsis;
  transform: translateY(-4px);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
  white-space: nowrap;
}

.hotspot:hover,
.hotspot:focus-visible,
.hotspot.is-active {
  z-index: 5;
  border-color: var(--hotspot-color);
  background: color-mix(in srgb, var(--hotspot-color), transparent 76%);
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.82),
    0 16px 34px rgba(17, 24, 32, 0.22);
  outline: none;
  transform: translateY(-1px);
}

.hotspot:hover::after,
.hotspot:focus-visible::after,
.hotspot.is-active::after {
  opacity: 1;
  transform: scale(1);
}

.hotspot:hover span,
.hotspot:focus-visible span,
.hotspot.is-active span {
  opacity: 1;
  transform: translateY(0);
}

.hotspot.is-dimmed {
  opacity: 0.12;
  pointer-events: none;
}

.detail-panel {
  --panel-accent: var(--active-hotspot-color);
  position: sticky;
  top: 20px;
  align-self: start;
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 22px;
  border: 1px solid rgba(174, 185, 196, 0.86);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 250, 0.96)),
    var(--surface);
  box-shadow: var(--shadow-soft);
  scrollbar-width: thin;
}

.detail-panel::before {
  display: block;
  height: 4px;
  margin: -22px -22px 18px;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(90deg, var(--panel-accent), var(--charcoal) 58%, var(--amber));
  content: "";
}

.detail-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.category-pill,
.detail-index {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  gap: 8px;
  padding: 0 9px;
  border: 1px solid rgba(174, 185, 196, 0.82);
  border-radius: 8px;
  background: rgba(247, 249, 248, 0.8);
  color: #26313c;
  font-size: 12px;
  font-weight: 800;
}

.category-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--swatch-color, var(--cyan));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--swatch-color, var(--cyan)), transparent 84%);
}

.detail-heading {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.detail-heading h2 {
  margin-bottom: 10px;
  font-size: 25px;
  line-height: 1.2;
  letter-spacing: 0;
}

.detail-heading p:last-child,
.detail-section p {
  margin-bottom: 0;
  color: #354251;
  font-size: 15px;
  line-height: 1.75;
}

.detail-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 18px 0 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.detail-metrics div {
  min-width: 0;
  padding: 12px 10px 12px 0;
}

.detail-metrics div + div {
  padding-left: 12px;
  border-left: 1px solid var(--line);
}

.detail-metrics dt {
  color: var(--muted);
  font-size: 11px;
}

.detail-metrics dd {
  overflow: hidden;
  margin: 4px 0 0;
  color: #111820;
  font-size: 14px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.process-ribbon {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-top: 18px;
}

.process-ribbon::before {
  position: absolute;
  left: 8%;
  right: 8%;
  top: 13px;
  height: 1px;
  background: linear-gradient(90deg, var(--cyan), var(--red), var(--amber));
  content: "";
}

.process-ribbon span {
  position: relative;
  min-width: 0;
  padding-top: 23px;
  color: #46525e;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.process-ribbon span::before {
  position: absolute;
  left: 50%;
  top: 6px;
  width: 12px;
  height: 12px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--panel-accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--panel-accent), transparent 86%);
  content: "";
  transform: translateX(-50%);
}

.detail-section {
  padding-top: 20px;
}

.detail-section h3 {
  position: relative;
  margin-bottom: 10px;
  padding-left: 12px;
  font-size: 14px;
  letter-spacing: 0;
}

.detail-section h3::before {
  position: absolute;
  left: 0;
  top: 0.15em;
  width: 3px;
  height: 1.1em;
  border-radius: 2px;
  background: var(--panel-accent);
  content: "";
}

.detail-section ul {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.detail-section li {
  position: relative;
  padding-left: 18px;
  color: #354251;
  font-size: 14px;
  line-height: 1.65;
}

.detail-section li::before {
  position: absolute;
  left: 0;
  top: 0.76em;
  width: 7px;
  height: 7px;
  border: 1px solid #fff;
  border-radius: 50%;
  background: var(--panel-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--panel-accent), transparent 86%);
  content: "";
}

.tooltip {
  position: fixed;
  z-index: 20;
  max-width: min(360px, calc(100vw - 28px));
  padding: 13px 14px;
  border: 1px solid rgba(22, 32, 42, 0.15);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 38px rgba(18, 29, 42, 0.22);
  color: var(--ink);
  opacity: 0;
  pointer-events: none;
  transform: translate(12px, 12px);
  transition: opacity 120ms ease;
}

.tooltip.is-visible {
  opacity: 1;
}

.tooltip strong {
  display: block;
  margin-bottom: 5px;
  font-size: 14px;
}

.tooltip span {
  display: block;
  color: #3d4a58;
  font-size: 13px;
  line-height: 1.55;
}

@media (prefers-reduced-motion: no-preference) {
  .hotspot.is-active::before {
    animation: hotspot-pulse 1.8s ease-in-out infinite;
  }
}

@keyframes hotspot-pulse {
  0%,
  100% {
    box-shadow:
      0 0 0 4px color-mix(in srgb, var(--hotspot-color), transparent 82%),
      0 6px 14px rgba(17, 24, 32, 0.18);
  }

  50% {
    box-shadow:
      0 0 0 8px color-mix(in srgb, var(--hotspot-color), transparent 92%),
      0 6px 14px rgba(17, 24, 32, 0.18);
  }
}

@media (max-width: 1180px) {
  .topbar {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .meta-strip {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: 100%;
  }

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

  .detail-panel {
    position: relative;
    top: auto;
    max-height: none;
  }
}

@media (max-width: 720px) {
  .topbar,
  .workspace {
    padding-left: 12px;
    padding-right: 12px;
  }

  .topbar {
    padding-top: 22px;
  }

  h1 {
    font-size: 24px;
  }

  .lead {
    font-size: 13px;
  }

  .meta-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .section-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .drawing-stats {
    justify-content: stretch;
  }

  .drawing-stats span {
    flex: 1;
    text-align: center;
  }

  .plan-toolbar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-btn {
    justify-content: space-between;
  }

  .detail-panel {
    padding: 18px;
  }

  .detail-panel::before {
    margin: -18px -18px 16px;
  }

  .detail-metrics {
    grid-template-columns: 1fr;
  }

  .detail-metrics div {
    padding: 11px 0;
  }

  .detail-metrics div + div {
    padding-left: 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .process-ribbon {
    grid-template-columns: repeat(5, minmax(46px, 1fr));
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .hotspot span {
    display: none;
  }
}
