html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #c5d4e0;
  font-family: "Segoe UI", "Avenir Next", sans-serif;
  color: #1a3654;
}
#view {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}
#hud { position: fixed; inset: 0; pointer-events: none; }
#plan {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: #d5e0ea;
  pointer-events: auto;
}
#plan[hidden] { display: none; }
.brand, .quest, .hint, .dock, .top-right, .tour { z-index: 8; }
#plan-sheet {
  position: absolute;
  left: 392px;
  right: 396px;
  top: 12px;
  bottom: 72px;
  display: flex;
  flex-direction: column;
  background: #f7f3ea;
  border-radius: 22px;
  box-shadow: 0 10px 28px rgba(22, 48, 84, 0.12);
  overflow: hidden;
}
.plan-head { padding: 14px 16px 8px; }
#plan-move { margin: 8px 0 0; color: #6d7f95; font-size: 12px; }
#plan-body { display: flex; flex: 1; min-height: 0; }
#plan-view {
  position: relative;
  flex: 1;
  min-width: 0;
  margin: 0 12px 12px;
  overflow: hidden;
  cursor: grab;
  border-radius: 12px;
  background: #e7eef5;
  touch-action: none;
  user-select: none;
}
#plan-view.is-drag { cursor: grabbing; }
#plan-view.is-board { overflow: auto; cursor: auto; }
#plan-view.is-board #plan-stage {
  position: static;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 12px;
  padding: 4px;
}
.plan-card {
  width: 220px;
  box-sizing: border-box;
  background: #fff;
  border: 1px solid #e4d9c8;
  border-radius: 16px;
  padding: 12px 14px 14px;
}
.plan-card.open { flex: 1 1 100%; width: auto; }
.plan-card.has-bad, .plan-card.is-down { border-color: #8a3412; }
.plan-card-hit {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
  color: inherit;
}
.plan-card-hit b {
  display: block;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6d7f95;
}
.plan-card-hit span {
  display: block;
  margin-top: 2px;
  font-family: Georgia, "Iowan Old Style", serif;
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.03em;
  color: #1a3654;
}
.plan-param-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.plan-param {
  min-width: 140px;
  max-width: 240px;
  background: #f7f3ea;
  border-radius: 12px;
  padding: 8px 10px;
}
.plan-param b { display: block; font-size: 13px; color: #1a3654; }
.plan-param span { display: block; margin-top: 2px; font-size: 12px; color: #3e5168; }
.plan-param.bad { background: #f6e4dc; }
.plan-param.bad b, .plan-param.bad span { color: #8a3412; }
.plan-card > .plan-param { margin: 8px 0 0; background: none; padding: 0; }
#plan-stage { position: absolute; left: 0; top: 0; }
#plan-side {
  width: 260px;
  overflow: auto;
  border-left: 1px solid #e4d9c8;
  padding: 8px 10px 12px;
}
#plan-side[hidden] { display: none; }
#kpi {
  position: absolute;
  inset: 0;
  z-index: 12;
  background: rgba(197, 212, 224, 0.72);
  pointer-events: auto;
}
#kpi[hidden] { display: none; }
.kpi-sheet {
  position: absolute;
  left: 392px;
  right: 396px;
  top: 12px;
  bottom: 72px;
  display: flex;
  flex-direction: column;
  background: #f7f3ea;
  border-radius: 22px;
  box-shadow: 0 10px 28px rgba(22, 48, 84, 0.16);
  overflow: hidden;
}
#kpi-grid {
  overflow: auto;
  padding: 8px 16px 16px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}
.kpi-card {
  background: #fff;
  border: 1px solid #e4d9c8;
  border-radius: 16px;
  padding: 14px;
}
.kpi-card h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}
.kpi-value {
  margin: 8px 0 0;
  font-family: Georgia, "Iowan Old Style", serif;
  font-size: 28px;
  letter-spacing: -0.03em;
}
.kpi-rate, .kpi-note {
  margin: 6px 0 0;
  color: #3e5168;
  font-size: 13px;
  line-height: 1.4;
}
.kpi-span { grid-column: 1 / -1; }
.issue-row { margin-top: 0.6rem; }
.issue-row p { margin: 0 0 0.35rem; }
.issue-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.issue-btn {
  font: inherit;
  font-size: 0.85rem;
  padding: 0.25rem 0.55rem;
  border: 1px solid currentColor;
  background: transparent;
  color: inherit;
  cursor: pointer;
}
.kpi-list {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}
.kpi-list li {
  display: grid;
  gap: 2px;
  padding: 8px 0;
  border-top: 1px solid #e4d9c8;
}
.kpi-list strong { font-size: 15px; color: #14283c; }
.kpi-list span { color: #3e5168; font-size: 13px; }
.plan-head h2 {
  margin: 2px 0 4px;
  font-family: Georgia, "Iowan Old Style", serif;
  font-weight: 500;
  font-size: 26px;
  letter-spacing: -0.03em;
}
.plan-head p { margin: 0; color: #3e5168; font-size: 13px; }
.plan-toggle {
  margin-top: 8px;
  border: 1px solid #1a4a78;
  background: #f7f8fb;
  color: #1a3654;
  border-radius: 999px;
  font: 12px/1 "Segoe UI", "Avenir Next", sans-serif;
  font-weight: 700;
  padding: 6px 12px;
  cursor: pointer;
}
.plan-toggle[aria-pressed="true"] { background: #1a4a78; color: #f7f5f1; }
.plan-toggle + .plan-toggle { margin-left: 8px; }
.plan-floor {
  position: absolute;
  background: #e7eef5;
  border-radius: 12px;
  border: 1px solid #c5d4e4;
}
.plan-aisle {
  position: absolute;
  background: #f7f8fb;
  border-top: 1px dashed #c5d0dc;
  border-bottom: 1px dashed #c5d0dc;
}
.plan-side {
  position: absolute;
  font-size: 10px;
  letter-spacing: 0.14em;
  font-weight: 700;
  color: #6d7f95;
}
.plan-tool, .plan-person, .plan-job, .plan-tug {
  position: absolute;
  cursor: pointer;
}
.plan-tool { transform: translate(-50%, -50%); }
.plan-person, .plan-job, .plan-tug { transform: translate(0, -50%); }
.plan-tool {
  border: 1px solid #1a4a78;
  background: #f7f8fb;
  color: #1a3654;
  border-radius: 6px;
  font: 11px/1.15 "Segoe UI", "Avenir Next", sans-serif;
  padding: 2px 3px;
  overflow: hidden;
  text-align: center;
}
.plan-tool b { display: block; font-size: 10px; letter-spacing: 0.02em; }
.plan-tool span { display: block; font-weight: 500; }
.plan-tool.is-down { border-color: #a33b2b; background: #f8e8e4; }
.plan-tool.is-blocked { border-color: #a37b12; background: #f8f0d8; }
.plan-tool.is-open { outline: 2px solid #8a3412; outline-offset: 2px; z-index: 3; }
.plan-tool.has-late { border-color: #8a3412; }
.plan-late {
  display: block;
  margin-top: 2px;
  color: #8a3412;
  font-style: normal;
  font-size: 10px;
  font-weight: 700;
}
.plan-person, .plan-job, .plan-tug {
  border: 0;
  border-radius: 999px;
  font: 11px/1.2 "Segoe UI", "Avenir Next", sans-serif;
  padding: 4px 8px;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(22, 48, 84, 0.16);
}
.plan-tug { background: #c45c26; color: #fffaf6; }
.plan-person { background: #1a4a78; color: #f7f5f1; }
.plan-job { background: #f7f3ea; color: #1a3654; }
.plan-job.part-inner { background: #1e8c45; color: #f7f5f1; }
.plan-job.part-outer { background: #2f6fa3; color: #f7f5f1; }
.plan-job.part-joined { background: #e7dcc4; color: #1a3654; }
.plan-job.is-behind { background: #8a3412; color: #fffaf6; }
.plan-pop {
  position: absolute;
  z-index: 4;
  width: 240px;
  max-height: 280px;
  overflow: auto;
  background: #f7f3ea;
  border: 1px solid #1a4a78;
  border-radius: 12px;
  box-shadow: 0 8px 22px rgba(22, 48, 84, 0.18);
  padding: 8px;
}
#plan-side .plan-pop {
  position: static;
  width: auto;
  max-height: none;
  box-shadow: none;
  border: 0;
  padding: 0;
  background: transparent;
}
.plan-pop header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 700;
}
.plan-pop header button, .plan-pop .plan-face {
  border: 0;
  background: #1a4a78;
  color: #f7f5f1;
  border-radius: 999px;
  font: 11px/1 "Segoe UI", "Avenir Next", sans-serif;
  padding: 4px 8px;
  cursor: pointer;
}
.plan-pop .plan-row {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 8px;
  margin-top: 4px;
  padding: 6px 8px;
  background: #f7f8fb;
  color: #1a3654;
  font: 12px/1.3 "Segoe UI", "Avenir Next", sans-serif;
  cursor: pointer;
}
.plan-pop .plan-row.is-behind { background: #8a3412; color: #fffaf6; }
.plan-pop .plan-empty-line { margin: 4px 0 0; color: #3e5168; font-size: 12px; }
.plan-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #3e5168;
  font-size: 14px;
}
#hud button, #hud .card, #hud .pill, #hud .tools button { pointer-events: auto; }

.brand, .card, .pill, .dock, .hint, .tools {
  box-shadow: 0 10px 28px rgba(22, 48, 84, 0.12);
}
.brand {
  position: absolute;
  top: 16px;
  left: 16px;
  background: #f6f1e8;
  border-radius: 18px;
  padding: 10px 16px 12px;
}
.brand b {
  font-size: 22px;
  letter-spacing: -0.03em;
}
.brand small {
  display: block;
  margin-top: 2px;
  color: #6d7f95;
  letter-spacing: 0.16em;
  font-size: 10px;
}
.card {
  background: #f7f3ea;
  border-radius: 22px;
}
.quest {
  position: absolute;
  top: 92px;
  left: 16px;
  width: min(320px, calc(100vw - 32px));
  padding: 16px 18px 14px;
}
.eyebrow {
  font-size: 11px;
  letter-spacing: 0.16em;
  color: #6d7f95;
  font-weight: 700;
}
.quest h1, .plaque h2 {
  margin: 4px 0 6px;
  font-family: Georgia, "Iowan Old Style", serif;
  font-weight: 500;
  font-size: 28px;
  letter-spacing: -0.03em;
}
.quest p, .plaque p {
  margin: 0;
  color: #3e5168;
  font-size: 14px;
  line-height: 1.45;
}
.job-pick {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 10px;
  font-size: 11px;
  letter-spacing: 0.14em;
  font-weight: 700;
  color: #6d7f95;
}
.job-pick[hidden] { display: none; }
.job-pick select {
  font: 13px/1.3 "Segoe UI", "Avenir Next", sans-serif;
  letter-spacing: 0;
  font-weight: 500;
  color: #1a3654;
  background: #fff;
  border: 1px solid #d5cbbd;
  border-radius: 10px;
  padding: 6px 8px;
  max-width: 100%;
}
.job-note {
  margin-top: 6px !important;
  font-size: 12px !important;
}
#gauges {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}
#gauges[hidden] { display: none; }
#life {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}
#life[hidden] { display: none; }
#life-board { flex: 1; min-height: 0; }
#life-close {
  margin-left: auto;
  height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid #1a3654;
  background: #1a3654;
  color: #f7f3ea;
  font: 600 13px sans-serif;
  cursor: pointer;
}
.life-svg { width: 100%; height: 100%; display: block; }
.life-title { font: 700 14px sans-serif; fill: #1a3654; }
.life-label { font: 12px sans-serif; fill: #4a5d73; }
.life-val { font: 700 13px sans-serif; fill: #142033; text-anchor: end; }
.life-flow {
  stroke-linecap: round;
  stroke-dasharray: 7 9;
  animation: life-dash 0.9s linear infinite;
}
@keyframes life-dash { to { stroke-dashoffset: -32; } }
.gauge-sheet {
  pointer-events: auto;
  position: absolute;
  left: 392px;
  right: 396px;
  top: 16px;
  bottom: 78px;
  display: flex;
  flex-direction: column;
  background: #f4efe4;
  border-radius: 22px;
  box-shadow: 0 10px 28px rgba(22, 48, 84, 0.16);
  overflow: hidden;
}
.gauge-head {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 14px 16px 8px;
  border-bottom: 1px solid #e4d9c8;
}
.gauge-id { min-width: 180px; }
.gauge-id h2 {
  margin: 2px 0 4px;
  font-family: Georgia, "Iowan Old Style", serif;
  font-weight: 500;
  font-size: 26px;
}
#process { flex: 1; min-width: 0; }
.process-keys, .process-row { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.process-row { margin-top: 8px; }
.process-mode { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: #3e5168; min-width: 0; }
.process-mode select { max-width: 220px; }
#process select, #process button {
  font: inherit;
  border: 1px solid #d5d0c6;
  border-radius: 10px;
  background: #fff;
  padding: 6px 8px;
}
#process-live { display: none; }
#process-idv-note, #process-fail-note { margin-top: 6px; font-size: 12px; color: #3e5168; }
#process button:disabled { opacity: 0.55; cursor: default; }
#gauge-board {
  overflow: auto;
  padding: 8px 12px 16px;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 12px;
}
.meter-group {
  background: #fff;
  border: 1px solid #e4d9c8;
  border-radius: 16px;
  padding: 12px 14px 14px;
}
.meter-group.open { flex: 1 1 100%; }
.meter-group:not(.open) .meter:not(.bad) { display: none; }
.meter-group:not(.open) .meter-group-note { display: none; }
.meter-group:not(.open) .meter-row:not(:has(.meter.bad)) { display: none; }
.meter-head {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6d7f95;
}
.meter.bad { border-color: #8a3412; }
.meter-group-note { margin: 0 0 6px; font-size: 12px; color: #3e5168; }
.meter-row { display: flex; flex-wrap: wrap; gap: 10px; }
.meter {
  width: 148px;
  background: #fff;
  border: 1px solid #e4d9c8;
  border-radius: 16px;
  padding: 8px 10px 10px;
  box-sizing: border-box;
}
.meter.failed { border-color: #8a3412; background: #f6e4dc; }
.meter-dial { width: 100%; height: 78px; display: block; }
.meter-track { fill: none; stroke: #e4d9c8; stroke-width: 8; stroke-linecap: round; }
.meter-fill { fill: none; stroke: #1a4a78; stroke-width: 8; stroke-linecap: round; }
.meter.failed .meter-fill, .meter.failed .meter-stem-fill, .meter.failed .meter-bar-fill { stroke: #8a3412; background: #8a3412; }
.meter-needle { stroke: #1a3654; stroke-width: 2; }
.meter-hub { fill: #1a3654; }
.meter-value {
  margin: -18px 0 0;
  text-align: center;
  font-family: Georgia, "Iowan Old Style", serif;
  font-size: 22px;
  letter-spacing: -0.03em;
}
.meter.valve .meter-value,
.meter.composition .meter-value { margin-top: 2px; }
.meter-unit, .meter-scale, .meter-name {
  margin: 0;
  text-align: center;
  font-size: 11px;
  color: #3e5168;
  line-height: 1.3;
}
.meter-name { margin-top: 4px; font-weight: 650; color: #1a3654; min-height: 2.6em; }
.meter-stem {
  height: 72px;
  width: 18px;
  margin: 6px auto 8px;
  border-radius: 9px;
  background: #e7eef5;
  position: relative;
  overflow: hidden;
}
.meter-stem-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: #1a4a78;
}
.meter.composition { width: 168px; }
.meter-bar {
  height: 10px;
  margin: 10px 0 8px;
  border-radius: 6px;
  background: #e7eef5;
  overflow: hidden;
}
.meter-bar-fill { height: 100%; background: #1a4a78; width: 0; }
.finder {
  position: absolute;
  top: 62px;
  right: 16px;
  width: min(340px, calc(100vw - 360px));
  max-height: min(46vh, 420px);
  overflow: auto;
  padding: 12px 12px 10px;
  z-index: 4;
}
.finder-label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.12em;
  font-weight: 700;
  color: #6d7f95;
}
#job-search {
  width: 100%;
  box-sizing: border-box;
  margin-top: 6px;
  border: 0;
  border-radius: 8px;
  background: #f4efe4;
  color: #1a3654;
  padding: 8px 10px;
  font: inherit;
  font-size: 14px;
}
.finder-empty { margin: 8px 0 0; color: #3e5168; font-size: 13px; }
.find-card { margin-top: 8px; }
.find-job, .find-place, .find-check {
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 8px;
  background: #efe8dc;
  color: #1a3654;
  font: inherit;
  cursor: pointer;
}
.find-job { padding: 7px 8px; font-weight: 700; font-size: 13px; }
.find-job.bad { color: #8a3412; }
.find-person {
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 8px;
  background: #1a3654;
  color: #f7f5f1;
  font: inherit;
  font-weight: 700;
  font-size: 13px;
  line-height: 1.35;
  padding: 8px 10px;
  cursor: pointer;
  margin-top: 4px;
}
.find-person.bad { background: #6e2418; }
.crew-grid:has(> .crew-card:only-child) { grid-template-columns: 1fr; }
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin: 8px 0 4px;
}
.kpi {
  background: #eef2f5;
  border-radius: 8px;
  padding: 8px;
}
.kpi.bad { background: #f6e4dc; }
.kpi.bad .kpi-label, .kpi.bad .kpi-note, .kpi.bad .kpi-value { color: #8a3412; }
.time-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 6px 2px;
  border-bottom: 1px solid #e4e9ee;
  font-size: 14px;
}
.time-row.current { font-weight: 700; }
.idle-time, .idle-time span { color: #8a3412; font-weight: 700; }
.kpi-label {
  font-size: 10px;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: #5c6b7a;
}
.kpi-value { font-size: 18px; font-weight: 700; color: #14283c; line-height: 1.2; }
.kpi.bad .kpi-value { color: #8a3412; }
.trend-chart { width: min(100%, 840px); height: auto; display: block; background: #f7f3ea; border-radius: 12px; }
.trend-read { margin: 8px 0 0; font-size: 14px; color: #14283c; }
.issue-row {
  display: flex;
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 8px;
  background: #f7f3ea;
  color: #14283c;
  font: inherit;
  font-size: 14px;
  padding: 8px 10px;
  margin-bottom: 6px;
  cursor: pointer;
}
.issue-row.on { background: #1a3654; color: #f7f5f1; }
.issue-row.bad { box-shadow: inset 3px 0 0 #8a3412; }
.find-where { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.find-place { padding: 6px 8px; font-size: 12px; background: #f4efe4; }
.find-checks { margin-top: 6px; }
.find-part {
  margin: 8px 0 4px;
  font-size: 10px;
  letter-spacing: 0.12em;
  font-weight: 700;
  color: #6d7f95;
}
.find-check { display: block; margin-bottom: 4px; padding: 6px 8px; }
.find-check.on { background: #1a4a78; color: #f7f5f1; }
.find-check-title { font-size: 12px; font-weight: 700; }
.find-params { margin-top: 4px; font-size: 12px; font-weight: 500; line-height: 1.35; }
.find-check.on .find-params { color: #f7f5f1; }
.find-params .bad { color: #8a3412; font-weight: 700; }
.find-check.on .find-params .bad { color: #ffd0c2; }
.top-right {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 8px;
}
.pill, .dock button, .tools button, .x {
  border: 0;
  background: #f6f1e8;
  color: #1a3654;
  border-radius: 999px;
  padding: 10px 14px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.pill.btn { font-weight: 700; }
.hint {
  position: absolute;
  left: 16px;
  bottom: 18px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  background: rgba(18, 36, 58, 0.72);
  color: #f4f7fb;
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 12px;
}
.hint kbd {
  font-family: inherit;
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 6px;
  padding: 1px 5px;
  margin-right: 4px;
}
.dock {
  position: absolute;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  max-width: calc(100vw - 24px);
  background: rgba(247, 243, 234, 0.94);
  border-radius: 999px;
  padding: 6px;
}
.dock button.on { background: #1a4a78; color: #f7f5f1; }
.tour {
  position: absolute;
  left: 50%;
  bottom: 78px;
  transform: translateX(-50%);
  width: min(720px, calc(100vw - 32px));
  padding: 14px 16px 12px;
}
.tour h2 {
  margin: 4px 0 6px;
  font-family: Georgia, "Iowan Old Style", serif;
  font-weight: 500;
  font-size: 24px;
  letter-spacing: -0.03em;
}
.tour p { margin: 0; color: #3e5168; font-size: 14px; line-height: 1.4; }
#tour-board { margin-top: 6px; color: #1a3654; font-weight: 600; }
.tour.alert p { color: #8a3412; font-weight: 600; }
.tour-steps {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin-top: 10px;
  padding-bottom: 2px;
}
.tour-steps button {
  flex: 0 0 auto;
  border: 0;
  background: #efe8dc;
  color: #1a3654;
  border-radius: 999px;
  padding: 7px 10px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.tour-steps button.part-inner { background: #e3f0e6; }
.tour-steps button.part-outer { background: #e4eef8; }
.tour-steps button.done { background: #d7ead9; }
.tour-steps button.on { background: #1a4a78; color: #f7f5f1; }
.tools {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 42vh;
  overflow: auto;
  background: transparent;
  box-shadow: none;
}
.tools button {
  text-align: left;
  border-radius: 12px;
  padding: 7px 10px;
  font-size: 12px;
  box-shadow: 0 6px 16px rgba(22, 48, 84, 0.12);
}
.tool-dock {
  position: absolute;
  right: 16px;
  bottom: 18px;
  z-index: 6;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  width: min(260px, calc(100vw - 32px));
}
.tool-project {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: #6d7f95;
}
.tool-project select {
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  color: #1a3654;
  background: #f7f3ea;
  border: 0;
  border-radius: 10px;
  padding: 6px 8px;
}
.hmi {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.7fr);
  grid-template-rows: auto auto auto minmax(0, 1fr);
  overflow: hidden;
  background: #d5dde3;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  color: #14283c;
  pointer-events: auto;
}
.hmi[hidden] { display: none; }
.hmi.track { grid-template-columns: 1fr; }
#board-hmi, #job-hmi, #tug-hmi { grid-template-rows: auto auto minmax(0, 1fr); }
#op-hmi { grid-template-rows: auto auto auto minmax(0, 1fr); }
.track-body { overflow: auto; padding: 4px 16px 28px; }
.track-search {
  margin: 10px 16px 0;
  border: 0;
  border-radius: 8px;
  background: #f7f3ea;
  color: #14283c;
  padding: 10px 12px;
  font: inherit;
  font-size: 15px;
}
.track-picks { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
.track-pick, .cycle-open {
  border: 0;
  border-radius: 8px;
  background: #f7f3ea;
  color: #14283c;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.track-pick { padding: 8px 12px; font-weight: 700; }
.track-pick.on, .cycle-stop.here .cycle-open { background: #1a3654; color: #f7f5f1; }
.track-kicker {
  margin: 14px 0 6px;
  font-size: 11px;
  letter-spacing: 0.14em;
  font-weight: 700;
  color: #5c6b7a;
}
.track-now-row, .cycle-stop {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.track-now-copy { flex: 1; font-size: 15px; padding-top: 6px; }
.cycle-open { flex: 1; padding: 8px 10px; font-size: 14px; }
.cycle-open:disabled { cursor: default; opacity: 0.55; }
.cycle-stop.done .cycle-open { background: #e5f2ea; }
.cycle-miss { flex: 1 0 100%; margin: 0 0 4px 8px; color: #8a3412; font-size: 13px; font-weight: 650; }
.safety-miss { margin: 2px 0 0; color: #8a3412; font-size: 13px; font-weight: 650; }
.safety-note {
  width: 100%;
  margin-top: 8px;
  border: 1px solid #e4d9c8;
  border-radius: 8px;
  padding: 8px;
  font: 14px/1.4 "Segoe UI", sans-serif;
  box-sizing: border-box;
}
.track-empty, .crew-summary, .crew-tools, .crew-id { margin: 0 0 6px; font-size: 13px; color: #3e5168; }
.crew-summary { color: #14283c; font-size: 14px; }
.crew-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.crew-card {
  background: #f7f3ea;
  border-radius: 12px;
  padding: 12px 14px 8px;
}
.crew-card.bad { box-shadow: inset 0 0 0 2px #8a3412; }
.crew-name { margin: 0; font-size: 18px; }
.roster { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.roster-head, .roster-row {
  display: grid;
  grid-template-columns: 108px minmax(140px, 1.1fr) minmax(180px, 1.6fr) 120px minmax(140px, 1fr) auto;
  gap: 10px;
  align-items: center;
}
.roster-head { padding: 0 12px; font-size: 10px; letter-spacing: 0.08em; font-weight: 700; color: #5c6b7a; }
.roster-row {
  background: #f7f3ea;
  border-radius: 12px;
  padding: 10px 12px;
}
.roster-strong { font-size: 14px; font-weight: 700; color: #14283c; }
.roster-span { grid-column: 1 / -1; }
.status-pill {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}
.status-active { background: #1e8c45; color: #f7f5f1; }
.status-available { background: #1a4a78; color: #f7f5f1; }
.status-blocked { background: #a37b12; color: #fffaf3; }
.status-away { background: #5c6b7a; color: #f7f5f1; }
.crew-id { letter-spacing: 0.08em; font-size: 11px; font-weight: 700; }
.hmi-bar,
.hmi-alarm,
.hmi-note { grid-column: 1 / -1; }
.hmi-bar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #1a3654;
  color: #f4f7fb;
}
.hmi-id { flex: 1; min-width: 0; }
.hmi-tag {
  font-size: 11px;
  letter-spacing: 0.14em;
  font-weight: 700;
  color: #9eb4cc;
}
.hmi-title {
  margin: 0;
  font-size: 26px;
  font-weight: 650;
  letter-spacing: 0;
  line-height: 1.2;
}
.hmi-status {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  min-width: 92px;
  padding: 6px 8px;
  background: #24384c;
  border: 1px solid #0e1c2b;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.hmi-status .lamp { background: #8aa0b5; box-shadow: none; }
.hmi-status[data-state="alarm"] { background: #6e2418; color: #fff4ef; }
.hmi-status[data-state="alarm"] .lamp { background: #ff5a3c; }
.hmi-alarm {
  padding: 7px 12px;
  background: #8a3412;
  color: #fff7f2;
  font-size: 13px;
  font-weight: 700;
}
.hmi-note {
  margin: 0;
  padding: 8px 12px 0;
  color: #3e5168;
  font-size: 12px;
  line-height: 1.35;
}
.hmi-section {
  margin: 12px 12px 6px;
  font-size: 11px;
  letter-spacing: 0.14em;
  font-weight: 700;
  color: #4d6278;
}
.hmi-support, .hmi-empty {
  margin: 0 12px;
  color: #3e5168;
  font-size: 12px;
}
.hmi-checks { margin: 0 8px; }
.hmi-check {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 3px;
  padding: 5px 8px;
  background: #eef2f5;
  border: 1px solid #b7c3ce;
}
.hmi-check.now { border-color: #1a3654; background: #f7f5f1; }
.hmi-check.bad { background: #f8ebe4; border-color: #8a3412; }
.hmi-check-name { font-size: 13px; }
.hmi-check-mark { font-size: 13px; font-weight: 700; }
.lamp {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #8aa0b5;
  box-shadow: inset 0 -1px 1px rgba(0, 0, 0, 0.25);
}
.hmi-check.now .lamp { background: #1a4a78; }
.hmi-check.bad .lamp, .hmi-pv.bad .lamp { background: #d6452c; }
.hmi-pv.logged .lamp { background: #d6a21c; }
#plaque-bim,
#plaque-ops {
  min-height: 0;
  overflow: auto;
  padding-bottom: 16px;
}
#plaque-bim { grid-column: 1 / -1; }
.hmi:has(#plaque-ops:not(:empty)) #plaque-bim { grid-column: 1; }
#plaque-ops:empty { display: none; }
#plaque-ops:not(:empty) {
  grid-column: 2;
  border-left: 1px solid #b7c3ce;
  background: #e7edf1;
}
.hmi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 8px;
  margin: 0 12px;
}
.hmi-pv {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: 7px 8px 6px;
  background: #e7edf1;
  border: 1px solid #9aabba;
}
.hmi-pv.bad { border-color: #8a3412; background: #f6e4dc; }
.hmi-pv-name {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.25;
}
.hmi-pv-value {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #0e1c2b;
  background: #101820;
  color: #f0c14a;
  font-family: "Segoe UI", sans-serif;
  font-size: 28px;
  font-variant-numeric: tabular-nums;
  padding: 8px 10px;
}
.hmi-pv.bad .hmi-pv-value { color: #ffb4a2; }
.hmi-pv-value::placeholder { color: #5c6b7a; }
.hmi-pv-foot {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  min-height: 14px;
  font-size: 11px;
  color: #4d6278;
  font-weight: 700;
  line-height: 1.3;
}
.hmi-pv-note {
  font-size: 11px;
  line-height: 1.3;
  color: #8a3412;
  font-weight: 650;
}
.hmi-keys {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 8px 8px;
}
.hmi-key {
  border: 1px solid #1a3654;
  border-bottom-width: 3px;
  border-radius: 2px;
  background: #e7edf1;
  color: #14283c;
  padding: 8px 10px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.hmi-key.on { background: #1a3654; color: #f4f7fb; }
.hmi-bar .hmi-key { background: #e7edf1; color: #14283c; padding: 6px 10px; }
.hmi-form { margin: 0 8px 10px; }
.hmi-form textarea, .hmi-form input[type="text"] {
  width: 100%;
  box-sizing: border-box;
  margin-top: 4px;
  border: 1px solid #1a3654;
  border-radius: 2px;
  background: #f4f7fb;
  color: #14283c;
  padding: 7px 8px;
  font: inherit;
  font-size: 13px;
}
.hmi .op-list {
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
}
.hmi .op-list li {
  font-size: 13px;
  padding: 5px 8px;
  margin-bottom: 3px;
  background: #eef2f5;
  border: 1px solid #b7c3ce;
  cursor: pointer;
}
.hmi .op-list li.now { border-color: #1a3654; background: #f7f5f1; }
.hmi .op-list li.bad { color: #8a3412; font-weight: 650; }
.tug-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
  margin: 8px 0 14px;
}
.tug-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: #5c6b7a;
}
.tug-form select {
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
  color: #14283c;
  background: #f7f3ea;
  border: 0;
  border-radius: 8px;
  padding: 8px 10px;
  min-width: 200px;
}
.tug-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  background: #f7f3ea;
  border-radius: 8px;
  padding: 8px 10px;
}
.tug-row span { flex: 1; }
.tug-bump, .tug-add {
  border: 0;
  border-radius: 8px;
  background: #1a3654;
  color: #f7f5f1;
  font: inherit;
  font-weight: 700;
  padding: 8px 12px;
  cursor: pointer;
}
.tug-drop {
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #5c6b7a;
  font: inherit;
  font-weight: 700;
  padding: 8px 10px;
  cursor: pointer;
}
.error {
  position: absolute;
  left: 16px;
  bottom: 72px;
  padding: 12px 14px;
  color: #8f1d1d;
  max-width: 420px;
}
@media (max-width: 800px) {
  .tools { display: none; }
  .quest h1 { font-size: 22px; }
  .tour { width: calc(100vw - 32px); transform: translateX(-50%); }
  .hmi { grid-template-columns: 1fr; grid-template-rows: auto auto auto minmax(0, 1fr) auto; }
  #plaque-bim, #plaque-ops:not(:empty) { grid-column: 1; border-left: 0; }
}
