:root {
  --bg: #ffffff;
  --bg-subtle: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #f4f6fa;
  --surface-3: #eaeef5;
  --border: rgba(15, 23, 42, 0.09);
  --border-strong: rgba(15, 23, 42, 0.17);
  --text: #0f172a;
  --text-muted: #475569;
  --text-dim: #64748b;

  /* Dynamic series accent (Default: 21 Sustain Champagne Amber) */
  --gold: #b47b17;
  --gold-bright: #8c5a08;
  --gold-solid: #b47b17;
  --gold-solid-hover: #9a6710;
  --gold-dim: rgba(180, 123, 23, 0.11);
  --gold-border: rgba(180, 123, 23, 0.36);
  --hero-glow: rgba(217, 155, 38, 0.13);

  --topbar-h: 54px;
  --sidebar-w: 278px;

  --shimano-blue: #0284c7;
  --daiwa-red: #dc2626;
  --accent-green: #059669;
  --accent-coral: #ea580c;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 14px;
  --shadow: 0 2px 14px rgba(15, 23, 42, 0.05), 0 1px 2px rgba(15, 23, 42, 0.04);
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
}

/* 22 Miravel: Titanium Slate Blue */
body[data-theme="silver"] {
  --gold: #2563eb;
  --gold-bright: #1d4ed8;
  --gold-solid: #2563eb;
  --gold-solid-hover: #1d4ed8;
  --gold-dim: rgba(37, 99, 235, 0.1);
  --gold-border: rgba(37, 99, 235, 0.34);
  --hero-glow: rgba(59, 130, 246, 0.1);
}

/* 23 Legalis LT: Daiwa Crimson & Warm Gold */
body[data-theme="crimson"] {
  --gold: #c93b3b;
  --gold-bright: #a62626;
  --gold-solid: #c93b3b;
  --gold-solid-hover: #a82b2b;
  --gold-dim: rgba(201, 59, 59, 0.09);
  --gold-border: rgba(201, 59, 59, 0.34);
  --hero-glow: rgba(220, 38, 38, 0.09);
}

/* 21 Zillion SV TW: Precision Cobalt Cyan */
body[data-theme="cyan"] {
  --gold: #0284c7;
  --gold-bright: #0369a1;
  --gold-solid: #0284c7;
  --gold-solid-hover: #0369a1;
  --gold-dim: rgba(2, 132, 199, 0.1);
  --gold-border: rgba(2, 132, 199, 0.34);
  --hero-glow: rgba(14, 165, 233, 0.11);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, a {
  font-family: inherit;
}

/* Compact Top Navigation */
.topbar {
  position: sticky;
  top: 0;
  z-index: 45;
  height: var(--topbar-h);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  height: 100%;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.sidebar-toggle-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
}

.sidebar-toggle-btn:hover {
  color: var(--text);
  background: var(--surface-3);
  border-color: var(--border-strong);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #0f172a;
  border: 1px solid rgba(15, 23, 42, 0.14);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.05em;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.15);
}

.brand-title {
  font-weight: 800;
  font-size: 14.5px;
  letter-spacing: 0.04em;
  color: var(--text);
  line-height: 1.2;
}

.brand-sub {
  font-size: 11px;
  color: var(--text-dim);
}

.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-dim);
  padding-left: 12px;
  border-left: 1px solid var(--border);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.topbar-breadcrumb .bc-current {
  color: var(--text);
  font-weight: 700;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.official-link-btn {
  color: var(--gold-bright);
  border-color: var(--gold-border);
  background: var(--gold-dim);
}

.official-link-btn:hover {
  background: color-mix(in srgb, var(--gold) 18%, #ffffff);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 9px;
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid transparent;
  transition: all 0.16s ease;
  white-space: nowrap;
}

.btn-ghost {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-ghost:hover {
  background: var(--surface-2);
  border-color: rgba(15, 23, 42, 0.26);
}

.btn-gold {
  background: var(--gold-solid);
  color: #ffffff;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--gold-solid) 26%, transparent);
}

.btn-gold:hover {
  background: var(--gold-solid-hover);
}

.badge-count {
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.26);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* App Shell: Left Sidebar + Right Main Area */
.app-shell {
  display: flex;
  min-height: calc(100vh - var(--topbar-h));
  align-items: stretch;
  background: var(--bg);
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  z-index: 42;
  backdrop-filter: blur(2px);
}

/* Left Reel Directory Sidebar */
.reel-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  background: #fafbfd;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 43;
  transition: width 0.22s ease, transform 0.22s ease, opacity 0.2s ease;
}

.app-shell.sidebar-collapsed .reel-sidebar {
  width: 0;
  overflow: hidden;
  border-right-color: transparent;
  opacity: 0;
  pointer-events: none;
}

.sidebar-head {
  padding: 13px 12px 10px;
  border-bottom: 1px solid var(--border);
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.sidebar-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
}

.sidebar-count {
  font-size: 11px;
  font-family: var(--mono);
  color: var(--text-dim);
}

.sidebar-search input {
  padding: 7px 26px 7px 30px;
  font-size: 12.5px;
}

.reel-type-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
}

.type-tab {
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 5px 4px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.type-tab:hover {
  color: var(--text);
}

.type-tab.active {
  background: #ffffff;
  color: var(--gold-bright);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.1);
}

.sidebar-catalog {
  flex: 1;
  overflow-y: auto;
  padding: 11px 10px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.catalog-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.catalog-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 4px;
}

.catalog-section-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.section-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
}

.section-dot.spinning {
  background: #10b981;
}

.section-dot.baitcasting {
  background: #0284c7;
}

.catalog-section-count {
  font-size: 11px;
  font-family: var(--mono);
  color: var(--text-dim);
}

.series-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.series-card:hover {
  border-color: var(--border-strong);
}

.series-card.active {
  border-color: var(--gold-border);
  box-shadow: 0 3px 12px color-mix(in srgb, var(--gold) 12%, transparent);
}

.series-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.brand-dot {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
}

.brand-dot.shimano {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

.brand-dot.daiwa {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.series-card-titles {
  min-width: 0;
  flex: 1;
}

.series-card-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.series-card.active .series-card-name {
  color: var(--gold-bright);
}

.series-card-cn {
  font-size: 11px;
  color: var(--text-dim);
}

.series-models-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sidebar-model-btn {
  width: 100%;
  border: 1px solid transparent;
  background: var(--surface-2);
  color: var(--text-muted);
  border-radius: 7px;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  text-align: left;
  transition: all 0.14s ease;
}

.sidebar-model-btn:hover {
  background: var(--surface-3);
  color: var(--text);
}

.sidebar-model-btn.active {
  background: var(--gold-dim);
  color: var(--gold-bright);
  border-color: var(--gold-border);
}

.sidebar-model-meta {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-dim);
  font-weight: 500;
  white-space: nowrap;
}

.sidebar-model-btn.active .sidebar-model-meta {
  color: var(--gold-bright);
}

.sidebar-empty {
  text-align: center;
  color: var(--text-dim);
  font-size: 12.5px;
  padding: 28px 10px;
}

/* Main Content Column */
.main-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.container {
  width: 100%;
  max-width: 1460px;
  margin: 0 auto;
  padding: 16px 20px 44px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}

/* Hero Profile Card */
.hero-card {
  background:
    radial-gradient(620px 220px at 0% 0%, var(--hero-glow), transparent 62%),
    #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 22px 15px;
  box-shadow: var(--shadow);
}

.hero-top {
  display: grid;
  grid-template-columns: minmax(280px, 1.15fr) minmax(340px, 1fr);
  gap: 20px;
  align-items: start;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.pill {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.pill-brand.shimano {
  background: #e0f2fe;
  color: #0369a1;
  border-color: #bae6fd;
}

.pill-brand.daiwa {
  background: #fee2e2;
  color: #dc2626;
  border-color: #fecaca;
}

.pill-type {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}

.pill-series {
  background: var(--gold-dim);
  color: var(--gold-bright);
  border-color: var(--gold-border);
}

.pill-year {
  background: var(--surface-2);
  color: var(--text-muted);
}

.hero-title {
  margin: 0 0 8px;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.015em;
  color: #0f172a;
}

.hero-subtitle {
  margin: 0 0 10px;
  color: var(--text-muted);
  font-size: 13.5px;
  line-height: 1.65;
}

.hero-target {
  font-size: 13px;
  color: var(--text);
}

.meta-label {
  color: var(--gold-bright);
  font-weight: 700;
}

.hero-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.stat-tile {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
}

.stat-label {
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 3px;
}

.stat-value {
  font-size: 15px;
  font-weight: 700;
  font-family: var(--mono);
  color: var(--text);
}

.stat-value.gold {
  color: var(--gold-bright);
}

.hero-size-row {
  margin-top: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.hero-size-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  white-space: nowrap;
}

.model-switcher {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.model-pill {
  border: 1px solid var(--border-strong);
  background: #ffffff;
  color: var(--text-muted);
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.16s ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.model-pill:hover {
  color: var(--text);
  background: var(--surface-2);
}

.model-pill.active {
  background: var(--gold-solid);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--gold-solid) 30%, transparent);
}

.model-pill .pill-wt {
  font-size: 11px;
  opacity: 0.82;
  font-weight: 500;
}

.line-cap-bar {
  margin-top: 12px;
  padding: 9px 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.line-cap-item strong {
  color: var(--text);
  font-weight: 700;
  margin-right: 6px;
}

.tech-drawer {
  margin-top: 12px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.tech-summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--gold-bright);
  cursor: pointer;
  user-select: none;
}

.tech-summary::-webkit-details-marker {
  display: none;
}

.tech-drawer[open] .tech-chevron {
  transform: rotate(180deg);
}

.tech-chevron {
  transition: transform 0.16s ease;
  display: inline-block;
}

.tech-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.tech-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.tech-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.tech-name {
  font-weight: 700;
  font-size: 13px;
  color: var(--gold-bright);
}

.tech-cn {
  font-size: 11.5px;
  color: var(--text-muted);
}

.tech-desc {
  font-size: 12px;
  color: var(--text-dim);
  margin: 0;
}

/* Main Workspace */
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(340px, 0.95fr);
  gap: 16px;
  align-items: stretch;
}

/* Left: Interactive Schematic Panel */
.diagram-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}

.diagram-toolbar {
  padding: 9px 14px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.quick-layers {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.layer-chip {
  border: 1px solid var(--border-strong);
  background: #ffffff;
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.layer-chip:hover {
  color: var(--text);
  background: var(--surface-2);
}

.layer-chip.active {
  background: var(--gold-solid);
  color: #ffffff;
  border-color: var(--gold-solid);
}

.viewer-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toggle-outline {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.toggle-outline input {
  accent-color: var(--gold-solid);
  cursor: pointer;
}

.zoom-group {
  display: inline-flex;
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}

.icon-btn {
  border: none;
  background: transparent;
  color: var(--text);
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.14s ease;
}

.icon-btn:hover {
  background: var(--surface-2);
}

.zoom-label {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-muted);
  min-width: 44px;
  text-align: center;
}

.fullscreen-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-left: 1px solid var(--border);
  border-radius: 0 6px 6px 0;
  margin-left: 2px;
  padding-left: 10px;
  color: var(--gold-bright);
}

.fullscreen-btn:hover {
  background: var(--gold-dim);
}

/* Fullscreen Mode for Diagram Panel */
body.diagram-fullscreen-open {
  overflow: hidden;
}

.diagram-panel.is-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 55;
  border-radius: 0;
  border: none;
  height: 100dvh;
  width: 100vw;
}

.diagram-panel.is-fullscreen .viewport {
  flex: 1;
  height: auto;
  min-height: 0;
}

.diagram-panel.is-fullscreen .selected-detail {
  max-height: 28vh;
  overflow-y: auto;
}

.diagram-panel.is-fullscreen .fullscreen-btn {
  background: var(--gold-dim);
  color: var(--gold-bright);
}

/* Blueprint Viewport (Seamless Pure White) */
.viewport {
  position: relative;
  height: 600px;
  overflow: hidden;
  background-color: #ffffff;
  background-image:
    linear-gradient(to right, rgba(15, 23, 42, 0.038) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(15, 23, 42, 0.038) 1px, transparent 1px);
  background-size: 28px 28px;
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.viewport.dragging {
  cursor: grabbing;
}

.canvas-stage {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  will-change: transform;
}

.canvas-stage.animating {
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.canvas-stage img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
}

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

.hotspot {
  position: absolute;
  transform: translate(-50%, -50%);
  border-radius: 4px;
  cursor: pointer;
  border: 1.5px solid transparent;
  background: transparent;
  transition: background 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease, transform 0.14s ease;
  padding: 0;
}

.hotspot::after {
  content: "";
  position: absolute;
  inset: -4px;
}

.hotspot.show-outline {
  border-color: rgba(37, 99, 235, 0.42);
  background: rgba(59, 130, 246, 0.08);
}

.hotspot.layer-highlight {
  border-color: var(--hs-color, #d6a94e);
  background: color-mix(in srgb, var(--hs-color, #d6a94e) 26%, transparent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--hs-color, #d6a94e) 32%, transparent);
  z-index: 4;
}

.hotspot.hovered {
  border-color: #2563eb;
  background: rgba(37, 99, 235, 0.22);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.24);
  z-index: 8;
}

.hotspot.selected {
  border-color: #d97706;
  background: rgba(245, 158, 11, 0.28);
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.4);
  z-index: 12;
  animation: pulseRing 1.7s ease-in-out infinite;
}

@keyframes pulseRing {
  0%, 100% {
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.44);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(245, 158, 11, 0.1);
  }
}

.hover-tooltip {
  position: absolute;
  z-index: 25;
  pointer-events: none;
  background: rgba(15, 23, 42, 0.94);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.26);
  max-width: 290px;
  white-space: nowrap;
}

.tooltip-code {
  font-family: var(--mono);
  font-weight: 700;
  color: #fbbf24;
  margin-right: 6px;
}

.tooltip-sub {
  font-size: 11px;
  color: #cbd5e1;
  margin-top: 2px;
}

.viewport-hint {
  position: absolute;
  left: 12px;
  bottom: 10px;
  z-index: 15;
  background: rgba(15, 23, 42, 0.78);
  color: #f8fafc;
  font-size: 11.5px;
  padding: 4px 10px;
  border-radius: 999px;
  pointer-events: none;
  backdrop-filter: blur(6px);
}

/* Selected Part Detail Bar */
.selected-detail {
  padding: 14px 16px;
  background: var(--bg-subtle);
  border-top: 1px solid var(--border);
  min-height: 92px;
}

.detail-empty {
  color: var(--text-dim);
  font-size: 13px;
  display: flex;
  align-items: center;
  min-height: 62px;
}

.detail-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.detail-title-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.detail-code {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 800;
  color: var(--gold-bright);
  background: var(--gold-dim);
  border: 1px solid var(--gold-border);
  padding: 2px 9px;
  border-radius: 6px;
}

.detail-partcode {
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 700;
  color: #0369a1;
  background: #e0f2fe;
  border: 1px solid #bae6fd;
  padding: 2px 8px;
  border-radius: 6px;
}

.detail-cn {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.detail-en {
  font-size: 12.5px;
  color: var(--text-muted);
}

.detail-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  background: #ffffff;
  color: var(--text-muted);
  border: 1px solid var(--border-strong);
}

.tag-gold {
  background: var(--gold-dim);
  color: var(--gold-bright);
  border-color: var(--gold-border);
}

.tag-green {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}

.tag-blue {
  background: #e0f2fe;
  color: #0369a1;
  border-color: #bae6fd;
}

.tag-red {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fecaca;
}

.tag-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  display: inline-block;
}

.detail-note {
  font-size: 12.5px;
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-left: 3px solid #d97706;
  padding: 6px 10px;
  border-radius: 0 6px 6px 0;
}

.shared-models-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12px;
  color: var(--text-dim);
}

.shared-btn {
  border: 1px solid var(--border-strong);
  background: #ffffff;
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.14s ease;
}

.shared-btn:hover {
  border-color: var(--gold-border);
  color: var(--gold-bright);
  background: var(--gold-dim);
}

.shared-btn.current {
  border-color: var(--gold-border);
  color: var(--gold-bright);
  background: var(--gold-dim);
}

/* Right: Parts List Panel */
.parts-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  height: 750px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.parts-header {
  padding: 13px 14px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.parts-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.parts-title-row h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.parts-counter {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 10px;
  color: var(--text-dim);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  padding: 8px 30px 8px 32px;
  border-radius: 9px;
  border: 1px solid var(--border-strong);
  background: #ffffff;
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-box input::placeholder {
  color: #94a3b8;
}

.search-box input:focus {
  border-color: var(--gold-solid);
  box-shadow: 0 0 0 3px var(--gold-dim);
}

.clear-search {
  position: absolute;
  right: 7px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 2px 5px;
}

.category-tabs {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.cat-tab {
  border: 1px solid var(--border-strong);
  background: #ffffff;
  color: var(--text-muted);
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.14s ease;
}

.cat-tab:hover {
  color: var(--text);
  background: var(--surface-2);
}

.cat-tab.active {
  background: var(--gold-dim);
  color: var(--gold-bright);
  border-color: var(--gold-border);
}

.parts-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: #ffffff;
}

.part-row {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 9px 10px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  transition: all 0.14s ease;
  text-align: left;
}

.part-row:hover {
  background: var(--bg-subtle);
  border-color: var(--border);
}

.part-row.selected {
  background: var(--gold-dim);
  border-color: var(--gold-border);
}

.part-code-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.part-code {
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--gold-bright);
}

.part-subcode {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-muted);
}

.part-qty {
  font-size: 10.5px;
  color: var(--text-dim);
  font-family: var(--mono);
}

.part-info-col {
  min-width: 0;
}

.part-cn {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.part-en {
  font-size: 11.5px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.part-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 3px;
}

.mini-badge {
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.mini-bearing {
  background: var(--gold-dim);
  color: var(--gold-bright);
}

.mini-upgrade {
  background: #ecfdf5;
  color: #047857;
}

.mini-price {
  background: var(--surface-2);
  color: var(--text-muted);
  font-family: var(--mono);
}

.mini-warn {
  background: #fef2f2;
  color: #dc2626;
}

.add-order-btn {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: 1px solid var(--border-strong);
  background: #ffffff;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.14s ease;
}

.add-order-btn:hover {
  border-color: var(--gold-border);
  color: var(--gold-bright);
  background: var(--gold-dim);
}

.add-order-btn.added {
  background: var(--gold-solid);
  color: #ffffff;
  border-color: var(--gold-solid);
  font-size: 13px;
  font-weight: 800;
}

/* Bottom Reference Cards */
.reference-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 16px;
}

.ref-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}

.ref-header {
  margin-bottom: 12px;
}

.ref-header h3 {
  margin: 0 0 3px;
  font-size: 15.5px;
  font-weight: 700;
  color: var(--text);
}

.ref-sub {
  margin: 0;
  font-size: 12px;
  color: var(--text-dim);
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  padding: 8px 10px;
  font-size: 11.5px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border-strong);
  font-weight: 700;
  white-space: nowrap;
  background: var(--bg-subtle);
}

.data-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
}

.data-table tbody tr {
  cursor: pointer;
  transition: background 0.14s ease;
}

.data-table tbody tr:hover {
  background: var(--bg-subtle);
}

.mono {
  font-family: var(--mono);
  color: var(--gold-bright);
  font-weight: 700;
}

.size-pill {
  font-family: var(--mono);
  font-size: 12px;
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--gold-dim);
  color: var(--gold-bright);
  font-weight: 600;
  white-space: nowrap;
}

.upgrade-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.upgrade-item {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.upgrade-item:hover {
  border-color: var(--gold-border);
  background: #ffffff;
}

.upgrade-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.upgrade-note {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.55;
}

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  padding: 20px;
  color: var(--text-dim);
  font-size: 12px;
  background: var(--bg-subtle);
}

.footer-inner {
  max-width: 1460px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.footer strong {
  color: var(--text);
}

/* Order List Drawer */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  z-index: 60;
  backdrop-filter: blur(3px);
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(440px, 92vw);
  background: #ffffff;
  border-left: 1px solid var(--border);
  z-index: 70;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: -12px 0 40px rgba(15, 23, 42, 0.14);
}

.drawer.open {
  transform: translateX(0);
}

.drawer-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.drawer-header h3 {
  margin: 0 0 3px;
  font-size: 16px;
}

.drawer-sub {
  margin: 0;
  font-size: 12px;
  color: var(--text-dim);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.drawer-empty {
  color: var(--text-dim);
  text-align: center;
  padding: 40px 12px;
  font-size: 13px;
}

.order-group-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--gold-bright);
  margin: 4px 0 6px;
  letter-spacing: 0.03em;
}

.order-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 9px;
}

.order-item-info {
  min-width: 0;
}

.order-item-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.order-item-sub {
  font-size: 11.5px;
  color: var(--text-dim);
}

.qty-stepper {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  padding: 2px 4px;
}

.qty-stepper button {
  border: none;
  background: transparent;
  color: var(--text);
  width: 22px;
  height: 22px;
  cursor: pointer;
  border-radius: 4px;
  font-weight: 700;
}

.qty-stepper button:hover {
  background: var(--surface-2);
}

.qty-stepper span {
  font-family: var(--mono);
  font-size: 12.5px;
  min-width: 18px;
  text-align: center;
}

.drawer-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%) translateY(20px);
  background: #0f172a;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.28);
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
  z-index: 90;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Responsive */
@media (max-width: 1240px) {
  .workspace {
    grid-template-columns: 1fr;
  }
  .viewport {
    height: 500px;
  }
  .parts-panel {
    height: 540px;
  }
  .reference-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .reel-sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    bottom: 0;
    height: calc(100vh - var(--topbar-h));
    width: min(300px, 84vw);
    transform: translateX(-100%);
    box-shadow: 12px 0 36px rgba(15, 23, 42, 0.16);
  }
  .app-shell.mobile-sidebar-open .reel-sidebar {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
  }
  .app-shell.sidebar-collapsed .reel-sidebar {
    width: min(300px, 84vw);
  }
  .hero-top {
    grid-template-columns: 1fr;
  }
  .tech-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .topbar-breadcrumb {
    display: none;
  }
}

@media (max-width: 640px) {
  .topbar-inner {
    padding: 0 10px;
  }
  .container {
    padding: 12px 12px 36px;
  }
  .hero-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .tech-grid {
    grid-template-columns: 1fr;
  }
  .viewport {
    height: 360px;
  }
  .official-link-btn {
    display: none;
  }
}
