:root {
  --ink:#17273a; --muted:#52657b; --line:#d5dfe8; --bg:#edf2f6; --nav:#111f31;
  --accent:#2454a7; --soft:#eaf1fc; --surface:#fff; --radius:13px;
}
body { background:#ecf1f5; font-family:"Inter","Microsoft YaHei UI","Microsoft YaHei",system-ui,sans-serif }
:focus-visible { outline:3px solid #4282c8; outline-offset:2px }
.layout,.app-surface { background:#f2f5f8 }
.sidebar { background:linear-gradient(168deg,#21364e 0%,#14263b 43%,#101d2e 100%) }
.sidebar .brand { margin-bottom:31px }
.logo { position:relative; width:35px; height:35px; background:#d8e9ff; color:#244a7d; border-radius:9px }
.logo::before { width:16px; height:16px; border:2px solid; border-radius:4px; transform:rotate(45deg); background:none }
.logo::after { content:""; width:6px; height:6px; background:#3668a9; grid-area:1/1; position:absolute; border-radius:1px; transform:rotate(45deg) }
.brand-name small,.nav-icon { color:#abc1dc }
.nav { color:#d7e3f1 }
.nav:hover { background:#273e58 }
.nav.active { background:#2e4968; border-color:#425f80; color:#fff; box-shadow:inset 3px 0 #a7caff }
.nav.active .nav-icon { color:#c6ddff }
.sidebar-footer::before { background:#8db7ec }
.top { min-height:52px; background:#fafcfd; border-color:#dce4ed }
.main { padding:clamp(15px,2.4vw,32px) }
.btn { border-color:#cbd7e2 }
.btn:hover,.demo .btn:hover { background:#edf4fc; border-color:#97b0cc }
.btn.primary { background:#2559a6; border-color:#2559a6 }
.btn.primary:hover { background:#174789; border-color:#174789 }
.hero { background:linear-gradient(180deg,#10263dc9 0%,#10223868 41%,#12243b0a 69%,#112335a6),
    url("/assembly-hall.webp") 56% center/cover no-repeat,#172b41 }
.hero p,.hero>small { color:#e2edfa }
.hero>small::before { background:#9ecaff }
.hero-copy { margin-top:clamp(42px,8vh,96px) }
.hero h1 { letter-spacing:-.02em }
.station-banner { background:linear-gradient(90deg,#162c42 3%,#162c42df 32%,#162c4273 62%,#13223524),
    url("/assembly-hall.webp") center 55%/cover no-repeat,#162c42 }
.station-banner p { color:#d9e7f8 }
.signin { background:#fcfdff }
.demo .btn { background:#f3f6fb }
.focus-panel { background:#223951 }
.focus-panel .quiet,.focus-panel .notice-row small { color:#c7dbf2 }
.focus-panel .notice-kind { color:#e5efff; background:#364d69 }
.manage-tabs button[aria-pressed=true],.product-tabs button[aria-pressed=true] { color:#184981; background:#e6eef9; border-color:#b8cbe3 }
.factory-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:19px; flex-wrap:wrap }
.factory-heading h1 { font-size:clamp(30px,3.4vw,47px); font-weight:730; line-height:1.16 }
.factory-heading p { margin-top:6px; font-size:14px }
.factory-stats { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); border:1px solid #cbd7e4; border-radius:var(--radius); overflow:hidden;
  background:linear-gradient(113deg,#192e46 0%,#223c58 55%,#28435f 100%); color:#fff; box-shadow:0 5px 12px #18324b0a }
.factory-stats>div { padding:14px clamp(12px,2vw,26px); position:relative }
.factory-stats>div+div::before { content:""; position:absolute; top:20%; height:60%; width:1px; left:0; background:#ffffff29 }
.factory-stats small { color:#d2e1f1; font-size:13px }
.factory-stats strong { margin-top:4px; display:block; font:570 clamp(29px,3vw,42px)/1.05 "Inter","Segoe UI",sans-serif; letter-spacing:-.05em; font-variant-numeric:tabular-nums }
@media(min-width:900px) {
  .factory-stats { position:relative; padding-right:22% }
  .factory-stats::after { content:""; position:absolute; right:0; top:0; bottom:0; width:25%;
    background:linear-gradient(90deg,#28435f 0%,#263d5340 33%,transparent 67%),
      url("/assembly-hall.webp") 74% 58% / cover no-repeat }
}
.map-tools { margin:16px 0 10px; display:flex; justify-content:space-between; align-items:center; gap:12px; flex-wrap:wrap }
.map-tools .segment { background:#e0e8f0; padding:3px; border-radius:9px }
.map-tools .segment button { font-size:13px }
.map-tools .segment button[aria-pressed=true] { border-color:#cad5e3; color:#193e70; box-shadow:0 1px 3px #243c5812 }
.map-tools input { max-width:260px; font-size:13px }
.map-empty,.demo-strip { display:flex; gap:8px 18px; align-items:center; flex-wrap:wrap; color:#456079; font-size:13px; margin:8px 1px 12px }
.demo-strip { background:#e6eef9; border:1px solid #bed1e7; padding:8px 13px; border-radius:8px }
.demo-strip .btn { margin-left:auto; min-height:30px; padding:3px 9px }
.factory-line { --route:#2868ab; --tint:#e6f0fb; --wire:#8aabc9; margin:12px 0; border-radius:var(--radius);
  background:#fff; border:1px solid #d2dce6; box-shadow:0 4px 14px #19364d06; overflow:hidden }
.bogie-line { --route:#087768; --tint:#e4f2ee; --wire:#82b4a8 }
.line-heading { display:flex; justify-content:space-between; align-items:center; gap:12px; padding:13px 18px; border-bottom:1px solid #dbe4ec }
.line-heading h2 { font-size:17px; display:flex; align-items:center; gap:9px }
.line-heading h2::before { content:""; width:6px; height:17px; background:var(--route); border-radius:2px }
.line-count { color:var(--route); background:var(--tint); border-radius:5px; padding:2px 8px; font-size:12px; font-weight:650 }
.line-scroll { background-color:#f6f8fa; background-image:radial-gradient(#d8e1e9 .75px,transparent .85px); background-size:14px 14px; padding:16px 18px 13px }
.line-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); column-gap:clamp(18px,2.6vw,44px); row-gap:8px; align-items:start }
.bogie-line .line-grid { grid-template-columns:repeat(4,minmax(0,1fr)) }
.station-card { min-width:0; position:relative; background:#fff; border:1px solid #c9d6e1; border-radius:8px; box-shadow:0 2px 3px #18324b08 }
.station-card.occupied { border-color:var(--route); box-shadow:0 0 0 1px var(--route) }
.line-grid>.station-card:not(:nth-child(3))::after,.bogie-line .line-grid>.station-card:nth-child(3)::after {
  content:""; position:absolute; left:100%; top:36px; background:var(--wire); width:clamp(18px,2.6vw,44px); height:8px;
  clip-path:polygon(0 42%,78% 42%,78% 0,100% 50%,78% 100%,78% 58%,0 58%) }
.bogie-line .line-grid>.station-card:nth-child(4)::after { display:none }
.station-key { cursor:pointer; display:grid; text-align:left; border:0; width:100%; padding:9px 11px 5px; background:transparent; color:var(--ink); border-radius:7px }
.station-key:hover { background:var(--tint) }
.station-key small,.machine-code { font:600 11px/1.5 "IBM Plex Mono",Consolas,"Microsoft YaHei",monospace; letter-spacing:.025em; color:var(--route,#366ba5) }
.station-key strong { font-size:15px; margin-top:1px; line-height:1.45 }
.station-units { margin:0 10px 8px; display:flex; flex-wrap:wrap; gap:3px; max-height:150px; overflow:auto }
.station-units .idle { font-size:11px; color:#607487 }
.unit-token { border:1px solid #bad0df; display:inline-flex; align-items:center; text-align:left; flex-wrap:wrap; gap:3px 6px;
  border-radius:5px; background:var(--tint,#e9f1fa); color:#1f405a; font-size:12px; padding:4px 7px; max-width:100%; overflow-wrap:anywhere }
.unit-token:hover { border-color:#4b7399; background:#d6e7f5 }
.unit-token small { font-size:11px; color:#72551f }
.feed-block { display:flex; flex-wrap:wrap; align-items:center; gap:3px 5px; position:relative; padding:1px 1px 0 8px; border-left:2px solid #c6d7e6 }
.feed-block small,.merge-arrow,.transfer-feed small { font-size:11px; color:#506880 }
.feed-block>small:first-child { width:100%; font-weight:650 }
.feed-block span { font-size:12px; color:#425a70 }
.feed-block span+span::before { content:"·"; margin-right:5px }
.handoff { border-left-color:#61a494 }
.transfer-feed { grid-column:2; grid-row:2; display:grid; justify-content:end; align-self:center; text-align:right }
.transfer-feed strong { font-size:13px; color:#367164 }
.merge-station { grid-column:3; grid-row:2; display:grid; gap:1px }
.merge-arrow { justify-self:center; color:#286858 }
.finished { background:white; border:1px solid var(--line); padding:10px 14px; border-radius:8px; margin:12px 0 }
.finished summary { cursor:pointer; font-size:14px; font-weight:650 }
#finishedUnits { padding-top:9px; display:flex; gap:8px; flex-wrap:wrap }
#productDialog { width:min(730px,96vw) }
#productDialog .dialog-head { background:#f1f5f9 }
#productIdentity { color:#506b87; font-size:12px }
#deleteUnitDialog { width:min(460px,96vw) }
.btn.unit-delete { color:#9a2f36; border-color:#dcb5b8 }
.btn.unit-delete:hover { background:#fff0f1; border-color:#b95e66 }
#productLocation { display:flex; gap:7px; flex-wrap:wrap }
.location-tag { padding:5px 9px; border-radius:6px; color:#294a6c; background:#e7eff8; font-size:13px }
.product-tabs { margin:16px 0 12px; border-bottom:1px solid #d6e0ea; padding-bottom:8px }
#productBody h3,#factoryStationBody h3 { margin:15px 0 6px }
.movement-action { display:flex; justify-content:space-between; align-items:center; gap:10px; border-bottom:1px solid #dbe4ed; padding:10px 0 }
.movement-action small,.movement-action b { display:block }
.movement-action b { font-size:14px }
.unit-timeline { margin:0 0 10px 6px; padding:0 0 0 18px; border-left:2px solid #c6d6e6; list-style:none }
.unit-timeline li { position:relative; padding:5px 0 9px }
.unit-timeline li::before { content:""; position:absolute; width:8px; height:8px; top:10px; left:-23px; border-radius:50%; background:#5281ad }
.unit-timeline strong,.unit-timeline small { display:block; font-size:13px }
.unit-notice { padding:10px 0; border-bottom:1px solid #dbe3eb }
.unit-notice p { font-size:14px; margin:5px 0 }
.part-form { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; margin:16px 0 7px }
.part-form .btn { justify-self:start }
#factoryStationBody>.unit-token { margin:3px }
@media(max-width:850px) { .sidebar .brand { margin:0 } .hero-copy { margin:26px 0 0 } }
@media(max-width:640px) {
  .factory-heading { margin:4px 0 12px }
  .factory-heading .btn { min-height:33px; font-size:12px }
  .map-tools input { flex:1; min-width:135px }
  .line-heading { padding:11px 12px }
  .line-scroll { padding:12px }
  .line-grid,.bogie-line .line-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:18px 13px }
  .drive-line .station-card:nth-child(1) { grid-area:1/1 }
  .drive-line .station-card:nth-child(2) { grid-area:2/1 }
  .drive-line .station-card:nth-child(3) { grid-area:3/1 }
  .drive-line .feed-block:nth-child(4) { grid-area:1/2 }
  .drive-line .feed-block:nth-child(5) { grid-area:2/2 }
  .drive-line .feed-block:nth-child(6) { grid-area:3/2 }
  .feed-block { align-self:center }
  .bogie-line .station-card:nth-child(1) { grid-area:1/1 }
  .bogie-line .station-card:nth-child(2) { grid-area:2/1 }
  .bogie-line .station-card:nth-child(3) { grid-area:3/1/4/3 }
  .bogie-line .station-card:nth-child(4) { grid-area:4/1/5/3 }
  .transfer-feed { grid-area:1/2; justify-content:center; text-align:center }
  .merge-station { grid-area:2/2; position:relative }
  .merge-arrow { display:none }
  .line-grid>.station-card:not(:nth-child(3))::after,.bogie-line .line-grid>.station-card:nth-child(3)::after,.merge-station::after {
    content:""; position:absolute; top:100%; left:50%; width:8px; height:18px; background:var(--wire);
    clip-path:polygon(42% 0,58% 0,58% 68%,100% 68%,50% 100%,0 68%,42% 68%) }
  .merge-station::after { top:100% }
  .part-form { grid-template-columns:1fr }
}
@media(prefers-reduced-motion:no-preference) {
  .station-card.occupied .unit-token { animation:arrive .32s ease-out }
  @keyframes arrive { from { opacity:.5; transform:translateX(-5px) } to { opacity:1; transform:translateX(0) } }
}

/* A photographic line header sits above the live station diagram. */
.factory-line {
  --route:#8fcaff; --wire:#84b8e3; --tint:#203e57;
  --line-photo:url("/drive-line.webp");
  border:1px solid #233d53; background:#132533; box-shadow:0 6px 19px #14263819;
}
.bogie-line { --route:#8ee2cb; --wire:#77bcad; --tint:#1c423f; --line-photo:url("/bogie-line.webp") }
.factory-line .line-heading {
  min-height:108px; display:flex; flex-direction:column; align-items:flex-start; justify-content:center;
  padding:14px 23px; gap:8px; color:#f6fafd; border-bottom:1px solid #4a6375;
  background-color:#111f2c;
  background-image:linear-gradient(90deg,#11212ff5 0%,#11212feb 24%,#11212f8c 42%,#10212f05 66%),var(--line-photo);
  background-size:100% 100%,76% auto; background-position:center,right 53%; background-repeat:no-repeat;
}
.factory-line .line-heading h2 { font-weight:670; font-size:clamp(18px,2vw,24px); letter-spacing:.015em; text-shadow:0 1px 7px #06121b8c }
.factory-line .line-heading h2::before { width:3px; height:20px; border-radius:1px }
.factory-line .line-count { display:inline-flex; align-items:center; gap:6px; padding:3px 8px; font-size:12px; background:#112838e8; color:#def1ff; border:1px solid #648195; border-radius:5px }
.factory-line .line-count::before { content:""; width:6px; height:6px; border-radius:50%; background:var(--route) }
.factory-line .line-scroll {
  background-color:#112332;
  background-image:linear-gradient(#8baac20b 1px,transparent 1px),linear-gradient(90deg,#8baac20b 1px,transparent 1px),linear-gradient(120deg,#1d3345,#10212f 75%);
  background-size:19px 19px,19px 19px,100% 100%; padding-top:18px; padding-bottom:16px;
}
.factory-line .station-card { border-color:#507085; background:linear-gradient(126deg,#263e50,#1b3141); box-shadow:0 3px 8px #0a141c44 }
.factory-line .station-key { color:#f1f6fa }
.factory-line .station-key:hover { background:#375367 }
.factory-line .station-key small { color:var(--route) }
.factory-line .station-key strong { font-weight:620 }
.factory-line .station-card.occupied { border-color:var(--route); box-shadow:inset 3px 0 var(--route),0 0 0 1px #88c8ea25 }
.factory-line .station-units .idle { color:#b7cad9 }
.factory-line .unit-token { color:#fff; border-color:#6d91a1; background:var(--tint) }
.factory-line .unit-token:hover { background:#375a69; border-color:#d0eaff }
.factory-line .unit-token small { color:#ffe0af }
.factory-line .unit-token .unit-job { color:#cde1ee; font-size:10px; padding-left:5px; border-left:1px solid #7995a6 }
.factory-line .feed-block { border-color:#67849a }
.factory-line .feed-block small,.factory-line .transfer-feed small { color:#c3d5e4 }
.factory-line .feed-block span { color:#e2edf4 }
.factory-line .handoff { border-color:#7bb9af }
.factory-line .merge-arrow,.factory-line .transfer-feed strong { color:#9fe0cd }
.job-picker { margin:0 0 13px; padding:0; border:0 }
.job-picker legend { margin:0 0 6px; padding:0; font-weight:650; font-size:14px }
.job-toggle { position:relative; display:inline-grid; grid-template-columns:1fr 1fr; isolation:isolate; padding:3px; touch-action:pan-y; user-select:none;
  border-radius:11px; border:1px solid #c5d2df; background:#e7edf3; min-width:236px }
.job-toggle input { position:absolute; width:1px; height:1px; padding:0; margin:0; opacity:0 }
.job-toggle label { z-index:1; display:block; padding:7px 20px; color:#516579; cursor:pointer; text-align:center; border-radius:8px }
.job-toggle input:checked+label { color:#fff }
.job-toggle input:focus-visible+label { outline:3px solid #76b4f4; outline-offset:2px }
.job-toggle span { position:absolute; top:3px; bottom:3px; left:3px; width:calc(50% - 3px); background:#244e79; border-radius:8px;
  box-shadow:0 2px 4px #213b512e; transition:transform .18s ease }
.job-toggle #jobRepair:checked~span { transform:translateX(100%); background:#21645f }
.job-toggle:not(:has(input:checked)) span { visibility:hidden }
.job-toggle input:disabled+label { opacity:.55; cursor:default }
#factoryCreateForm .group { align-items:start }
#factoryCreateForm label small { font-size:12px; font-weight:450; line-height:1.5 }
.register-footer { border-top:1px solid var(--line); margin-top:16px; padding-top:14px; display:flex; align-items:center; justify-content:space-between; gap:12px }
#batchCount { font-size:14px; font-weight:650; color:#405b73 }
#registeredBom:not(:empty) { display:flex; align-items:center; flex-wrap:wrap; gap:6px 10px; margin-top:9px; font-size:13px }
#registeredBom small { font-size:12px }
@media(max-width:640px) {
  .factory-line .line-heading { padding:13px 15px; min-height:86px; background-size:100% 100%,92% auto }
  .factory-line .line-scroll { padding:12px }
  .job-toggle { min-width:0; width:100% }
}
