/* ControlPilot Flagship Warm-Porcelain Glass Industrial Engineering Station (Zero CDN) */
:root {
  --bg-paper: #F4F2EC;
  --bg-glass: rgba(255, 255, 255, 0.78);
  --bg-glass-strong: rgba(255, 255, 255, 0.88);
  --bg-card: #FFFFFF;
  --bg-subtle: rgba(251, 250, 247, 0.76);
  --bg-note: rgba(255, 252, 240, 0.90);
  --border: rgba(214, 210, 200, 0.72);
  --border-glass: rgba(255, 255, 255, 0.85);
  --border-strong: rgba(188, 183, 172, 0.85);
  --ink-primary: #18181B;
  --ink-secondary: #4B505A;
  --ink-muted: #71717A;
  --cobalt: #1D4ED8;
  --cobalt-soft: rgba(239, 246, 255, 0.85);
  --cobalt-border: rgba(147, 197, 253, 0.85);
  --emerald: #059669;
  --emerald-soft: rgba(236, 253, 245, 0.86);
  --emerald-border: rgba(110, 231, 183, 0.85);
  --amber: #D97706;
  --amber-soft: rgba(255, 251, 235, 0.88);
  --amber-border: rgba(252, 211, 77, 0.88);
  --crimson: #DC2626;
  --crimson-soft: rgba(254, 242, 242, 0.88);
  --crimson-border: rgba(252, 165, 165, 0.85);
  --font-sans: "HarmonyOS Sans SC", "MiSans", "PingFang SC", "Microsoft YaHei UI", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
  --font-display: "HarmonyOS Sans SC", "MiSans", "PingFang SC", "Segoe UI Variable Display", "Microsoft YaHei UI", system-ui, "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Mono", "Cascadia Code", "SF Mono", "Consolas", ui-monospace, monospace;
  --ease-spring: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-snappy: cubic-bezier(0.34, 1.45, 0.64, 1);
  --shadow-glass: 0 8px 28px rgba(24, 24, 27, 0.055), 0 1px 2px rgba(24, 24, 27, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.94);
  --shadow-glass-hover: 0 14px 36px rgba(29, 78, 216, 0.085), 0 2px 6px rgba(24, 24, 27, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.98);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-paper);
  color: var(--ink-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.58;
  letter-spacing: -0.005em;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.mono, .num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(168, 162, 158, 0.5); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(120, 113, 108, 0.78); }

/* ── Living Atmospheric Warm Glass Backdrop ── */
.ambient-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background: radial-gradient(circle at 12% 8%, #FBF8F1 0%, #F4F2EC 48%, #ECEAE3 100%);
}

.ambient-grid {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(24, 24, 27, 0.055) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0.15) 75%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0.15) 75%, transparent 100%);
}

.ambient-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(74px);
  opacity: 0.48;
  will-change: transform;
}

.orb-cobalt {
  width: 520px;
  height: 520px;
  top: -150px;
  left: 14%;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.34) 0%, rgba(59, 130, 246, 0) 70%);
  animation: orbFloatA 22s ease-in-out infinite alternate;
}

.orb-amber {
  width: 480px;
  height: 480px;
  top: 120px;
  right: -90px;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.30) 0%, rgba(245, 158, 11, 0) 70%);
  animation: orbFloatB 26s ease-in-out infinite alternate;
}

.orb-emerald {
  width: 460px;
  height: 460px;
  bottom: -140px;
  left: 34%;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.25) 0%, rgba(16, 185, 129, 0) 70%);
  animation: orbFloatC 28s ease-in-out infinite alternate;
}

@keyframes orbFloatA {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  100% { transform: translate3d(64px, 38px, 0) scale(1.08); }
}
@keyframes orbFloatB {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  100% { transform: translate3d(-58px, 46px, 0) scale(1.1); }
}
@keyframes orbFloatC {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  100% { transform: translate3d(48px, -42px, 0) scale(1.06); }
}

/* Keep interactive layers cleanly above backdrop */
.topbar, .crew-strip, .workspace {
  position: relative;
  z-index: 2;
}

/* ── 1. Frosted Glass Top Bar (52px single-line desktop header) ── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  min-height: 62px;
  background: rgba(255, 255, 255, 0.80);
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  border-bottom: 1px solid rgba(214, 210, 200, 0.72);
  box-shadow: 0 4px 20px rgba(24, 24, 27, 0.045), inset 0 -1px 0 rgba(255, 255, 255, 0.75);
  padding: 9px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: nowrap;
}

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

.brand-seal {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(145deg, #27272A 0%, #09090B 100%);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: -0.04em;
  box-shadow: 0 4px 12px rgba(24, 24, 27, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.brand-pulse {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10B981;
  border: 1.5px solid #FFFFFF;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.55);
  animation: liveBeacon 2.4s ease-out infinite;
}

@keyframes liveBeacon {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6); }
  70% { box-shadow: 0 0 0 7px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.brand-stack {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.brand-name {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink-primary);
  white-space: nowrap;
}
.brand-sub {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink-secondary);
  margin-top: 2px;
  white-space: nowrap;
}
.brand-name span {
  background: linear-gradient(135deg, #1D4ED8 0%, #0284C7 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.case-idx {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  opacity: 0.55;
  margin-right: 1px;
}
.btn-play-icon {
  font-size: 10px;
  line-height: 1;
}
.btn-group-export {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

/* ── Hardware-Accelerated Sliding Glass Pill Tracks ── */
.seg-track {
  position: relative;
  display: inline-flex;
  align-items: center;
  background: rgba(235, 232, 224, 0.72);
  border: 1px solid rgba(208, 204, 194, 0.78);
  box-shadow: inset 0 1px 2px rgba(24, 24, 27, 0.06);
  padding: 3px;
  gap: 2px;
}

.seg-thumb {
  position: absolute;
  top: 3px;
  left: 0;
  height: calc(100% - 6px);
  border-radius: 7px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(250, 250, 249, 0.90) 100%);
  border: 1px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 2px 10px rgba(24, 24, 27, 0.09), 0 1px 2px rgba(24, 24, 27, 0.06);
  pointer-events: none;
  z-index: 0;
  transform: translate3d(0, 0, 0);
  width: 0;
  opacity: 0;
  transition:
    transform 340ms var(--ease-spring),
    width 340ms var(--ease-spring),
    opacity 180ms ease;
}
.seg-thumb.ready { opacity: 1; }

.scenario-seg {
  border-radius: 10px;
}

.seg-case {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: none;
  background: transparent;
  color: var(--ink-secondary);
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 200ms var(--ease-spring), transform 140ms var(--ease-spring);
}
.seg-case:hover { color: var(--ink-primary); }
.seg-case:active { transform: scale(0.98); }
.seg-case.active {
  color: var(--ink-primary);
  font-weight: 700;
}

.case-dot {
  width: 6.5px;
  height: 6.5px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: transform 240ms var(--ease-snappy), box-shadow 240ms ease;
}
.dot-cobalt { background: var(--cobalt); }
.dot-amber { background: var(--amber); }
.dot-emerald { background: var(--emerald); }
.seg-case.active .case-dot { transform: scale(1.22); }
.seg-case.active .dot-cobalt { box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.18); }
.seg-case.active .dot-amber { box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.22); }
.seg-case.active .dot-emerald { box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.20); }

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

.utility-rail {
  position: relative;
  z-index: 30;
  background: rgba(248, 246, 241, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(214, 210, 200, 0.62);
}
.utility-inner {
  max-width: 1680px;
  margin: 0 auto;
  padding: 6px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.utility-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.utility-lbl {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-secondary);
  white-space: nowrap;
}

.loop-select {
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink-primary);
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  padding: 5px 9px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  width: 210px;
  max-width: 210px;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95);
  transition: border-color 180ms ease, box-shadow 180ms ease;
}
.loop-select:focus {
  border-color: var(--cobalt);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.14);
}

.btn {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 11px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.90);
  color: var(--ink-primary);
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(24, 24, 27, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.95);
  transition:
    transform 160ms var(--ease-spring),
    border-color 180ms ease,
    background-color 180ms ease,
    box-shadow 180ms ease,
    color 180ms ease;
}
.btn-lg {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  padding: 8px 15px;
  border-radius: 9px;
}
.btn-sm {
  font-size: 13px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 7px;
}
.btn:hover {
  border-color: var(--cobalt);
  background: rgba(239, 246, 255, 0.92);
  color: var(--cobalt);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(29, 78, 216, 0.12);
}
.btn:active { transform: translateY(0) scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%);
  border-color: #1D4ED8;
  color: #FFFFFF;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(29, 78, 216, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.26);
}
.btn-primary::after {
  content: "";
  position: absolute;
  top: 0;
  left: -120%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.34), transparent);
  transform: skewX(-22deg);
  transition: left 520ms var(--ease-spring);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #1D4ED8 0%, #1E40AF 100%);
  border-color: #1E40AF;
  color: #FFFFFF;
  box-shadow: 0 6px 18px rgba(29, 78, 216, 0.36);
}
.btn-primary:hover::after { left: 140%; }

.btn-ghost {
  background: rgba(244, 242, 236, 0.72);
  border-color: var(--border);
  color: var(--ink-secondary);
}

/* ── 2. Crew Sequential Relay Strip (Frosted Glass Rail) ── */
.crew-strip {
  max-width: 1680px;
  margin: 8px auto 0 auto;
  padding: 0 20px;
}

.crew-bar {
  background: var(--bg-glass);
  backdrop-filter: blur(18px) saturate(165%);
  -webkit-backdrop-filter: blur(18px) saturate(165%);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-glass);
  padding: 8px 16px 7px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.crew-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.crew-bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 6px;
  border-top: 1px dashed rgba(208, 204, 194, 0.72);
}

.step-num {
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 800;
  color: var(--cobalt);
  background: rgba(29, 78, 216, 0.09);
  padding: 0.5px 4px;
  border-radius: 4px;
  margin-right: 4px;
}

.kbd-hints {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  font-size: 11px;
  color: var(--ink-muted);
  white-space: nowrap;
}
.kbd-hints kbd {
  display: inline-block;
  padding: 1px 5px;
  margin: 0 1px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--ink-secondary);
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(188, 183, 172, 0.85);
  border-radius: 4px;
  box-shadow: 0 1px 0 rgba(24, 24, 27, 0.08);
}

.crew-relay {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding: 2px 0;
}

.crew-member {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 14px 5px 6px;
  border-radius: 999px;
  border: 1px solid rgba(214, 210, 200, 0.78);
  background: rgba(255, 255, 255, 0.78);
  transition:
    transform 240ms var(--ease-spring),
    border-color 220ms ease,
    background-color 220ms ease,
    box-shadow 220ms ease;
  flex-shrink: 0;
}
.crew-member:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(24, 24, 27, 0.06);
}

.crew-member.state-running {
  border-color: rgba(37, 99, 235, 0.8);
  background: linear-gradient(135deg, rgba(239, 246, 255, 0.96) 0%, rgba(219, 234, 254, 0.85) 100%);
  box-shadow: 0 4px 16px rgba(29, 78, 216, 0.18);
  transform: translateY(-1px);
}
.crew-member.state-ok {
  border-color: var(--emerald-border);
  background: linear-gradient(135deg, rgba(236, 253, 245, 0.94) 0%, rgba(255, 255, 255, 0.88) 100%);
}
.crew-member.state-ok::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 25%, rgba(255, 255, 255, 0.65) 50%, transparent 75%);
  transform: translateX(-120%);
  animation: sheenSweep 900ms var(--ease-spring) 1;
  pointer-events: none;
}
.crew-member.state-amber {
  border-color: var(--amber-border);
  background: linear-gradient(135deg, rgba(255, 251, 235, 0.95) 0%, rgba(255, 255, 255, 0.88) 100%);
}
.crew-member.state-red {
  border-color: var(--crimson-border);
  background: linear-gradient(135deg, rgba(254, 242, 242, 0.95) 0%, rgba(255, 255, 255, 0.88) 100%);
}
.crew-member.state-skipped {
  opacity: 0.56;
  filter: grayscale(0.75);
  border-style: dashed;
  border-color: rgba(188, 183, 172, 0.85);
  background: rgba(244, 242, 236, 0.65);
}
.crew-member.state-skipped .step-num {
  background: rgba(113, 113, 122, 0.14);
  color: #71717A;
}
.crew-member.state-skipped .crew-name,
.crew-member.state-skipped .crew-role {
  color: #71717A;
}

@keyframes sheenSweep {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(130%); }
}

.avatar-slot {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow: hidden;
  border: 2.5px solid var(--border-strong);
  background: #F4F2EC;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: border-color 220ms ease, box-shadow 220ms ease, transform 240ms var(--ease-snappy);
}

.crew-member.state-running .avatar-slot {
  border-color: var(--cobalt);
  animation: radarPulse 1.5s cubic-bezier(0.22, 1, 0.36, 1) infinite;
}
.crew-member.state-ok .avatar-slot {
  border-color: var(--emerald);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.16);
}
.crew-member.state-amber .avatar-slot {
  border-color: var(--amber);
  box-shadow: 0 0 0 2px rgba(217, 119, 6, 0.18);
}
.crew-member.state-red .avatar-slot {
  border-color: var(--crimson);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.22);
}

@keyframes radarPulse {
  0% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.45); }
  70% { box-shadow: 0 0 0 9px rgba(37, 99, 235, 0); }
  100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

.avatar-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}
.avatar-slot svg {
  width: 34px;
  height: 34px;
  display: block;
}

.crew-info {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}
.crew-name {
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 800;
  color: var(--ink-primary);
  white-space: nowrap;
}
.crew-role {
  font-size: 12.5px;
  color: var(--ink-secondary);
  white-space: nowrap;
}

/* Animated Signal Conduit between Crew Badges */
.crew-conduit {
  position: relative;
  width: 24px;
  height: 12px;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  --conduit-color: #C7C3BA;
}
.crew-conduit .conduit-line {
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--conduit-color);
  opacity: 0.45;
  transition: background-color 240ms ease, opacity 240ms ease;
}
.crew-conduit .conduit-head {
  width: 0;
  height: 0;
  border-top: 3.5px solid transparent;
  border-bottom: 3.5px solid transparent;
  border-left: 5px solid var(--conduit-color);
  opacity: 0.55;
  transition: border-left-color 240ms ease, opacity 240ms ease;
}
.crew-conduit .conduit-pulse {
  position: absolute;
  left: 0;
  top: 50%;
  width: 8px;
  height: 3px;
  border-radius: 99px;
  transform: translateY(-50%);
  opacity: 0;
  background: var(--conduit-color);
}
.crew-conduit.lit-ok { --conduit-color: var(--emerald); }
.crew-conduit.lit-amber { --conduit-color: var(--amber); }
.crew-conduit.lit-red { --conduit-color: var(--crimson); }
.crew-conduit.lit-ok .conduit-line,
.crew-conduit.lit-amber .conduit-line,
.crew-conduit.lit-red .conduit-line,
.crew-conduit.lit-ok .conduit-head,
.crew-conduit.lit-amber .conduit-head,
.crew-conduit.lit-red .conduit-head { opacity: 0.95; }

.crew-conduit.lit-ok .conduit-pulse,
.crew-conduit.lit-amber .conduit-pulse,
.crew-conduit.lit-red .conduit-pulse {
  opacity: 1;
  box-shadow: 0 0 6px var(--conduit-color);
  animation: conduitFlow 1.6s linear infinite;
}

@keyframes conduitFlow {
  0% { left: -2px; opacity: 0; }
  20% { opacity: 1; }
  80% { opacity: 1; }
  100% { left: 14px; opacity: 0; }
}

/* Crew Dialogue Feed */
.crew-dialogue {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-secondary);
  background: rgba(244, 242, 236, 0.78);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background-color 240ms ease, border-color 240ms ease, color 240ms ease;
}
.crew-dialogue.ok { background: var(--emerald-soft); border-color: var(--emerald-border); color: #065F46; }
.crew-dialogue.amber { background: var(--amber-soft); border-color: var(--amber-border); color: #92400E; }
.crew-dialogue.red { background: var(--crimson-soft); border-color: var(--crimson-border); color: #991B1B; }

/* Right Blackboard Token & Cache Telemetry */
.crew-telemetry {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.tok-meter {
  width: 128px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tok-head {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--ink-muted);
  font-family: var(--font-mono);
}
.tok-track {
  height: 6px;
  background: rgba(226, 223, 215, 0.85);
  border-radius: 99px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(24, 24, 27, 0.08);
}
.tok-fill {
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: linear-gradient(90deg, #10B981, #059669);
  transition: width 420ms var(--ease-spring), background 240ms ease;
}

.cache-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-secondary);
  border-left: 1px solid var(--border);
  padding-left: 10px;
  line-height: 1.3;
  white-space: nowrap;
}

/* ── 3. Main 1080p Golden Split Grid (58% Left | 42% Right) ── */
.workspace {
  max-width: 1680px;
  margin: 10px auto 22px auto;
  padding: 0 20px;
  display: grid;
  grid-template-columns: minmax(0, 1.36fr) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.col-left, .col-right {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

/* Sculpted Frosted Porcelain Glass Card with Iconic Editorial Accent Spine */
.card {
  position: relative;
  background: var(--bg-glass);
  backdrop-filter: blur(18px) saturate(165%);
  -webkit-backdrop-filter: blur(18px) saturate(165%);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-glass);
  overflow: hidden;
  transition: transform 240ms var(--ease-spring), box-shadow 260ms var(--ease-spring), border-color 220ms ease;
}
.col-left > .card:nth-child(1) { border-top: 3px solid var(--cobalt); }
.col-left > .card:nth-child(2) { border-top: 3px solid var(--emerald); }
.col-right > .card:nth-child(1) { border-top: 3px solid var(--amber); }
.col-right > .card:nth-child(2) { border-top: 3px solid #334155; }
.card:hover {
  border-color: rgba(188, 183, 172, 0.94);
  box-shadow: var(--shadow-glass-hover);
}

.card-head {
  padding: 9px 15px;
  background: rgba(255, 255, 255, 0.62);
  border-bottom: 1px solid rgba(214, 210, 200, 0.65);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.head-title-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  border-left: 3px solid var(--cobalt);
  padding-left: 10px;
}
.col-left > .card:nth-child(2) .head-title-block { border-left-color: var(--emerald); }
.col-right > .card:nth-child(1) .head-title-block { border-left-color: var(--amber); }
.col-right > .card:nth-child(2) .head-title-block { border-left-color: #334155; }
.card-eyebrow {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--cobalt);
  text-transform: uppercase;
}
.col-left > .card:nth-child(2) .card-eyebrow { color: var(--emerald); }
.col-right > .card:nth-child(1) .card-eyebrow { color: #B45309; }
.col-right > .card:nth-child(2) .card-eyebrow { color: #334155; }
.card-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 800;
  color: var(--ink-primary);
  letter-spacing: -0.02em;
}
.card-kpi-pill {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-primary);
  background: rgba(244, 242, 236, 0.90);
  border: 1px solid rgba(208, 204, 194, 0.85);
  border-radius: 999px;
  padding: 4px 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.route-pill {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 4.5px 12px;
  border-radius: 999px;
  background: var(--emerald-soft);
  color: var(--emerald);
  border: 1.5px solid var(--emerald-border);
  white-space: nowrap;
}
.route-pill.amber {
  background: var(--amber-soft);
  color: #B45309;
  border-color: var(--amber-border);
}
.route-pill.red {
  background: var(--crimson-soft);
  color: var(--crimson);
  border-color: var(--crimson-border);
}

.card-kpi-inline {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink-secondary);
  font-variant-numeric: tabular-nums;
}

.card-body {
  padding: 10px 15px;
}

/* Sub-segmented switches inside cards (also powered by sliding .seg-thumb!) */
.seg-mini {
  border-radius: 8px;
  padding: 2.5px;
}
.seg-mini .seg-thumb {
  top: 2.5px;
  height: calc(100% - 5px);
  border-radius: 5.5px;
}
.seg-mini button {
  position: relative;
  z-index: 1;
  border: none;
  background: transparent;
  color: var(--ink-secondary);
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 600;
  padding: 4.5px 11px;
  border-radius: 5.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 180ms ease;
}
.seg-mini button:hover { color: var(--ink-primary); }
.seg-mini button.active {
  color: var(--cobalt);
  font-weight: 700;
}

.chart-subbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 13px;
  flex-wrap: wrap;
  font-size: 13px;
  font-weight: 500;
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-secondary);
  cursor: pointer;
  user-select: none;
  transition: opacity 160ms ease, transform 160ms ease;
}
.legend-item:hover { color: var(--ink-primary); transform: translateY(-0.5px); }
.legend-item.muted { opacity: 0.35; text-decoration: line-through; }
.swatch {
  width: 15px;
  height: 4px;
  border-radius: 2px;
  display: inline-block;
}

.canvas-wrap {
  position: relative;
  width: 100%;
  height: 214px;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(214, 210, 200, 0.85);
  box-shadow: inset 0 1px 3px rgba(24, 24, 27, 0.04);
}
.canvas-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
}

.canvas-tooltip {
  position: absolute;
  pointer-events: none;
  display: none;
  z-index: 15;
  background: rgba(15, 23, 42, 0.80);
  backdrop-filter: blur(12px) saturate(160%);
  -webkit-backdrop-filter: blur(12px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #F4F4F5;
  border-radius: 8px;
  padding: 7px 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  white-space: nowrap;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.28);
  transition: left 60ms linear, top 60ms linear;
}

/* ── Field Inspection Micro-Scene Guard Card (on EXIT_A / EXIT_B) ── */
.guard-scene {
  display: none;
  grid-template-columns: 235px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  background: linear-gradient(135deg, rgba(255, 251, 235, 0.92) 0%, rgba(255, 247, 214, 0.78) 100%);
  border: 1px solid var(--amber-border);
  border-radius: 9px;
  padding: 13px 15px;
  min-height: 274px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
.guard-scene.visible {
  display: grid;
  animation: paneSlideIn 340ms var(--ease-spring);
}

.scene-img-slot {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(243, 213, 141, 0.9);
  background: #FFFDF6;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(180, 83, 9, 0.10);
}
.scene-img-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}
.scene-img-slot svg {
  width: 100%;
  height: 100%;
  display: block;
}

.guard-title {
  font-size: 14px;
  font-weight: 700;
  color: #92400E;
  margin-bottom: 5px;
}
.guard-quote {
  font-size: 12.5px;
  color: #78350F;
  margin-bottom: 8px;
}
.guard-steps {
  margin: 0 0 0 18px;
  padding: 0;
  font-size: 12px;
  color: var(--ink-primary);
}
.guard-steps li { margin-bottom: 4px; }

/* ── 4. Right Column: Vellum Sticky Note + Spotlight Hero Decision Card ── */
.sticky-note {
  position: relative;
  background: var(--bg-note);
  border: 1px solid rgba(235, 220, 178, 0.92);
  border-left: 3.5px solid var(--amber);
  border-radius: 8px;
  padding: 9px 13px;
  margin-bottom: 11px;
  box-shadow: 0 4px 14px rgba(180, 83, 9, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.95);
  overflow: hidden;
}
.sticky-note::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 18px;
  height: 18px;
  background: linear-gradient(225deg, rgba(244, 242, 236, 0.92) 50%, rgba(239, 224, 184, 0.92) 50%);
  border-bottom-left-radius: 4px;
  pointer-events: none;
}
.sticky-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: #92400E;
  font-weight: 700;
  margin-bottom: 5px;
  padding-right: 16px;
}
.sticky-text {
  font-size: 14.5px;
  color: var(--ink-primary);
  line-height: 1.58;
}
.kw-hl {
  background: linear-gradient(180deg, rgba(254, 243, 199, 0.4) 30%, rgba(253, 224, 71, 0.55) 100%);
  color: #92400E;
  padding: 0 5px;
  border-radius: 4px;
  font-weight: 700;
}
.sticky-causal {
  margin-top: 6px;
  font-size: 13px;
  color: var(--ink-secondary);
}

/* Spotlight-enabled Hero PID Decision Strip */
.hero-decision {
  position: relative;
  border-top: 1px solid rgba(214, 210, 200, 0.65);
  padding-top: 10px;
  --mx: 50%;
  --my: 50%;
}

.loop-identity {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}
.loop-tag-main {
  font-size: 19px;
  font-weight: 800;
  color: var(--ink-primary);
  font-family: var(--font-mono);
  letter-spacing: -0.025em;
}
.loop-tag-sub {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-secondary);
}

.pid-compare {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  background:
    radial-gradient(260px circle at var(--mx) var(--my), rgba(37, 99, 235, 0.09), transparent 65%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.88) 0%, rgba(244, 248, 255, 0.72) 100%);
  border: 1px solid rgba(188, 198, 218, 0.85);
  border-radius: 11px;
  padding: 12px 15px;
  margin-bottom: 11px;
  box-shadow: 0 3px 10px rgba(24, 24, 27, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.96);
  transition: border-color 220ms ease;
}
.pid-compare:hover { border-color: rgba(147, 197, 253, 0.95); }

.pid-col-label { font-size: 12.5px; color: var(--ink-muted); font-weight: 600; }
.pid-col-vals {
  font-family: var(--font-mono);
  font-size: 14.5px;
  font-weight: 800;
  color: var(--ink-primary);
  margin-top: 3px;
}
.pid-col-vals.ok { color: var(--emerald); }
.pid-col-vals.locked { color: var(--amber); }
.pid-arrow {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(29, 78, 216, 0.10);
  border: 1px solid rgba(29, 78, 216, 0.25);
  font-family: var(--font-mono);
  color: var(--cobalt);
  font-size: 15px;
  font-weight: 800;
  animation: arrowNudge 2.2s ease-in-out infinite;
}
@keyframes arrowNudge {
  0%, 100% { transform: translateX(0); opacity: 0.82; }
  50% { transform: translateX(3px); opacity: 1; }
}

/* Sculpted 3-Card Compact Economics Strip (OI / ΔTV / ΔIAE, <=54px above-the-fold) */
.econ-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  border: none;
  border-radius: 0;
  margin-bottom: 9px;
  overflow: visible;
  background: transparent;
}
.econ-cell {
  position: relative;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-top: 3px solid var(--emerald);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.90);
  box-shadow: 0 3px 10px rgba(24, 24, 27, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.96);
  transition: transform 200ms var(--ease-spring), box-shadow 200ms ease;
}
.econ-cell:nth-child(2) { border-top-color: var(--cobalt); }
.econ-cell:nth-child(3) { border-top-color: #0F766E; }
.econ-cell:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(24, 24, 27, 0.08);
}
.econ-cell:last-child { border-right: 1px solid var(--border); }
.econ-k { font-size: 11px; color: var(--ink-secondary); font-weight: 700; line-height: 1.2; }
.econ-v {
  font-family: var(--font-mono);
  font-size: 18.5px;
  font-weight: 800;
  color: var(--emerald);
  margin-top: 1px;
  line-height: 1.15;
  letter-spacing: -0.025em;
}
.econ-v.warn { color: var(--amber); font-size: 15.5px; }
.econ-s { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-muted); margin-top: 1px; line-height: 1.15; }

/* 3-Step DCS Bumpless Ramping Rail */
.ramp-box {
  background: rgba(251, 250, 247, 0.78);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 11px;
  margin-bottom: 10px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92);
}
.ramp-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-primary);
  margin-bottom: 8px;
}
.ramp-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}
.ramp-steps.single { grid-template-columns: 1fr; }
.ramp-step {
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--emerald-border);
  border-radius: 8px;
  padding: 7.5px 9.5px;
  font-family: var(--font-mono);
  font-size: 12px;
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.06);
  transition: transform 200ms var(--ease-spring), box-shadow 200ms ease;
  animation: rampStepIn 380ms var(--ease-spring) backwards;
}
.ramp-step:nth-child(2) { animation-delay: 85ms; }
.ramp-step:nth-child(3) { animation-delay: 170ms; }
.ramp-step:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(5, 150, 105, 0.14);
}
.ramp-step::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  height: 2.5px;
  width: var(--step-pct, 100%);
  background: linear-gradient(90deg, #10B981, #059669);
}
@keyframes rampStepIn {
  0% { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}

.ramp-step-title { font-weight: 700; color: var(--emerald); }
.ramp-step.warn-step { border-color: var(--amber-border); background: var(--amber-soft); }
.ramp-step.warn-step::before { background: linear-gradient(90deg, #F59E0B, #D97706); }
.ramp-step.warn-step .ramp-step-title { color: #B45309; }
.ramp-step-pid { color: var(--ink-primary); margin-top: 2px; }
.ramp-step-meta { color: var(--ink-muted); font-size: 11px; margin-top: 2px; }
.ramp-foot {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-secondary);
  line-height: 1.52;
}

/* Sign-off Footer & Spring Electronic Stamp */
.signoff-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--border-strong);
}
.signoff-note {
  font-size: 13.5px;
  color: var(--ink-secondary);
  flex: 1;
}
.stamp {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 800;
  padding: 7px 14px;
  border-radius: 7px;
  border: 2.5px solid var(--emerald);
  outline: 1px dashed rgba(5, 150, 105, 0.55);
  outline-offset: -4px;
  color: var(--emerald);
  background: var(--emerald-soft);
  letter-spacing: 0.05em;
  white-space: nowrap;
  transform: rotate(-2deg);
  box-shadow: 0 5px 14px rgba(5, 150, 105, 0.16);
}
.stamp.animate-drop {
  animation: stampDrop 420ms var(--ease-snappy);
}
@keyframes stampDrop {
  0% { opacity: 0; transform: scale(1.22) rotate(-7deg); }
  70% { opacity: 1; transform: scale(0.96) rotate(-1.5deg); }
  100% { opacity: 1; transform: scale(1) rotate(-2deg); }
}
.stamp.locked {
  border-color: var(--amber);
  color: #B45309;
  background: var(--amber-soft);
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.16);
}
.stamp.rejected {
  border-color: var(--crimson);
  color: var(--crimson);
  background: var(--crimson-soft);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.16);
}

/* ── 5. Audit 5x5 Matrix & Sliding Secondary Tabs ── */
.dcs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.dcs-table th {
  text-align: left;
  padding: 8px 8px;
  background: rgba(244, 242, 236, 0.85);
  color: var(--ink-secondary);
  font-weight: 700;
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}
.dcs-table td {
  padding: 7.5px 8px;
  border-bottom: 1px solid rgba(214, 210, 200, 0.55);
  vertical-align: middle;
  transition: background-color 140ms ease;
}
.dcs-table tbody tr:hover td { background: rgba(239, 246, 255, 0.45); }
.dcs-table tr:last-child td { border-bottom: none; }

.cell-pass { color: var(--emerald); font-family: var(--font-mono); font-weight: 700; font-size: 12.5px; white-space: nowrap; }
.cell-fail { color: var(--crimson); font-family: var(--font-mono); font-weight: 700; font-size: 12.5px; white-space: nowrap; }
.cell-val { display: block; font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-muted); font-weight: 400; white-space: nowrap; }
.td-fail { background: var(--crimson-soft); }

.tab-pane { display: none; }
.tab-pane.active {
  display: block;
  animation: paneSlideIn 280ms var(--ease-spring);
}

@keyframes paneSlideIn {
  0% { opacity: 0; transform: translateY(7px); }
  100% { opacity: 1; transform: translateY(0); }
}

.onto-kv {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-bottom: 9px;
}
.onto-item {
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 6.5px 9px;
}
.onto-k { font-size: 10.5px; color: var(--ink-muted); }
.onto-v { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-primary); margin-top: 2px; word-break: break-word; }
.c-green { color: var(--emerald) !important; font-weight: 600; }
.c-amber { color: var(--amber) !important; font-weight: 600; }
.c-red { color: var(--crimson) !important; font-weight: 600; }
.c-cobalt { color: var(--cobalt) !important; font-weight: 600; }

.kg-row {
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 5.5px 9px;
  font-size: 11.5px;
  color: var(--ink-secondary);
  margin-bottom: 5px;
}
.kg-id { font-family: var(--font-mono); color: var(--cobalt); font-weight: 600; margin-right: 6px; }

.bb-details {
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 6px 9px;
  background: rgba(255, 255, 255, 0.72);
}
.bb-details summary { cursor: pointer; font-size: 11.5px; font-weight: 600; color: var(--ink-secondary); }
.bb-pre {
  margin: 6px 0 2px 0;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-primary);
  max-height: 150px;
  overflow: auto;
  white-space: pre-wrap;
}

/* ── 6. Frosted Spring Modals ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.36);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 220ms ease, visibility 220ms ease;
}
.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

.modal-box {
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(24px) saturate(175%);
  -webkit-backdrop-filter: blur(24px) saturate(175%);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 14px;
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 26px 70px rgba(15, 23, 42, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.96);
  transform: scale(0.95) translateY(10px);
  transition: transform 280ms var(--ease-spring);
}
.modal-backdrop.open .modal-box {
  transform: scale(1) translateY(0);
}
.modal-box.wide { max-width: 1080px; }

.modal-head {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(255, 255, 255, 0.96);
  padding: 13px 18px;
  border-bottom: 1px solid rgba(214, 210, 200, 0.7);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-body { padding: 14px 18px 28px 18px; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.form-field { display: flex; flex-direction: column; gap: 4px; }
.form-field.full { grid-column: span 2; }
.form-field label { font-size: 12px; color: var(--ink-secondary); }
.form-field input, .form-field select, .form-field textarea {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--border-strong);
  color: var(--ink-primary);
  border-radius: 7px;
  padding: 6.5px 9px;
  font-family: var(--font-mono);
  font-size: 12px;
  outline: none;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}
.form-field input:focus, .form-field select:focus {
  border-color: var(--cobalt);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.14);
}

.gates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.gate-tile {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--border);
  border-left: 3.5px solid var(--emerald);
  border-radius: 8px;
  padding: 7.5px 10px;
  box-shadow: 0 2px 8px rgba(24, 24, 27, 0.04);
}
.gate-tile.fail { border-left-color: var(--crimson); }

.proof-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}
.proof-card {
  background: var(--bg-note);
  border: 1px solid rgba(235, 220, 178, 0.92);
  border-radius: 9px;
  padding: 12px 14px;
  font-size: 12.5px;
  line-height: 1.6;
  height: auto;
  overflow: visible;
}

/* ── Floating Frosted Glass Status Toast ── */
.glass-toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 120;
  padding: 9px 14px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.84);
  backdrop-filter: blur(16px) saturate(170%);
  -webkit-backdrop-filter: blur(16px) saturate(170%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #F8FAFC;
  font-size: 12.5px;
  font-weight: 500;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.28);
  opacity: 0;
  transform: translateY(14px) scale(0.96);
  pointer-events: none;
  transition: opacity 240ms var(--ease-spring), transform 280ms var(--ease-spring);
}
.glass-toast.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* ── WorkOrder-4.5: Counterfactual Sandbox, IEC 61131-3 ST Modal & Morning Shift Triage ── */
.guard-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 5px;
}
.guard-head-row .guard-title { margin-bottom: 0; }

.btn-danger-ghost {
  background: linear-gradient(135deg, rgba(254, 242, 242, 0.96) 0%, rgba(254, 226, 226, 0.92) 100%);
  border-color: rgba(239, 68, 68, 0.72);
  color: #B91C1C;
  font-weight: 700;
  box-shadow: 0 3px 10px rgba(220, 38, 38, 0.14);
}
.btn-danger-ghost:hover {
  background: linear-gradient(135deg, #DC2626 0%, #B91C1C 100%);
  border-color: #B91C1C;
  color: #FFFFFF;
  box-shadow: 0 6px 16px rgba(220, 38, 38, 0.28);
}

.btn-st-export {
  background: linear-gradient(135deg, rgba(236, 253, 245, 0.96) 0%, rgba(209, 250, 229, 0.92) 100%);
  border-color: rgba(16, 185, 129, 0.75);
  color: #047857;
  font-weight: 700;
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3.5px 8.5px;
}
.btn-st-export:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  border-color: #047857;
  color: #FFFFFF;
}

.counterfactual-panel {
  display: none;
  flex-direction: column;
  gap: 8px;
  background: linear-gradient(135deg, rgba(254, 242, 242, 0.94) 0%, rgba(255, 251, 245, 0.92) 100%);
  border: 1.5px solid rgba(239, 68, 68, 0.65);
  border-radius: 10px;
  padding: 11px 13px;
  box-shadow: 0 10px 28px rgba(220, 38, 38, 0.10), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
.counterfactual-panel.visible {
  display: flex;
  animation: paneSlideIn 320ms var(--ease-spring);
}
.cf-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.cf-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: #991B1B;
}
.cf-badge {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  background: #DC2626;
  color: #FFFFFF;
  letter-spacing: 0.03em;
}
.cf-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}
.cf-kpi {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(252, 165, 165, 0.78);
  border-radius: 7px;
  padding: 5.5px 8px;
}
.cf-kpi-k { font-size: 10.5px; color: var(--ink-muted); }
.cf-kpi-v { font-family: var(--font-mono); font-size: 13.5px; font-weight: 800; color: #DC2626; margin-top: 1px; }
.cf-kpi-v.safe { color: #059669; }
.cf-canvas-wrap { height: 225px; }
.cf-summary {
  font-size: 11.8px;
  color: #7F1D1D;
  background: rgba(255, 255, 255, 0.72);
  border-left: 3px solid #DC2626;
  border-radius: 5px;
  padding: 6px 9px;
  line-height: 1.45;
}

/* Modal Sub-Panes (Overview Ablation vs Morning Shift Triage & ST vs OPC-UA) */
.ov-pane, .dcs-pane { display: none; }
.ov-pane.active, .dcs-pane.active {
  display: block;
  animation: paneSlideIn 280ms var(--ease-spring);
}

.triage-kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}
.triage-stat {
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 8px 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-left: 3.5px solid var(--cobalt);
}
.triage-stat-num { font-family: var(--font-mono); font-size: 19px; font-weight: 800; line-height: 1; }
.triage-stat-lbl { font-size: 11.5px; color: var(--ink-secondary); font-weight: 600; }

.triage-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.52fr) minmax(0, 1fr);
  gap: 11px;
  align-items: start;
}

.dispatch-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dispatch-card {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 8px 10px;
  cursor: pointer;
  transition: transform 180ms var(--ease-spring), border-color 180ms ease, box-shadow 180ms ease;
}
.dispatch-card:hover {
  transform: translateY(-1.5px);
  border-color: var(--cobalt);
  box-shadow: 0 6px 16px rgba(29, 78, 216, 0.10);
}
.dispatch-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 3px;
}
.dispatch-rank {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 5px;
  color: #FFFFFF;
}
.dispatch-tag { font-family: var(--font-mono); font-weight: 800; font-size: 12.5px; color: var(--ink-primary); }
.dispatch-owner { font-size: 11px; color: var(--ink-muted); }
.dispatch-act { font-size: 11.5px; color: var(--ink-secondary); line-height: 1.4; }
.dispatch-cta { font-size: 11px; color: var(--cobalt); font-weight: 600; margin-top: 3px; text-align: right; }

.dcs-export-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  background: rgba(236, 253, 245, 0.85);
  border: 1px solid var(--emerald-border);
  border-radius: 8px;
  padding: 7px 11px;
  margin-bottom: 10px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: #065F46;
}
.code-viewer {
  margin: 0;
  padding: 13px 15px;
  border-radius: 9px;
  background: #14171F;
  color: #E2E8F0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.52;
  max-height: 58vh;
  overflow: auto;
  white-space: pre;
}

/* ── Stage 5.2: Dual-Stack Agent Chat Drawer, DCS Engineering Badges & HITL Signoff Bar ── */
.btn-chat-toggle {
  background: linear-gradient(135deg, rgba(236, 253, 245, 0.96) 0%, rgba(219, 234, 254, 0.92) 100%);
  border-color: rgba(29, 78, 216, 0.48);
  color: #1E3A8A;
  font-weight: 700;
}
.btn-chat-toggle:hover, .btn-chat-toggle.active {
  background: linear-gradient(135deg, #0F766E 0%, #1D4ED8 100%);
  border-color: #1D4ED8;
  color: #FFFFFF;
}

.cf-proxy-banner {
  background: #991B1B;
  color: #FEF2F2;
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 6px;
  letter-spacing: 0.02em;
  text-align: center;
}

.dcs-badges-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 9px;
}
.eng-pill {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 700;
  padding: 4.5px 10px;
  border-radius: 7px;
  background: rgba(244, 242, 236, 0.90);
  border: 1px solid rgba(208, 204, 194, 0.88);
  color: var(--ink-primary);
}
.eng-pill.cpk-pill {
  background: rgba(239, 246, 255, 0.88);
  border-color: var(--cobalt-border);
  color: #1E40AF;
}
.eng-pill.dir-pill.ok {
  background: var(--emerald-soft);
  border-color: var(--emerald-border);
  color: #065F46;
}
.eng-pill.dir-pill.warn {
  background: var(--amber-soft);
  border-color: var(--amber-border);
  color: #92400E;
}
.eng-pill.dir-pill.fail {
  background: var(--crimson-soft);
  border-color: var(--crimson-border);
  color: #991B1B;
}

.hitl-bar {
  margin: 0 0 9px 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 251, 235, 0.88);
  border: 1px solid rgba(252, 211, 77, 0.85);
}
.hitl-bar.signed {
  background: rgba(236, 253, 245, 0.88);
  border-color: rgba(110, 231, 183, 0.88);
}
.hitl-bar.locked {
  background: rgba(254, 242, 242, 0.85);
  border-color: rgba(252, 165, 165, 0.82);
}
.hitl-status-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #92400E;
  margin-bottom: 8px;
}
.hitl-bar.signed .hitl-status-line { color: #065F46; }
.hitl-bar.locked .hitl-status-line { color: #991B1B; margin-bottom: 0; }
.hitl-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
  flex-shrink: 0;
}
.hitl-bar.signed .hitl-dot { background: var(--emerald); }
.hitl-bar.locked .hitl-dot { background: var(--crimson); }

.hitl-form {
  display: grid;
  grid-template-columns: 92px 118px minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
}
.hitl-form input, .hitl-form select {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 5px 7px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-primary);
  min-width: 0;
}
.hitl-receipt-box {
  font-family: var(--font-mono);
  font-size: 11px;
  color: #065F46;
  background: rgba(255, 255, 255, 0.82);
  border: 1px dashed var(--emerald-border);
  border-radius: 6px;
  padding: 6px 8px;
  line-height: 1.45;
}

/* Docked Right-Column Frosted Agent Chat Workbench (Aligns flush with .col-right!) */
.chat-drawer {
  position: fixed;
  top: 108px;
  right: 20px;
  bottom: 12px;
  width: min(690px, 43vw);
  z-index: 80;
  display: flex;
  flex-direction: column;
  background: rgba(252, 251, 248, 0.97);
  backdrop-filter: blur(26px) saturate(180%);
  -webkit-backdrop-filter: blur(26px) saturate(180%);
  border: 1px solid rgba(196, 192, 182, 0.95);
  border-top: 3px solid var(--cobalt);
  border-radius: 15px;
  box-shadow: -10px 16px 42px rgba(15, 23, 42, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.98);
  transform: translate3d(108%, 0, 0);
  opacity: 0;
  pointer-events: none;
  transition: transform 300ms var(--ease-spring), opacity 220ms ease;
  overflow: hidden;
}
.chat-drawer.open {
  transform: translate3d(0, 0, 0);
  opacity: 1;
  pointer-events: auto;
}
.chat-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.chat-focus-pill {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(239, 246, 255, 0.95);
  border: 1px solid var(--cobalt-border);
  color: #1D4ED8;
}
.preset-cat-tabs {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-bottom: 7px;
}
.preset-cat-btn {
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink-secondary);
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 700;
  padding: 3.5px 9px;
  border-radius: 7px;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
}
.preset-cat-btn.active {
  background: var(--cobalt);
  border-color: var(--cobalt);
  color: #FFFFFF;
}
.preset-cat-btn.danger.active {
  background: #DC2626;
  border-color: #DC2626;
  color: #FFFFFF;
}
.chat-head {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.82);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.chat-title {
  font-family: var(--font-display);
  font-size: 15.5px;
  font-weight: 800;
  color: var(--ink-primary);
}
.chat-crew-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.chat-role-pill {
  font-size: 12px;
  font-weight: 700;
  padding: 2.5px 9px;
  border-radius: 999px;
}
.chat-role-pill.role-lu {
  background: var(--cobalt-soft);
  border: 1px solid var(--cobalt-border);
  color: #1E40AF;
}
.chat-role-pill.role-zhou {
  background: var(--amber-soft);
  border: 1px solid var(--amber-border);
  color: #92400E;
}

.chat-presets-wrap {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: rgba(244, 242, 236, 0.65);
}
.chat-presets-lbl {
  font-size: 10.5px;
  color: var(--ink-muted);
  margin-bottom: 5px;
}
.chat-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-height: 92px;
  overflow-y: auto;
}
.preset-pill {
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.90);
  color: var(--ink-primary);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 140ms ease, border-color 160ms ease, background-color 160ms ease;
}
.preset-pill:hover {
  border-color: var(--cobalt);
  background: var(--cobalt-soft);
  color: var(--cobalt);
  transform: translateY(-1px);
}
.preset-pill.refusal {
  border-color: rgba(252, 165, 165, 0.9);
  background: rgba(254, 242, 242, 0.88);
  color: #991B1B;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chat-msg {
  border-radius: 10px;
  padding: 10px 13px;
  font-size: 13px;
  line-height: 1.58;
  border: 1px solid var(--border);
  animation: paneSlideIn 240ms var(--ease-spring);
}
.chat-msg.user {
  align-self: flex-end;
  max-width: 88%;
  background: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%);
  color: #FFFFFF;
  border-color: #1D4ED8;
}
.chat-msg.assistant {
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink-primary);
}
.chat-msg.blocked {
  background: rgba(254, 242, 242, 0.95);
  border-color: rgba(239, 68, 68, 0.65);
}
.msg-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 5px;
  font-size: 11px;
}
.msg-author { font-weight: 700; color: var(--ink-secondary); }
.msg-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 1.5px 7px;
  border-radius: 999px;
}
.msg-badge.ok { background: var(--emerald-soft); color: #065F46; border: 1px solid var(--emerald-border); }
.msg-badge.blocked { background: #DC2626; color: #FFFFFF; }

.msg-chain {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
}
.chain-chip {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 1.5px 6px;
  border-radius: 5px;
  background: rgba(244, 242, 236, 0.9);
  border: 1px solid var(--border);
  color: var(--ink-secondary);
}
.chain-chip.skill { background: #EFF6FF; border-color: #BFDBFE; color: #1D4ED8; }
.chain-chip.cit { background: #FFFBEB; border-color: #FDE68A; color: #92400E; }

.ep-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 800;
  padding: 0 5px;
  border-radius: 4px;
}
.ep-confirmed { background: #DCFCE7; color: #166534; }
.ep-likely { background: #DBEAFE; color: #1E40AF; }
.ep-pending { background: #FEF3C7; color: #92400E; }

.chat-input-bar {
  padding: 9px 12px;
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.88);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.chat-input-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.chat-input-top select {
  background: var(--bg-subtle);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 3px 7px;
  font-size: 11px;
  color: var(--ink-secondary);
}
.chat-mount-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-muted);
}
.chat-input-row {
  display: flex;
  gap: 6px;
}
.chat-input-row input {
  flex: 1;
  background: #FFFFFF;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  padding: 7px 10px;
  font-size: 12px;
  color: var(--ink-primary);
  outline: none;
}
.chat-input-row input:focus {
  border-color: var(--cobalt);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.14);
}

@media (max-width: 1260px) {
  .topbar { flex-wrap: wrap; }
  .topbar-actions { flex-wrap: wrap; }
  .workspace { grid-template-columns: 1fr; }
  .guard-scene { grid-template-columns: 1fr; }
  .triage-grid { grid-template-columns: 1fr; }
  .triage-kpi-strip, .cf-kpi-row { grid-template-columns: repeat(2, 1fr); }
  .hitl-form { grid-template-columns: 1fr 1fr; }
  .chat-drawer { width: calc(100vw - 24px); }
  .kbd-hints { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}


/* ═══════════════════════════════════════════════════════════════════════
   Stage 5.28: Hardcore Dual-Domain Canvases, Vector P&ID Mimic, 25-LED
   Audit Micro-Chip, openJiuwen X-Ray Kernel Drawer & Cascade Scenario
   ═══════════════════════════════════════════════════════════════════════ */
.case-dot.dot-rose {
  background: #E11D48;
  box-shadow: 0 0 0 3px rgba(225, 29, 72, 0.16);
}

/* X-Ray Kernel Toggle & Dark Glass Telemetry Drawer */
.btn-xray-toggle {
  padding: 5px 10px;
  font-size: 11.5px;
  font-weight: 600;
  color: #E2E8F0;
  background: linear-gradient(135deg, #1E293B, #0F172A);
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 8px;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}
.btn-xray-toggle:hover {
  border-color: #38BDF8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.18);
  transform: translateY(-1px);
}
.btn-xray-toggle.active {
  background: linear-gradient(135deg, #0F172A, #1D4ED8);
  border-color: #60A5FA;
  color: #FFFFFF;
}

.xray-drawer {
  display: none;
  margin-top: 8px;
  padding: 11px 13px;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(17, 24, 39, 0.96));
  border: 1px solid rgba(100, 116, 139, 0.36);
  color: #E2E8F0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 14px 32px rgba(15, 23, 42, 0.24);
}
.xray-drawer.open {
  display: block;
}
.xray-grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr 1.15fr;
  gap: 10px;
}
.xray-col {
  background: rgba(30, 41, 59, 0.62);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 8px;
  padding: 8px 10px;
  min-width: 0;
}
.xray-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  color: #93C5FD;
  margin-bottom: 6px;
  padding-bottom: 5px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}
.xray-badge {
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 1.5px 6px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.18);
  color: #6EE7B7;
  border: 1px solid rgba(52, 211, 153, 0.35);
}
.xray-pre {
  margin: 0;
  max-height: 152px;
  overflow: auto;
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1.42;
  color: #CBD5E1;
  white-space: pre-wrap;
  word-break: break-all;
}
.xray-onto-body,
.xray-mcp-list {
  max-height: 152px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1.45;
}
.xray-uri {
  color: #FDE68A;
  word-break: break-all;
}
.xray-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.xray-tag {
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
}
.xray-tag.ok { background: rgba(16, 185, 129, 0.18); color: #6EE7B7; border: 1px solid rgba(52, 211, 153, 0.32); }
.xray-tag.blk { background: rgba(239, 68, 68, 0.18); color: #FCA5A5; border: 1px solid rgba(248, 113, 113, 0.32); }
.xray-tag.topo { background: rgba(56, 189, 248, 0.18); color: #7DD3FC; border: 1px solid rgba(56, 189, 248, 0.32); }
.xray-mcp-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 6px;
  align-items: center;
  padding: 3.5px 6px;
  border-radius: 5px;
  background: rgba(15, 23, 42, 0.62);
  border: 1px solid rgba(148, 163, 184, 0.14);
}
.xray-mcp-hash { color: #38BDF8; font-size: 10px; }
.xray-mcp-ms { color: #94A3B8; font-size: 10px; white-space: nowrap; }

/* STEP 01 / 02 Transfer Function Plate & Dual-Canvas Side-by-Side Grids */
.tf-plate {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: #0F766E;
  background: rgba(240, 253, 250, 0.92);
  border: 1px solid rgba(13, 148, 136, 0.35);
  border-radius: 6px;
  padding: 2px 8px;
  white-space: nowrap;
}
.tf-plate.tf-mismatch {
  color: #B91C1C;
  background: rgba(254, 242, 242, 0.94);
  border-color: rgba(220, 38, 38, 0.35);
}
.swatch.swatch-dash {
  background: transparent !important;
  border-top: 2px dashed #0D9488;
  height: 0;
  width: 14px;
  border-radius: 0;
}

.dual-canvas-grid {
  display: grid;
  gap: 8px;
  align-items: stretch;
}
.dual-canvas-grid.single-primary {
  grid-template-columns: 1fr;
}
.dual-canvas-grid.single-primary .dual-side-pane {
  display: none;
}
.dual-canvas-grid.single-side {
  grid-template-columns: 1fr;
}
.dual-canvas-grid.single-side > .canvas-wrap:first-child {
  display: none;
}
.dual-canvas-grid.single-side .dual-side-pane {
  display: block;
}
.dual-canvas-grid.dual-stiction {
  grid-template-columns: 62fr 38fr;
}
.dual-canvas-grid.dual-step-nyq {
  grid-template-columns: 58fr 42fr;
}
.dual-canvas-grid .dual-side-pane {
  position: relative;
}
.pane-corner-tag {
  position: absolute;
  top: 6px;
  right: 8px;
  z-index: 3;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: #334155;
  background: rgba(253, 252, 250, 0.9);
  border: 1px solid rgba(203, 213, 225, 0.85);
  border-radius: 5px;
  padding: 1.5px 6px;
  pointer-events: none;
}

/* Vector ISA-5.1 P&ID Micro-Mimic Strip & Precision DCS Digital Readout */
.pid-mimic-strip {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  background: linear-gradient(135deg, rgba(250, 249, 245, 0.95), rgba(243, 240, 232, 0.92));
  border: 1px solid rgba(208, 202, 188, 0.88);
  border-radius: 10px;
  padding: 5px 8px;
  margin-bottom: 8px;
  min-height: 66px;
}
.pid-mimic-svg-wrap {
  width: 100%;
  height: 58px;
  display: flex;
  align-items: center;
  overflow: hidden;
}
.pid-mimic-svg-wrap svg {
  width: 100%;
  height: 58px;
  display: block;
}
.dcs-digital-head {
  display: grid;
  grid-template-columns: repeat(2, minmax(66px, auto));
  gap: 3px 8px;
  background: #18181B;
  color: #E2E8F0;
  border: 1px solid rgba(71, 85, 105, 0.65);
  border-radius: 7px;
  padding: 5px 8px;
  font-family: var(--font-mono);
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.45);
}
.dcs-dig-item {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.dcs-dig-k {
  font-size: 9px;
  color: #94A3B8;
  letter-spacing: 0.04em;
}
.dcs-dig-v {
  font-size: 11.5px;
  font-weight: 700;
  color: #6EE7B7;
}
.dcs-dig-v.amber { color: #FCD34D; }
.dcs-dig-v.red { color: #FCA5A5; }
.dcs-dig-v.blue { color: #93C5FD; }

@keyframes mimicPulse {
  0%, 100% { opacity: 0.95; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(1.18); }
}
.mimic-pulse-ring {
  transform-box: fill-box;
  transform-origin: center;
  animation: mimicPulse 1.5s ease-in-out infinite;
}

/* 5x5 (25-Cell) Multi-Scenario Safety Audit Micro-LED Matrix Chip */
.audit-micro-chip {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 6px 0;
  padding: 6px 10px;
  border-radius: 9px;
  background: rgba(248, 250, 252, 0.9);
  border: 1px solid rgba(203, 213, 225, 0.9);
  cursor: pointer;
  text-align: left;
  transition: border-color 160ms ease, background 160ms ease, transform 150ms ease;
}
.audit-micro-chip:hover {
  border-color: #1D4ED8;
  background: rgba(239, 246, 255, 0.85);
  transform: translateY(-1px);
}
.audit-chip-meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 96px;
}
.audit-chip-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-primary);
}
.audit-chip-stat {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-secondary);
}
.audit-chip-grid {
  display: grid;
  grid-template-columns: repeat(5, 11px);
  grid-template-rows: repeat(5, 7px);
  gap: 2.5px;
  padding: 3px 6px;
  border-radius: 6px;
  background: #18181B;
  border: 1px solid rgba(100, 116, 139, 0.45);
}
.audit-led {
  border-radius: 2px;
  background: #475569;
}
.audit-led.pass { background: #10B981; box-shadow: 0 0 4px rgba(16, 185, 129, 0.55); }
.audit-led.fail { background: #EF4444; box-shadow: 0 0 4px rgba(239, 68, 68, 0.65); }
.audit-led.locked { background: #F59E0B; opacity: 0.72; }
.audit-chip-jump {
  font-size: 11px;
  font-weight: 600;
  color: var(--cobalt);
  white-space: nowrap;
}

/* Nonlinear Pilot Proof Card in Overview Modal */
.proof-card.proof-wide {
  grid-column: span 2;
  background: linear-gradient(135deg, rgba(240, 253, 250, 0.92), rgba(239, 246, 255, 0.9));
  border-color: rgba(13, 148, 136, 0.35);
}
.nl-mini-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 6px;
  font-size: 11.5px;
}
.nl-mini-table th,
.nl-mini-table td {
  padding: 4px 6px;
  border-bottom: 1px solid rgba(203, 213, 225, 0.65);
  text-align: left;
}
.nl-mini-table th {
  color: #334155;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.55);
}

@media (max-width: 1180px) {
  .dual-canvas-grid.dual-stiction,
  .dual-canvas-grid.dual-step-nyq,
  .xray-grid {
    grid-template-columns: 1fr;
  }
  .proof-card.proof-wide {
    grid-column: span 1;
  }
}

@media (max-width: 1520px) {
  .topbar {
    gap: 10px;
    padding: 8px 14px;
  }
  .scenario-seg .seg-case {
    padding: 5.5px 9px;
    font-size: 12px;
  }
  .topbar-actions .btn.btn-lg {
    padding: 7px 11px;
    font-size: 12.5px;
  }
}

/* Stage 6 Multimodal VisionWitness & FieldIntake Panes */
.vision-intake-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 12px;
}
.vision-panel-img {
  width: 100%;
  border-radius: 9px;
  border: 1px solid rgba(203, 213, 225, 0.85);
  background: #FFFFFF;
}
.intake-field-tag {
  display: inline-block;
  margin: 2px 4px 2px 0;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  background: rgba(241, 245, 249, 0.92);
  border: 1px solid rgba(203, 213, 225, 0.85);
}
.intake-field-tag.ok {
  background: rgba(236, 253, 245, 0.9);
  border-color: rgba(110, 231, 183, 0.85);
  color: #065F46;
}
.intake-field-tag.warn {
  background: rgba(255, 251, 235, 0.94);
  border-color: rgba(252, 211, 77, 0.9);
  color: #92400E;
}
@media (max-width: 1080px) {
  .vision-intake-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Gemini Frontend Redesign: Stage 6 Direct Ribbon, Inline Tabs & 1280px Responsive Polish ── */
.card-head {
  flex-wrap: wrap;
}
.stage6-rail {
  position: relative;
  z-index: 28;
  background: rgba(246, 243, 236, 0.92);
  border-bottom: 1px solid rgba(214, 210, 200, 0.72);
}
.stage6-inner {
  max-width: 1680px;
  margin: 0 auto;
  padding: 5px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.stage6-metrics {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.s6-stat {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  background: transparent;
  border: none;
  padding: 3px 6px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--ink-primary);
  font-family: var(--font-sans);
  transition: background-color 160ms var(--ease-spring), color 160ms var(--ease-spring);
}
.s6-stat:hover {
  background: rgba(255, 255, 255, 0.78);
}
.s6-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-secondary);
  white-space: nowrap;
}
.s6-val {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}
.s6-sep {
  width: 1px;
  height: 14px;
  background: rgba(188, 183, 172, 0.72);
}
.stage6-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.btn-s6-guard {
  border-color: rgba(217, 119, 6, 0.45);
  color: #92400E;
  background: rgba(255, 251, 235, 0.92);
}
.btn-s6-guard:hover {
  background: #FEF3C7;
  border-color: rgba(217, 119, 6, 0.75);
}

.s6-guard-box {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.s6-guard-head {
  font-size: 12.5px;
  color: var(--ink-primary);
  margin-bottom: 6px;
}
.s6-guard-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.s6-guard-controls select {
  flex: 1;
  min-width: 220px;
  padding: 5px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  font-size: 12px;
  background: #FFFFFF;
}

@media (max-width: 1420px) {
  .topbar {
    gap: 8px;
    padding: 7px 14px;
  }
  .brand-name {
    font-size: 17.5px;
  }
  .brand-sub {
    font-size: 11px;
    max-width: 175px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .scenario-seg .seg-case {
    padding: 5px 8px;
    font-size: 12px;
    gap: 5px;
  }
  .topbar-actions {
    gap: 5px;
  }
  .topbar-actions .btn.btn-lg {
    padding: 6px 9px;
    font-size: 12px;
  }
  .seg-mini button {
    padding: 4px 8px;
    font-size: 12px;
  }
}

@media (max-width: 1180px) {
  .topbar {
    flex-wrap: wrap;
  }
  .topbar-actions {
    flex-wrap: wrap;
  }
}

@media (max-width: 640px) {
  .stage6-inner, .utility-inner {
    padding: 6px 12px;
  }
  .s6-sep {
    display: none;
  }
}
